Uploaded MSHV v2.69 Non-Gendered

This commit is contained in:
[Harper Innes]
2024-02-12 11:29:54 +11:00
parent 022d024fe8
commit bd72b4cdb0
567 changed files with 229585 additions and 0 deletions

View File

@ -0,0 +1,727 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV JT65 Generator
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2017
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "gen65.h"
//#include <QtGui>
/* Reed-Solomon encoder
* Copyright 2002, Phil Karn, KA9Q
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
///////////////////////// init_rs_int, encode_rs_int //////////
/* Initialize a Reed-Solomon codec
* symsize = symbol size, bits (1-8)
* gfpoly = Field generator polynomial coefficients
* fcr = first root of RS code generator polynomial, index form
* prim = primitive element to generate polynomial roots
* nroots = RS code generator polynomial degree (number of roots)
* pad = padding bytes at front of shortened block
*/
//void *INIT_RS(int symsize,int gfpoly,int fcr,int prim,
// int nroots,int pad){
#include <stdlib.h>
//#include "int.h"
//#include "char.h"
#define DTYPE int
/* Reed-Solomon codec control block */
struct rs
{
int mm; /* Bits per symbol */
int nn; /* Symbols per block (= (1<<mm)-1) */
DTYPE *alpha_to; /* log lookup table */
DTYPE *index_of; /* Antilog lookup table */
DTYPE *genpoly; /* Generator polynomial */
int nroots; /* Number of generator roots = number of parity symbols */
int fcr; /* First consecutive root, index form */
int prim; /* Primitive element, index form */
int iprim; /* prim-th root of 1, index form */
int pad; /* Padding bytes in shortened block */
};
static int modnn(struct rs *rs,int x)
{
while (x >= rs->nn)
{
x -= rs->nn;
x = (x >> rs->mm) + (x & rs->nn);
}
return x;
}
#define MODNN(x) modnn(rs,x)
#define MM (rs->mm)
#define NN (rs->nn)
#define ALPHA_TO (rs->alpha_to)
#define INDEX_OF (rs->index_of)
#define GENPOLY (rs->genpoly)
//#define NROOTS (rs->nroots)
#define NROOTS (51)
#define FCR (rs->fcr)
#define PRIM (rs->prim)
#define IPRIM (rs->iprim)
#define PAD (rs->pad)
#define A0 (NN)
#define ENCODE_RS encode_rs_int
#define DECODE_RS decode_rs_int
#define INIT_RS init_rs_int
#define FREE_RS free_rs_int
void *init_rs_int(int symsize,int gfpoly,int fcr,int prim,
int nroots,int pad)
{
struct rs *rs;
int i, j, sr,root,iprim;
/* Check parameter ranges */
//if(symsize < 0 || symsize > 8*sizeof(DTYPE))
if (symsize < 0 || (unsigned int)symsize > 8*sizeof(DTYPE))
return NULL; /* Need version with ints rather than chars */
if (fcr < 0 || fcr >= (1<<symsize))
return NULL;
if (prim <= 0 || prim >= (1<<symsize))
return NULL;
if (nroots < 0 || nroots >= (1<<symsize))
return NULL; /* Can't have more roots than symbol values! */
if (pad < 0 || pad >= ((1<<symsize) -1 - nroots))
return NULL; /* Too much padding */
rs = (struct rs *)calloc(1,sizeof(struct rs));
rs->mm = symsize;
rs->nn = (1<<symsize)-1;
rs->pad = pad;
rs->alpha_to = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1));
if (rs->alpha_to == NULL)
{
free(rs);
return NULL;
}
rs->index_of = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1));
if (rs->index_of == NULL)
{
free(rs->alpha_to);
free(rs);
return NULL;
}
/* Generate Galois field lookup tables */
rs->index_of[0] = A0; /* log(zero) = -inf */
rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */
sr = 1;
for (i=0;i<rs->nn;i++)
{
rs->index_of[sr] = i;
rs->alpha_to[i] = sr;
sr <<= 1;
if (sr & (1<<symsize))
sr ^= gfpoly;
sr &= rs->nn;
}
if (sr != 1)
{
/* field generator polynomial is not primitive! */
free(rs->alpha_to);
free(rs->index_of);
free(rs);
return NULL;
}
/* Form RS code generator polynomial from its roots */
rs->genpoly = (DTYPE *)malloc(sizeof(DTYPE)*(nroots+1));
if (rs->genpoly == NULL)
{
free(rs->alpha_to);
free(rs->index_of);
free(rs);
return NULL;
}
rs->fcr = fcr;
rs->prim = prim;
rs->nroots = nroots;
/* Find prim-th root of 1, used in decoding */
for (iprim=1;(iprim % prim) != 0;iprim += rs->nn)
;
rs->iprim = iprim / prim;
rs->genpoly[0] = 1;
for (i = 0,root=fcr*prim; i < nroots; i++,root += prim)
{
rs->genpoly[i+1] = 1;
/* Multiply rs->genpoly[] by @**(root + x) */
for (j = i; j > 0; j--)
{
if (rs->genpoly[j] != 0)
rs->genpoly[j] = rs->genpoly[j-1] ^ rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[j]] + root)];
else
rs->genpoly[j] = rs->genpoly[j-1];
}
/* rs->genpoly[0] can never be zero */
rs->genpoly[0] = rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[0]] + root)];
}
/* convert rs->genpoly[] to index form for quicker encoding */
for (i = 0; i <= nroots; i++)
rs->genpoly[i] = rs->index_of[rs->genpoly[i]];
return rs;
}
void encode_rs_int(
#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;
}
}
// ot ftrsd ne ot lib
/*void encode_rs_int(
#ifndef FIXED
void *p,
#endif
DTYPE *data, DTYPE *bb){
#ifndef FIXED
struct rs *rs = (struct rs *)p;
#endif
int i, j;
DTYPE feedback;
memset(bb,0,NROOTS*sizeof(DTYPE));
for(i=0;i<NN-NROOTS;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;
}
}*/
///////////////////////////////end init_rs_int, encode_rs_int Reed-Solomon encoder //////////
Gen65::Gen65()
{
//2.12
for (int i = 0; i < 126; ++i)
{
pr[i]=0.0;
mdat[i] = 0;
mdat2[i] = 0;
mref_[0][i] = 0;
mref_[1][i] = 0;
mref2_[0][i] = 0;
mref2_[1][i] = 0;
}
rs = NULL;
//2.12
twopi=8.0*atan(1.0);
first=true;
sendingsh = 0;
//(GEN_SAMPLE_RATE= 48000sr*250ms)/1000ms = 12000 smples for 250ms 48000-12000=36000
//count_1s = 48000.0-((48000.0*700.0)/1000.0);//siquencer 250ms <- MsPlayerHV::xplaymessage
//qDebug()<<count_1s;
}
Gen65::~Gen65()
{}
void Gen65::setup65()
{
int nprc[126]={1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0,
0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1,
0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1,
0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1,
0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1,
1,1,1,1,1,1};
int mr2 = 0;
//int mdat[126];
//int mdat2[126];
//int mref_[2][126];
//int mref2_[2][126];
//mref_[0][0] = 0;
//mref2_[0][0]= 0;
//! Put the appropriate pseudo-random sequence into pr
int nsym=126;
for (int i = 0; i < nsym; i++)
{//do i=1,nsym
pr[i]=(double)2.0*nprc[i]-1.0;
}
//! Determine locations of data and reference symbols
int k=0;
int mr1=-1; //0
for (int i = 0; i < nsym; i++)
{//do i=1,nsym
if (pr[i]<0.0)
{
//k=k+1;
mdat[k]=i;
k++;
}
else
{
mr2=i;
if (mr1==-1) mr1=i; //if(mr1.eq.0) mr1=i
}
}
int nsig=k;
//! Determine the reference symbols for each data symbol.
for (k = 0; k < nsig; k++)
{//do k=1,nsig
int n;
int m=mdat[k];
mref_[0][k]=mr1; //mref(k,1)=mr1
for (n = 0; n < 10; n++)
{//do n=1,10 //!Get ref symbol before data
if ((m-n)>-1) //hv if((m-n)>0) then if((m-n).gt.0) then
{
if (pr[m-n]>0.0) goto c10;
}
}
goto c12;
c10:
mref_[0][k]=m-n;
c12:
mref_[1][k]=mr2;
for (n = 0; n < 10; n++)
{//do n=1,10 //!Get ref symbol after data //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if ((m+n)<nsym) //hv if((m+n)<=nsym) then
{
if (pr[m+n]>0.0) goto c20; //if (pr(m+n).gt.0.0) go to 20
}
}
goto c22;
c20:
mref_[1][k]=m+n;
c22:
continue;
}
//! Now do it all again, using opposite logic on pr(i)
k=0;
mr1=-1;//0
for (int i = 0; i < nsym; i++)
{//do i=1,nsym
if (pr[i]>0.0)
{
//k=k+1
mdat2[k]=i;
k++;
}
else
{
mr2=i;
if (mr1==-1) mr1=i;//hv -1 from 0
}
}
nsig=k;
for (k = 0; k < nsig; k++)
{//do k=1,nsig
int n;
int m=mdat2[k];
mref2_[0][k]=mr1;
for (n = 0; n < 10; n++)
{//do n=1,10
if ((m-n)>-1) //hv if((m-n)>0) then //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
{
if (pr[m-n]<0.0) goto c110;
}
}
goto c112;
c110:
mref2_[0][k]=m-n;
c112:
mref2_[1][k]=mr2;
for (n = 0; n < 10; n++)
{//do n=1,10
if ((m+n)<nsym) //hv if((m+n)<=nsym) then
{
if (pr[m+n]<0.0) goto c120;
}
}
goto c122;
c120:
mref2_[1][k]=m+n;
c122:
continue;
}
}
// vremenno mai postoianno 1.46
QString Gen65::unpackmsg(int *dat,char &ident)
{
return TPackUnpackMsg.unpackmsg(dat,ident,false);//rpt_db_msg ," "
}
void Gen65::packmsg(char *cmsg,int *dgen,int &itype)//1.49 for deep search 65
{
TPackUnpackMsg.packmsg(cmsg,dgen,itype,false);//false,
}
void Gen65::chkmsg(QString &message,QString &cok,int &nspecial,double &flip)
{
nspecial=0;
flip=1.0;
int i = 0;
for (i = 21; i >= 0; i--)
{//do i=22,1,-1
if (message.at(i)!=' ') goto c10;
}
i=21;//22 //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
c10:
if (i>=10) //11
{//if((message(i-3:i).eq.' OOO') .or. (message(20:22).eq.' OO')) then
if ((message.mid(i-3,4)==" OOO") || (message.mid(19,3)==" OO"))
{
//qDebug()<<"message.mid"<<message.mid(19,3);
cok="OOO";
flip=-1.0;
if (message.mid(19,3)==" OO") //if(message(20:22)==" OO")
message=message.mid(0,19); //message=message(1:19)
else
message=message.mid(0,i-3); //1.35 4=3 message=message(1:i-4)
}
}
message.append(" ");//30 triabva
if (message.mid(4,18)==" ") //if(message(5:22)==" ")
{
if (message.mid(0,2)=="RO") nspecial=2;
if (message.mid(0,3)=="RRR") nspecial=3;
if (message.mid(0,2)=="73") nspecial=4;
}
//qDebug()<<"message"<<message<<nspecial;
}
void Gen65::rs_encode(int *dgen, int *sent)
// Encode JT65 data dgen[12], producing sent[63].
{
int dat1[12];
int b[51];
int i;
if (first)
{
// Initialize the JT65 codec
rs=init_rs_int(6,0x43,3,1,51,0); //rs=init_rs_int(6,0x43,3,1,51,0);
first=false;
}
// Reverse data order for the Karn codec.
for (i=0;
i<12;
i++)
{
dat1[i]=dgen[11-i];
}
// Compute the parity symbols
encode_rs_int(rs,dat1,b);
// Move parity symbols and data into sent[] array, in reverse order.
for (i = 0;
i < 51;
i++) sent[50-i] = b[i];
for (i = 0;
i < 12;
i++) sent[i+51] = dat1[11-i];
}
void Gen65::move(int *x, int *y, int n)
{
//real x(n),y(n)
for (int i = 0; i < n; i++)
{//do i=1,n
y[i]=x[i];
}
}
void Gen65::interleave63(int *d1,int idir)
{
//! Interleave (idir=1) or de-interleave (idir=-1) the array d1.
//integer d1(0:6,0:8)
//integer d2(0:8,0:6)
int d2[63];
if (idir >= 0) //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. then
{
int z = 0;
for (int i = 0; i < 7; i++)
{//do i=0,6
int k = 0;
for (int j = 0; j < 9; j++)
{//do j=0,8
//qDebug()<<"z="<<i+k<<z;
d2[z]=d1[i+k]; //d2(j,i)=d1(i,j)
k+=7;
z++;
}
}
move(d2,d1,63); //call move(d2,d1,63)
}
else
{
move(d1,d2,63); //call move(d1,d2,63)
int z = 0;
for (int i = 0; i < 7; i++)
{//do i=0,6
int k = 0;
for (int j = 0; j < 9; j++)
{//do j=0,8
d1[i+k]=d2[z];//d1(i,j)=d2(j,i)
k+=7;
z++;
}
}
}
}
int Gen65::igray(int n0, int idir)
{
int n;
unsigned long sh;
unsigned long nn;
n=n0;//n=*n0;
if (idir>0) return (n ^ (n >> 1));//if(*idir>0) return (n ^ (n >> 1));
sh = 1;
nn = (n >> sh);
while (nn > 0)
{
n ^= nn;
sh <<= 1;
nn = (n >> sh);
}
return (n);
}
void Gen65::graycode(int *ia,int n,int idir,int *ib)
{
//integer ia(n),ib(n)
for (int i = 0; i < n; i++)
{//do i=1,n
ib[i]=igray(ia[i],idir);
}
}
void Gen65::graycode65(int *dat,int n,int idir)
{
for (int i = 0; i < n; i++)
{//do i=1,n
dat[i]=igray(dat[i],idir);
}
}
int Gen65::gen65(char *cmsg,int mode65,int nfast,double samfac,double GEN_SAMPLE_RATE,short *t_iwave)//double ntxdf, double /*koef_srate*/
{
//qDebug()<<"GEN_SAMPLE_RATE"<<GEN_SAMPLE_RATE;
//! Encodes a JT65 message into a wavefile.
s_unpack_msg = "";
QString cok = " ";
int nspecial = 0;
double flip = 1.0;
QString message;
int dgen[13]; //12
int itype = -1;
int sent[63];
double tsymbol = 0.0;
int nsym = 0;
double dt,f0,dfgen,t,phi;
double dphi = 0.0;
int nwave = 0;
sendingsh = 0;
if (fabs(pr[0])!=1.0) setup65();//if(abs(pr(1)).ne.1.0) call setup65
//for (int z = 0; z < 126; z++)
// qDebug()<<pr[z]<<z;
int nmsg1 = strlen(cmsg);
for (int z = 0; z < nmsg1; z++)
message.append(cmsg[z]);
message.append(" ");//30 triabva
for (int z = 0; z < 13; z++)
dgen[z] = 0;
//for (int z = 0; z < 63; z++)
//sent[z] = 0;
chkmsg(message,cok,nspecial,flip);
if (nspecial==0)
{
TPackUnpackMsg.packmsg(cmsg,dgen,itype,false); //!Pack message into 72 bits false,
sendingsh=0;
if ((dgen[9] & 8)!=0)//if(iand(dgen(10),8)!=0) sendingsh=-1; //!Plain text flag //sent(k)=iand(1,ishft(i-1,-n)) -> sent[k]=1 & (i >> n)
{
//qDebug()<<"Plain text flag";
sendingsh=-1;
}
rs_encode(dgen,sent);
interleave63(sent,1); //!Apply interleaving
//qDebug()<<"nspecial="<<nspecial;
graycode65(sent,63,1); //graycode(sent,63,1); //!Apply Gray code
tsymbol=4096.0/((double)nfast*11025.0);//ne se buta48khz raboti se s11025 *1.088435374149;
nsym=126; //!Symbols per transmission
}
else
{
tsymbol=16384.0/11025.0; //ne se buta48khz raboti se s11025 *1.088435374149;
nsym=32;
sendingsh=1; //!Flag for shorthand message
}
//qDebug()<<"sendingsh"<<sendingsh;
//! Set up necessary constants
dt=1.0/(samfac*GEN_SAMPLE_RATE);// moze bi samo towa48khz
f0=(118.0*(11025.0)/1024.0);//+ ntxdf; //1270.46 ne se buta48khz raboti se s11025 /1.0884 ;
dfgen=(mode65*(11025.0)/4096.0); //ne se buta48khz raboti se s11025 /1.0884
t=0.0;
phi=0.0;
int k=0;
int j0=-1; //-1 hv vazno za " ooo" j0=0
int ndata=((double)nsym*GEN_SAMPLE_RATE*samfac*tsymbol)/2.0; // moze bi samo towa48khz
ndata=2*ndata;
int i = 0;
// 250 ms from MsPlayerHV (GEN_SAMPLE_RATE= 48000sr*250ms)/1000ms = 12000 smples for 250ms 48000-12000=36000
/*for (int z = 0; z < count_1s; z++)
{
t_iwave[i]=0;
i++;
}*/
for (int z = 0; z < ndata; z++)
{//do i=1,ndata //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
t=t+dt;
int j=int(t/tsymbol) + 0; //vazno za " ooo" j=int(t/tsymbol) + 1 // !Symbol number, 1-126
if (j!=j0)
{
double f=f0;
if (nspecial!=0 && fmod(j,2)==0) f=f0+10.0*(double)nspecial*dfgen;
if (nspecial==0 && (flip*pr[j])<0.0)
{
//k=k+1
f=f0+(double)(sent[k]+2)*dfgen; //f=f0+(sent(k)+2)*dfgen
k++;
//qDebug()<<"=========================flip="<<pr[j];
}
//qDebug()<<"NOflip=";
dphi=twopi*dt*f;
j0=j;
}
phi=phi+dphi;
if (phi > twopi) phi -= twopi;
t_iwave[i]=(short)(32600.0*sin(phi)); //32767.0 realy is 128 do not make distortions //iwave(i)=32767.0*sin(phi)
i++;
}
for (int z = 0; z < GEN_SAMPLE_RATE*5 ; z++) ////5s + 1.35 6000=0.5za48khz 11025=5512 moze bi samo towa48khz *1,088435374149
{//do j=1,5512 // !Put another 0.5 sec of silence at end
//i=i+1
t_iwave[i]=0;
i++;
}
nwave=i;
//qDebug()<<"nwave"<<nwave/GEN_SAMPLE_RATE;
char ident;//fiktivno
//QString msgsent;
if (sendingsh == 1)
{
bool flg = false;//1.69 sh skip blinks
for (int i1 = 25; i1 >= 0; --i1)
{
if (message[i1]!=' ')
flg = true;
if (flg)
s_unpack_msg.prepend(message[i1]);
}
//s_unpack_msg = message;// sh ne se codira za towa e taka na jt65
}
else
s_unpack_msg = TPackUnpackMsg.unpackmsg(dgen,ident,false);//last is rpt_db_msk false," ",
if (flip<0.0)
{
for (i = 21; i >= 0; i--)
{//do i=22,1,-1
if (s_unpack_msg.at(i)!=' ') goto c10;
}
c10:
s_unpack_msg.append(" OOO");//' OOO'//msgsent=msgsent(1:i)//' OOO'
}
//qDebug()<<"s_unpack_msg"<<s_unpack_msg;
/*for (i = 21; i >= 0; i--)
{//do i=22,1,-1
if(msgsent(i:i).ne.' ') goto c20;
}
c20;
int nmsg=i;*/
return nwave;
}

View File

@ -0,0 +1,46 @@
#ifndef GEN65_H
#define GEN65_H
//#include <QString>
//#include <QStringList>
//#include <math.h> /* fmod */
#include "../HvPackUnpackMsg/pack_unpack_msg.h"
class Gen65 //: public QObject
{
//Q_OBJECT // hv
public:
Gen65();
~Gen65();
int gen65(char *cmsg,int mode65,int nfast,double samfac,double gensamplerate,short *t_iwave);//double ntxdf,double koef_srate,
QString GetUnpackMsg(){return s_unpack_msg;};
double pr[126];
int mdat[126];
int mdat2[126];
void setup65();
void interleave63(int *d1,int idir);
void graycode(int *ia,int n,int idir,int *ib);
void graycode65(int *dat,int n,int idir);
QString unpackmsg(int *dat,char &ident);
void rs_encode(int *dgen, int *sent);// for deep search 65
void packmsg(char *cmsg,int *dgen,int &itype);// for deep search 65
private:
//int count_1s;
int sendingsh;
QString s_unpack_msg;
PackUnpackMsg TPackUnpackMsg;
int mref_[2][126];
int mref2_[2][126];
void *rs;
bool first;
//void rs_encode(int *dgen, int *sent);
void move(int *x,int *y, int n);
int igray(int n0, int idir);
void chkmsg(QString &message,QString &cok,int &nspecial,double &flip);
double twopi;
};
#endif

View File

@ -0,0 +1,387 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV FT4 Generator
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2019
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "gen_ft4.h"
//#include <QtGui>
static bool inicialize_pulse_ft4_trx = false;
static double pulse_ft4_tx[7000]; // !576*4*3=6912
GenFt4::GenFt4(bool f_dec_gen)//f_dec_gen = dec=true gen=false
{
TPackUnpackMsg77.initPackUnpack77(f_dec_gen);//f_dec_gen = dec=true gen=false
genPomFt.initGenPomFt();//first_ft4_enc_174_91 = true;
twopi=8.0*atan(1.0);
if (inicialize_pulse_ft4_trx) return;
/*int nsps=4*512;//=2048 48000hz
//! Compute the frequency-smoothing pulse
for (int i= 0; i < 3*nsps; ++i)//6144
{//do i=1,3*nsps
double tt=(i-1.5*nsps)/(double)nsps;
pulse_ft4_tx[i]=gfsk_pulse(1.0,tt);
}*/
//nsps=4*576;//=2304 48000hz
//nsps*1.5=3456.0
gen_pulse_gfsk_(pulse_ft4_tx,3456.0,1.0,2304);
inicialize_pulse_ft4_trx = true;
}
GenFt4::~GenFt4()
{}
/*
void GenFt4::save_hash_call_from_dec(QString c13,int n10,int n12,int n22)
{
TPackUnpackMsg77.save_hash_call(c13,n10,n12,n22);
}
void GenFt4::save_hash_call_my_their_r1_r2(QString call,int pos)
{
TPackUnpackMsg77.save_hash_call_my_their_r1_r2(call,pos);
}
*/
void GenFt4::save_hash_call_mam(QStringList ls)
{
TPackUnpackMsg77.save_hash_call_mam(ls);
}
QString GenFt4::unpack77(bool *c77,bool &unpk77_success)
{
return TPackUnpackMsg77.unpack77(c77,unpk77_success);
}
void GenFt4::pack77(QString msgs,int &i3,int n3,bool *c77)// for apset v2
{
TPackUnpackMsg77.pack77(msgs,i3,n3,c77);
}
void GenFt4::encode174_91(bool *message77,bool *codeword)
{
genPomFt.encode174_91(message77,codeword);
}
void GenFt4::make_c77_i4tone(bool *c77,int *i4tone)//,bool f_gen,bool f_addc
{
const int icos4a[4]={0,1,3,2};
const int icos4b[4]={1,0,2,3};
const int icos4c[4]={2,3,1,0};
const int icos4d[4]={3,2,0,1};
const bool rvec[77]={0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,1,0,0,1,1,0,1,1,0,
1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,1,1,1,0,0,1,0,1,
0,1,0,1,0,1,1,0,1,1,1,1,1,0,0,0,1,0,1};
int itmp[92];//(ND=87)
bool codeword[180];//3*58+5 linux subtract error
//bool *codeword = new bool[180];//3*58+5 full=174
bool cc77[180]; // w10 32bit error
//bool *cc77 = new bool[100]; // w10 32bit error
for (int i= 0; i < 176; ++i)
{
if (i<77)
cc77[i]=c77[i];
else
cc77[i] = 0;
codeword[i] = 0;
}
for (int i= 0; i < 77; ++i)
cc77[i]=fmod(cc77[i]+rvec[i],2); //msgbits=mod(msgbits+rvec,2)
genPomFt.encode174_91(cc77,codeword);
for (int i= 0; i < 87; ++i)//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
{ // do i=1,ND=87
int is=codeword[2*i+1]+2*codeword[2*i];//is=codeword(2*i=2,4)+2*codeword(2*i-1)=1,3
/*if (is<=1) itmp[i]=is;
if (is==2) itmp[i]=3;
if (is==3) itmp[i]=2;*/
if (is==1) itmp[i]=1;
else if (is==2) itmp[i]=3;
else if (is==3) itmp[i]=2;
else itmp[i]=0;
}
for (int i= 0; i < 4; ++i) //i4tone(1:4)=icos4a
i4tone[i] = icos4a[i];
for (int i= 0; i < 29; ++i)
i4tone[i+4]=itmp[i]; //i4tone(5:33)=itmp(1:29)
for (int i= 0; i < 4; ++i)
i4tone[i+33]=icos4b[i]; //i4tone(34:37)=icos4b
for (int i= 0; i < 29; ++i)
i4tone[i+37]=itmp[i+29]; //i4tone(38:66)=itmp(30:58)
for (int i= 0; i < 4; ++i)
i4tone[i+66]=icos4c[i]; //i4tone(67:70)=icos4c
for (int i= 0; i < 29; ++i)
i4tone[i+70]=itmp[i+58]; //i4tone(71:99)=itmp(59:87)
for (int i= 0; i < 4; ++i)
i4tone[i+99]=icos4d[i]; //i4tone(100:103)=icos4d
//delete cc77;
//delete codeword;
}
/*void GenFt4::genft4rx(char *message_in,int cmsg,int *i4tone,int i3bit)
{
bool *c77 = new bool[120]; //bawi -> bool c77[120];// fictive
QString msg_short = format_msg(message_in,cmsg);
int n3 = 0;
for (int z =0; z<100; ++z)
c77[z]=0;
TPackUnpackMsg77.pack77(msg_short,i3bit,n3,c77);// call pack77(msg,i3,n3,c77)
make_c77_i4tone(c77,i4tone);//,false,false
delete c77;
}*/
int GenFt4::genft4(QString str_mam,short *t_iwave,double GEN_SAMPLE_RATE,double f_tx)//int i3bit
{
int nwave = 0;
int k1 =0;
int i3bit = 0;
int n3 = 0;
int i4tone[120];
bool c77[140];//2.68 130 to 140
//bool *c77 = new bool[130];
double *wave = new double[242200];//241920
double *dphi = new double[242200];//241920 //real dphi(0:240000-1)
s_unpack_msg = "";//reset
//QString str_mam = format_msg(message_in,cmsg);
//str_mam = "CQ LZ2HV KN23#SP9HWY LZ2HV KN23#R5WM LZ2HV R+06";
QStringList SlMsgs;
if (str_mam.contains("#"))
{
SlMsgs = str_mam.split("#");
}
else
SlMsgs << str_mam;
int nslots = SlMsgs.count();
int nsym=103;
int nsps=4*576;//=2304
nwave=(nsym+2)*nsps;//241920
for (int islot = 0; islot < nslots; ++islot)
{
///////////Multi Answer protocol fox /////////////
QString msg_short = SlMsgs.at(islot); //qDebug()<<msg_short;
for (int z =0; z<100; ++z) c77[z]=0;
TPackUnpackMsg77.pack77(msg_short,i3bit,n3,c77);// call pack77(msg,i3,n3,c77)
bool unpk77_success;
QString tms = TPackUnpackMsg77.unpack77(c77,unpk77_success);
s_unpack_msg.append(tms);
if (islot < nslots - 1)
s_unpack_msg.append("#");
make_c77_i4tone(c77,i4tone);
double f0=f_tx + (100.0*(double)islot);//100.0 Hz slots diff
if (f0<100.0)
f0=100.0;// min 100hz
if (f0>5000.0)
f0=5000.0;// max 5000.0
//////////////////////// GFSK MODULATOR ////////////////////////////////////////////
double hmod=1.0;
double dphi_peak=twopi*hmod/(double)nsps;
double dt=1.0/GEN_SAMPLE_RATE;
//! Compute the smoothed frequency waveform.
//! Length = (nsym+2)*nsps samples, zero-padded (nsym+2)*nsps TX=215040 RX=53760
for (int i= 0; i < 242000; ++i)//max tx=241920
dphi[i]=0.0;
for (int j= 0; j < nsym; ++j)
{
int ib=j*nsps;
for (int i= 0; i < 3*nsps; ++i)//6912
dphi[i+ib] += dphi_peak*pulse_ft4_tx[i]*(double)i4tone[j];
}
//qDebug()<<"dphi="<<(nsym-1)*nsps+3*nsps-1;
double ofs = twopi*f0*dt;
double phi=0.0;
k1=0;
for (int j= 0; j < nwave; ++j)//tx=241920
{
if (islot==0)//linux problem
wave[k1]=0.0;
wave[k1]+=sin(phi);//t_iwave[k1]=(short)(32600.0*sin(phi));
phi=fmod(phi+dphi[j]+ofs,twopi);
k1++;
}
}
//qDebug()<<"0 k1="<<nwave<<s_unpack_msg;
for (int i = 0; i < nsps; ++i)
wave[i]*=(1.0-cos(twopi*(double)i/(2.0*nsps)))/2.0;
int k2=(nsym+1)*nsps+1; //=2047 before stop
for (int i = 0; i < nsps; ++i)
wave[i+k2]*=(1.0+cos(twopi*(double)i/(2.0*nsps)))/2.0;//i+k1-nsps
//qDebug()<<"nsamp="<<k2+nsps-1<<k1;
if (nslots<1) nslots=1;// no div by zero
for (int z = 0; z < k1; ++z)
t_iwave[z]=(short)(32600.0*(wave[z]/(double)nslots));
delete [] wave;
delete [] dphi;
//delete c77;
//////////////////////// END GFSK MODULATOR ////////////////////////////////////////////
for (int z = 0; z < 144000 ; ++z) //+3s duration=5.04s duration=4.48s
{
t_iwave[k1] = 0;
k1++;
}
//nwave = k1;//k;//k;//omly one msg 100050;*/
return k1;
}
/*
int GenFt4::genft41(char *message_in,int cmsg,int *i4tone,bool f_generate,
short *t_iwave,double GEN_SAMPLE_RATE,double f_tx,int i3bit)
{
int nwave = 0;
//int KK=87+5; //hv ??? //!Information bits (75 + CRC12 + 12)
//const int ND=58+5; //hv ??? //!Data symbols
bool codeword[180];//3*58+5
int k1 =0;
//double *d_iwave = new double[1440000];
s_unpack_msg = "";//reset
//int isync = 2;//2.00 2 or 1 //2.00
bool c77[120];//2.00 77
int n3 = 0; //2.00 ?
int icos4a[4]={0,1,3,2};
int icos4b[4]={1,0,2,3};
int icos4c[4]={2,3,1,0};
int icos4d[4]={3,2,0,1};
int itmp[87+5];//(ND=87)
bool rvec[77]={0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,1,0,0,1,1,0,1,1,0,
1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,1,1,1,0,0,1,0,1,
0,1,0,1,0,1,1,0,1,1,1,1,1,0,0,0,1,0,1};
//skip ' ' in begining
int c1 = 0;
for (c1 = 0; c1 < 50; ++c1)
{
if (message_in[c1]!=' ')
break;
}
int c2 = 0;
for (int ii = c1; ii < cmsg; ++ii)
{
message_in[c2]=message_in[ii];
c2++;
}
//end skip ' ' in begining
QString msg_short;
int end;
for (end = cmsg-1; end >= 0; --end)
{
if (message_in[end]!=' ')
break;
}
for (int z = 0; z < end+1; ++z)
msg_short.append(message_in[z]);
for (int z =0; z<100; ++z)
c77[z]=0;
TPackUnpackMsg77.pack77(msg_short,i3bit,n3,c77);// call pack77(msg,i3,n3,c77)
if (f_generate)
{
bool unpk77_success;
s_unpack_msg = TPackUnpackMsg77.unpack77(c77,unpk77_success);
}
for (int i= 0; i < 77; ++i)
c77[i]=fmod(c77[i]+rvec[i],2); //msgbits=mod(msgbits+rvec,2)
encode174_91(c77,codeword);
for (int i= 0; i < 87; ++i)//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
{ // do i=1,ND=87
int is=codeword[2*i+1]+2*codeword[2*i];//is=codeword(2*i=2,4)+2*codeword(2*i-1)=1,3
if (is<=1) itmp[i]=is;
if (is==2) itmp[i]=3;
if (is==3) itmp[i]=2;
}
for (int i= 0; i < 4; ++i) //i4tone(1:4)=icos4a
i4tone[i] = icos4a[i];
for (int i= 0; i < 29; ++i)
i4tone[i+4]=itmp[i]; //i4tone(5:33)=itmp(1:29)
for (int i= 0; i < 4; ++i)
i4tone[i+33]=icos4b[i]; //i4tone(34:37)=icos4b
for (int i= 0; i < 29; ++i)
i4tone[i+37]=itmp[i+29]; //i4tone(38:66)=itmp(30:58)
for (int i= 0; i < 4; ++i)
i4tone[i+66]=icos4c[i]; //i4tone(67:70)=icos4c
for (int i= 0; i < 29; ++i)
i4tone[i+70]=itmp[i+58]; //i4tone(71:99)=itmp(59:87)
for (int i= 0; i < 4; ++i)
i4tone[i+99]=icos4d[i]; //i4tone(100:103)=icos4d
if (!f_generate)
return 0;
if (f_tx<100.0)
f_tx=100.0;// min 100hz
if (f_tx>5000.0)
f_tx=5000.0;// max 5000.0
//////////////////////// GFSK MODULATOR ////////////////////////////////////////////
double *wave = new double[242200];//241920
double *dphi = new double[242200];//241920 //real dphi(0:240000-1)
int nsym=103;
int nsps=4*576;//
nwave=(nsym+2)*nsps;//241920
double hmod=1.0;
double dphi_peak=twopi*hmod/(double)nsps;
double dt=1.0/GEN_SAMPLE_RATE;
//! Compute the smoothed frequency waveform.
//! Length = (nsym+2)*nsps samples, zero-padded (nsym+2)*nsps TX=215040 RX=53760
for (int i= 0; i < 242000; ++i)//max tx=241920
dphi[i]=0.0;
for (int j= 0; j < nsym; ++j)
{
int ib=j*nsps;
for (int i= 0; i < 3*nsps; ++i)//6912
dphi[i+ib] += dphi_peak*pulse_ft4_tx[i]*(double)i4tone[j];
}
double ofs = twopi*f_tx*dt;
double phi=0.0;
k1=0;
for (int j= 0; j < nwave; ++j)//tx=241920
{
wave[k1]=sin(phi);//t_iwave[k1]=(short)(32600.0*sin(phi));
phi=fmod(phi+dphi[j]+ofs,twopi);
k1++;
}
//qDebug()<<"0 k1="<<nwave;
for (int i = 0; i < nsps; ++i)
wave[i]*=(1.0-cos(twopi*(double)i/(2.0*nsps)))/2.0;
int k2=(nsym+1)*nsps+1; //=2047 before stop
for (int i = 0; i < nsps; ++i)
wave[i+k2]*=(1.0+cos(twopi*(double)i/(2.0*nsps)))/2.0;//i+k1-nsps
for (int i = 0; i < k1; ++i)
t_iwave[i]=(short)(32600.0*wave[i]);
delete wave;
delete dphi;
//////////////////////// END GFSK MODULATOR ////////////////////////////////////////////
for (int z = 0; z < 144000 ; ++z) //+3s duration=5.04s duration=4.48s
{
t_iwave[k1] = 0;
k1++;
}
//nwave = k1;//k;//k;//omly one msg 100050;
return k1;
}
*/

View File

@ -0,0 +1,50 @@
#ifndef GEN_FT4_H
#define GEN_FT4_H
//#include <QObject>
#include <QString>
//#include <QApplication>
//#include <QCoreApplication>
//#include <stdio.h> /* printf */
//#include <math.h> /* fmod */
// JTMSK144 ///////////////////////
//#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
#include "../HvPackUnpackMsg/pack_unpack_msg77.h"
#include "../genpom.h"
//#include <QStringList>
/*
#include <complex.h> // gnu++11 c++11
#define complex _Complex
#include "../../../Hv_Lib_fftw/fftw3.h"
*/
//#include <complex.h> // gnu++11 c++11
//#define complex _Complex
class GenFt4
{
//Q_OBJECT // hv
public:
explicit GenFt4(bool fl);//f_dec_gen = dec=true gen=false
~GenFt4();
int genft4(QString,short *t_iwave,double samp_rate,double f0);//,int i3b ,int &ntxslot
void make_c77_i4tone(bool *c77,int *i4tone);//,bool f_gen,bool f_addc
QString GetUnpackMsg(){return s_unpack_msg;};
/*void save_hash_call_from_dec(QString c13,int n10,int n12,int n22);
void save_hash_call_my_their_r1_r2(QString call,int pos);*/
void save_hash_call_mam(QStringList ls);
QString unpack77(bool *c77,bool &unpk77_success);
void pack77(QString msgs,int &i3,int n3,bool *c77);
void encode174_91(bool *message,bool *codeword);
private:
GenPomFt genPomFt;
PackUnpackMsg77 TPackUnpackMsg77;
QString s_unpack_msg;
double twopi;
//QString format_msg(char *message_in, int cmsg);
};
#endif

View File

@ -0,0 +1,371 @@
#ifndef BPDECODE_FT8_174_91_H
#define BPDECODE_FT8_174_91_H
////////////// FT8 /////////////////////////////
//integer, parameter:: N=174, K=91, M=N-K = 83
//character*22 g(87)
//integer colorder(N) !parity generator matrix for (174,91) code
//int K=87
static const QString g_ft8_174_91[83] =
{
"8329ce11bf31eaf509f27fc",
"761c264e25c259335493132",
"dc265902fb277c6410a1bdc",
"1b3f417858cd2dd33ec7f62",
"09fda4fee04195fd034783a",
"077cccc11b8873ed5c3d48a",
"29b62afe3ca036f4fe1a9da",
"6054faf5f35d96d3b0c8c3e",
"e20798e4310eed27884ae90",
"775c9c08e80e26ddae56318",
"b0b811028c2bf997213487c",
"18a0c9231fc60adf5c5ea32",
"76471e8302a0721e01b12b8",
"ffbccb80ca8341fafb47b2e",
"66a72a158f9325a2bf67170",
"c4243689fe85b1c51363a18",
"0dff739414d1a1b34b1c270",
"15b48830636c8b99894972e",
"29a89c0d3de81d665489b0e",
"4f126f37fa51cbe61bd6b94",
"99c47239d0d97d3c84e0940",
"1919b75119765621bb4f1e8",
"09db12d731faee0b86df6b8",
"488fc33df43fbdeea4eafb4",
"827423ee40b675f756eb5fe",
"abe197c484cb74757144a9a",
"2b500e4bc0ec5a6d2bdbdd0",
"c474aa53d70218761669360",
"8eba1a13db3390bd6718cec",
"753844673a27782cc42012e",
"06ff83a145c37035a5c1268",
"3b37417858cc2dd33ec3f62",
"9a4a5a28ee17ca9c324842c",
"bc29f465309c977e89610a4",
"2663ae6ddf8b5ce2bb29488",
"46f231efe457034c1814418",
"3fb2ce85abe9b0c72e06fbe",
"de87481f282c153971a0a2e",
"fcd7ccf23c69fa99bba1412",
"f0261447e9490ca8e474cec",
"4410115818196f95cdd7012",
"088fc31df4bfbde2a4eafb4",
"b8fef1b6307729fb0a078c0",
"5afea7acccb77bbc9d99a90",
"49a7016ac653f65ecdc9076",
"1944d085be4e7da8d6cc7d0",
"251f62adc4032f0ee714002",
"56471f8702a0721e00b12b8",
"2b8e4923f2dd51e2d537fa0",
"6b550a40a66f4755de95c26",
"a18ad28d4e27fe92a4f6c84",
"10c2e586388cb82a3d80758",
"ef34a41817ee02133db2eb0",
"7e9c0c54325a9c15836e000",
"3693e572d1fde4cdf079e86",
"bfb2cec5abe1b0c72e07fbe",
"7ee18230c583cccc57d4b08",
"a066cb2fedafc9f52664126",
"bb23725abc47cc5f4cc4cd2",
"ded9dba3bee40c59b5609b4",
"d9a7016ac653e6decdc9036",
"9ad46aed5f707f280ab5fc4",
"e5921c77822587316d7d3c2",
"4f14da8242a8b86dca73352",
"8b8b507ad467d4441df770e",
"22831c9cf1169467ad04b68",
"213b838fe2ae54c38ee7180",
"5d926b6dd71f085181a4e12",
"66ab79d4b29ee6e69509e56",
"958148682d748a38dd68baa",
"b8ce020cf069c32a723ab14",
"f4331d6d461607e95752746",
"6da23ba424b9596133cf9c8",
"a636bcbc7b30c5fbeae67fe",
"5cb0d86a07df654a9089a20",
"f11f106848780fc9ecdd80a",
"1fbb5364fb8d2c9d730d5ba",
"fcb86bc70a50c9d02a5d034",
"a534433029eac15f322e34c",
"c989d9c7c3d3b8c55d75130",
"7bb38b2f0186d46643ae962",
"2644ebadeb44b9467d1f42c",
"608cc857594bfbb55d69600"
};
#if defined MN_NM_NRW_FT_174_91
static const int Mn_ft8_174_91_[174][3] =
{
{16, 45, 73},
{25, 51, 62},
{33, 58, 78},
{1, 44, 45},
{2, 7, 61},
{3, 6, 54},
{4, 35, 48},
{5, 13, 21},
{8, 56, 79},
{9, 64, 69},
{10, 19, 66},
{11, 36, 60},
{12, 37, 58},
{14, 32, 43},
{15, 63, 80},
{17, 28, 77},
{18, 74, 83},
{22, 53, 81},
{23, 30, 34},
{24, 31, 40},
{26, 41, 76},
{27, 57, 70},
{29, 49, 65},
{3, 38, 78},
{5, 39, 82},
{46, 50, 73},
{51, 52, 74},
{55, 71, 72},
{44, 67, 72},
{43, 68, 78},
{1, 32, 59},
{2, 6, 71},
{4, 16, 54},
{7, 65, 67},
{8, 30, 42},
{9, 22, 31},
{10, 18, 76},
{11, 23, 82},
{12, 28, 61},
{13, 52, 79},
{14, 50, 51},
{15, 81, 83},
{17, 29, 60},
{19, 33, 64},
{20, 26, 73},
{21, 34, 40},
{24, 27, 77},
{25, 55, 58},
{35, 53, 66},
{36, 48, 68},
{37, 46, 75},
{38, 45, 47},
{39, 57, 69},
{41, 56, 62},
{20, 49, 53},
{46, 52, 63},
{45, 70, 75},
{27, 35, 80},
{1, 15, 30},
{2, 68, 80},
{3, 36, 51},
{4, 28, 51},
{5, 31, 56},
{6, 20, 37},
{7, 40, 82},
{8, 60, 69},
{9, 10, 49},
{11, 44, 57},
{12, 39, 59},
{13, 24, 55},
{14, 21, 65},
{16, 71, 78},
{17, 30, 76},
{18, 25, 80},
{19, 61, 83},
{22, 38, 77},
{23, 41, 50},
{7, 26, 58},
{29, 32, 81},
{33, 40, 73},
{18, 34, 48},
{13, 42, 64},
{5, 26, 43},
{47, 69, 72},
{54, 55, 70},
{45, 62, 68},
{10, 63, 67},
{14, 66, 72},
{22, 60, 74},
{35, 39, 79},
{1, 46, 64},
{1, 24, 66},
{2, 5, 70},
{3, 31, 65},
{4, 49, 58},
{1, 4, 5},
{6, 60, 67},
{7, 32, 75},
{8, 48, 82},
{9, 35, 41},
{10, 39, 62},
{11, 14, 61},
{12, 71, 74},
{13, 23, 78},
{11, 35, 55},
{15, 16, 79},
{7, 9, 16},
{17, 54, 63},
{18, 50, 57},
{19, 30, 47},
{20, 64, 80},
{21, 28, 69},
{22, 25, 43},
{13, 22, 37},
{2, 47, 51},
{23, 54, 74},
{26, 34, 72},
{27, 36, 37},
{21, 36, 63},
{29, 40, 44},
{19, 26, 57},
{3, 46, 82},
{14, 15, 58},
{33, 52, 53},
{30, 43, 52},
{6, 9, 52},
{27, 33, 65},
{25, 69, 73},
{38, 55, 83},
{20, 39, 77},
{18, 29, 56},
{32, 48, 71},
{42, 51, 59},
{28, 44, 79},
{34, 60, 62},
{31, 45, 61},
{46, 68, 77},
{6, 24, 76},
{8, 10, 78},
{40, 41, 70},
{17, 50, 53},
{42, 66, 68},
{4, 22, 72},
{36, 64, 81},
{13, 29, 47},
{2, 8, 81},
{56, 67, 73},
{5, 38, 50},
{12, 38, 64},
{59, 72, 80},
{3, 26, 79},
{45, 76, 81},
{1, 65, 74},
{7, 18, 77},
{11, 56, 59},
{14, 39, 54},
{16, 37, 66},
{10, 28, 55},
{15, 60, 70},
{17, 25, 82},
{20, 30, 31},
{12, 67, 68},
{23, 75, 80},
{27, 32, 62},
{24, 69, 75},
{19, 21, 71},
{34, 53, 61},
{35, 46, 47},
{33, 59, 76},
{40, 43, 83},
{41, 42, 63},
{49, 75, 83},
{20, 44, 48},
{42, 49, 57}
};
static const int Nm_ft8_174_91_[83][7] =
{
{4, 31, 59, 91, 92, 96, 153},
{5, 32, 60, 93, 115, 146, 0},
{6, 24, 61, 94, 122, 151, 0},
{7, 33, 62, 95, 96, 143, 0},
{8, 25, 63, 83, 93, 96, 148},
{6, 32, 64, 97, 126, 138, 0},
{5, 34, 65, 78, 98, 107, 154},
{9, 35, 66, 99, 139, 146, 0},
{10, 36, 67, 100, 107, 126, 0},
{11, 37, 67, 87, 101, 139, 158},
{12, 38, 68, 102, 105, 155, 0},
{13, 39, 69, 103, 149, 162, 0},
{8, 40, 70, 82, 104, 114, 145},
{14, 41, 71, 88, 102, 123, 156},
{15, 42, 59, 106, 123, 159, 0},
{1, 33, 72, 106, 107, 157, 0},
{16, 43, 73, 108, 141, 160, 0},
{17, 37, 74, 81, 109, 131, 154},
{11, 44, 75, 110, 121, 166, 0},
{45, 55, 64, 111, 130, 161, 173},
{8, 46, 71, 112, 119, 166, 0},
{18, 36, 76, 89, 113, 114, 143},
{19, 38, 77, 104, 116, 163, 0},
{20, 47, 70, 92, 138, 165, 0},
{2, 48, 74, 113, 128, 160, 0},
{21, 45, 78, 83, 117, 121, 151},
{22, 47, 58, 118, 127, 164, 0},
{16, 39, 62, 112, 134, 158, 0},
{23, 43, 79, 120, 131, 145, 0},
{19, 35, 59, 73, 110, 125, 161},
{20, 36, 63, 94, 136, 161, 0},
{14, 31, 79, 98, 132, 164, 0},
{3, 44, 80, 124, 127, 169, 0},
{19, 46, 81, 117, 135, 167, 0},
{7, 49, 58, 90, 100, 105, 168},
{12, 50, 61, 118, 119, 144, 0},
{13, 51, 64, 114, 118, 157, 0},
{24, 52, 76, 129, 148, 149, 0},
{25, 53, 69, 90, 101, 130, 156},
{20, 46, 65, 80, 120, 140, 170},
{21, 54, 77, 100, 140, 171, 0},
{35, 82, 133, 142, 171, 174, 0},
{14, 30, 83, 113, 125, 170, 0},
{4, 29, 68, 120, 134, 173, 0},
{1, 4, 52, 57, 86, 136, 152},
{26, 51, 56, 91, 122, 137, 168},
{52, 84, 110, 115, 145, 168, 0},
{7, 50, 81, 99, 132, 173, 0},
{23, 55, 67, 95, 172, 174, 0},
{26, 41, 77, 109, 141, 148, 0},
{2, 27, 41, 61, 62, 115, 133},
{27, 40, 56, 124, 125, 126, 0},
{18, 49, 55, 124, 141, 167, 0},
{6, 33, 85, 108, 116, 156, 0},
{28, 48, 70, 85, 105, 129, 158},
{9, 54, 63, 131, 147, 155, 0},
{22, 53, 68, 109, 121, 174, 0},
{3, 13, 48, 78, 95, 123, 0},
{31, 69, 133, 150, 155, 169, 0},
{12, 43, 66, 89, 97, 135, 159},
{5, 39, 75, 102, 136, 167, 0},
{2, 54, 86, 101, 135, 164, 0},
{15, 56, 87, 108, 119, 171, 0},
{10, 44, 82, 91, 111, 144, 149},
{23, 34, 71, 94, 127, 153, 0},
{11, 49, 88, 92, 142, 157, 0},
{29, 34, 87, 97, 147, 162, 0},
{30, 50, 60, 86, 137, 142, 162},
{10, 53, 66, 84, 112, 128, 165},
{22, 57, 85, 93, 140, 159, 0},
{28, 32, 72, 103, 132, 166, 0},
{28, 29, 84, 88, 117, 143, 150},
{1, 26, 45, 80, 128, 147, 0},
{17, 27, 89, 103, 116, 153, 0},
{51, 57, 98, 163, 165, 172, 0},
{21, 37, 73, 138, 152, 169, 0},
{16, 47, 76, 130, 137, 154, 0},
{3, 24, 30, 72, 104, 139, 0},
{9, 40, 90, 106, 134, 151, 0},
{15, 58, 60, 74, 111, 150, 163},
{18, 42, 79, 144, 146, 152, 0},
{25, 38, 65, 99, 122, 160, 0},
{17, 42, 75, 129, 170, 172, 0}
};
static const int nrw_ft8_174_91[83] =
{
7,6,6,6,7,6,7,6,6,7,6,6,7,7,6,6,
6,7,6,7,6,7,6,6,6,7,6,6,6,7,6,6,
6,6,7,6,6,6,7,7,6,6,6,6,7,7,6,6,
6,6,7,6,6,6,7,6,6,6,6,7,6,6,6,7,
6,6,6,7,7,6,6,7,6,6,6,6,6,6,6,7,
6,6,6
};
#endif
#endif

View File

@ -0,0 +1,307 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV FT8 Generator
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2017
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "gen_ft8.h"
//#include <QtGui>
static bool inicialize_pulse_ft8_trx = false;
static double pulse_ft8_tx[23060]; // !1920*4*3=23040
GenFt8::GenFt8(bool f_dec_gen)//f_dec_gen = dec=true gen=false
{
TPackUnpackMsg77.initPackUnpack77(f_dec_gen);//f_dec_gen = dec=true gen=false
genPomFt.initGenPomFt();//first_ft8_enc_174_91 = true;
twopi=8.0*atan(1.0);
if (inicialize_pulse_ft8_trx) return;
/*int nsps=4*1920;//48000hz=7680
//! Compute the frequency-smoothing pulse
for (int i= 0; i < 3*nsps; ++i)//=23040
{//do i=1,3*nsps
double tt=(i-1.5*nsps)/(double)nsps;
pulse_ft8_tx[i]=gfsk_pulse(2.0,tt);//tx=2.0
}*/
gen_pulse_gfsk_(pulse_ft8_tx,11520.0,2.0,7680);
inicialize_pulse_ft8_trx = true;
}
GenFt8::~GenFt8()
{}
void GenFt8::save_hash_call_from_dec(QString c13,int n10,int n12,int n22)
{
TPackUnpackMsg77.save_hash_call(c13,n10,n12,n22);
}
void GenFt8::save_hash_call_my_their_r1_r2(QString call,int pos)
{
TPackUnpackMsg77.save_hash_call_my_their_r1_r2(call,pos);
}
/*
void GenFt8::save_hash_call_mam(QStringList ls)
{
TPackUnpackMsg77.save_hash_call_mam(ls);
}
*/
QString GenFt8::unpack77(bool *c77,bool &unpk77_success)
{
return TPackUnpackMsg77.unpack77(c77,unpk77_success);
}
void GenFt8::pack77(QString msgs,int &i3,int n3,bool *c77)// for apset v2
{
TPackUnpackMsg77.pack77(msgs,i3,n3,c77);
}
void GenFt8::split77(QString &msg,int &nwords,/*int *nw,*/QString *w)// for apset v2
{
TPackUnpackMsg77.split77(msg,nwords,/*int *nw,*/w);
}
/*
short crc10_(unsigned char const * data, int length)
{
return boost::augmented_crc<10, TRUNCATED_POLYNOMIAL10>(data, length);
}
short crc12_(unsigned char const * data, int length)
{
return boost::augmented_crc<12, TRUNCATED_POLYNOMIAL12>(data, length);
}
bool crc12_check_(unsigned char const * data, int length)
{
return !boost::augmented_crc<12, TRUNCATED_POLYNOMIAL12>(data, length);
}
short GenFt8::crc10(unsigned char const * data, int length)
{
return crc10_(data,length);
}
short GenFt8::crc12(unsigned char const * data, int length)
{
return crc12_(data,length);
}
*/
void GenFt8::make_c77_i4tone_codeword(bool *c77,int *i4tone,bool *codeword)//,bool f_gen,bool f_addc
{
const int icos7_77 [7]={3,1,4,0,6,5,2};
const int graymap77[8]={0,1,3,2,5,6,4,7};
//bool codeword[180];//3*58+5 linux subtract error
//bool *codeword = new bool[180];//3*58+5 full=174
bool cc77[180]; // w10 32bit error
//bool *cc77 = new bool[180]; // w10 32bit error
for (int i= 0; i < 176; ++i)
{
if (i<77) cc77[i]=c77[i];
else cc77[i] = 0;
codeword[i] = 0;
}
genPomFt.encode174_91(cc77,codeword);
for (int i= 0; i < 100; ++i) i4tone[i] = 0;
//! Message structure: S7 D29 S7 D29 S7
for (int i= 0; i < 7; ++i)
i4tone[i]=icos7_77[i]; //i4tone[79]; realno
for (int i= 0; i < 7; ++i)
i4tone[(35+1)+i]=icos7_77[i]; //i4tone(36+1:36+7)=icos7
for (int i= 0; i < 7; ++i)
i4tone[(79-7)+i]=icos7_77[i]; //itone(NN-6:NN)=icos7 NN=79
int k=7-1;
for (int j= 0; j < 58; ++j)
{
int i=3*j;
int idx = codeword[i]*4 + codeword[i+1]*2 + codeword[i+2];
int idxx = 0;
if (idx==1) idxx=1;
else if (idx==2) idxx=2;
else if (idx==3) idxx=3;
else if (idx==4) idxx=4;
else if (idx==5) idxx=5;
else if (idx==6) idxx=6;
else if (idx==7) idxx=7;
else idxx=0;
k++;
if (j==29) k=k+7;
i4tone[k]=graymap77[idxx];
}
}
void GenFt8::make_c77_i4tone(bool *c77,int *i4tone)//,bool f_gen,bool f_addc
{
const int icos7_77 [7]={3,1,4,0,6,5,2};
const int graymap77[8]={0,1,3,2,5,6,4,7};
bool codeword[180];//3*58+5 linux subtract error
//bool *codeword = new bool[180];//3*58+5 full=174
bool cc77[180]; // w10 32bit error
//bool *cc77 = new bool[180]; // w10 32bit error
for (int i= 0; i < 176; ++i)
{
if (i<77) cc77[i]=c77[i];
else cc77[i] = 0;
codeword[i] = 0;
}
genPomFt.encode174_91(cc77,codeword);
for (int i= 0; i < 100; ++i) i4tone[i] = 0;
//! Message structure: S7 D29 S7 D29 S7
for (int i= 0; i < 7; ++i)
i4tone[i]=icos7_77[i]; //i4tone[79]; realno
for (int i= 0; i < 7; ++i)
i4tone[(35+1)+i]=icos7_77[i]; //i4tone(36+1:36+7)=icos7
for (int i= 0; i < 7; ++i)
i4tone[(79-7)+i]=icos7_77[i]; //itone(NN-6:NN)=icos7 NN=79
int k=7-1;
for (int j= 0; j < 58; ++j)
{
int i=3*j;
int idx = codeword[i]*4 + codeword[i+1]*2 + codeword[i+2];
int idxx = 0;
if (idx==1) idxx=1;
else if (idx==2) idxx=2;
else if (idx==3) idxx=3;
else if (idx==4) idxx=4;
else if (idx==5) idxx=5;
else if (idx==6) idxx=6;
else if (idx==7) idxx=7;
else idxx=0;
k++;
if (j==29) k=k+7;
i4tone[k]=graymap77[idxx];
}
//delete cc77;
//delete codeword;
}
/*void GenFt8::genft8rx(char *message_in,int cmsg,int *i4tone,int i3bit)
{
bool c77[120];// fictive
//bool *c77 = new bool[120];
QString msg_short = format_msg(message_in,cmsg);
make_c77_i4tone(msg_short,c77,i4tone,i3bit);//,false,false
//delete c77;
}*/
int GenFt8::genft8(QString str_mam,short *t_iwave,double samp_rate,double f_tx)//,int i3bit
{
int nwave = 0;
int k1 =0;
int i3bit = 0;
int n3 = 0;
int i4tone[120];
bool c77[140];//2.68 130 to 140
//bool *c77 = new bool[130];
double *d_iwave = new double[864000];//15s= 720000 18s= 864000 alltx=614400
double *dphi = new double[622180];//need tobe here hv real dphi=79*7680=606720 + 7680*2=622080
s_unpack_msg = "";//reset
//QString str_mam = format_msg(message_in,cmsg);
QStringList SlMsgs;
if (str_mam.contains("#"))
{
SlMsgs = str_mam.split("#");
}
else
SlMsgs << str_mam;
int nslots = SlMsgs.count();
int nsym=79;
int nsps=4*1920;// for tx=48000->4*1920=7680 ; for rx=12000->1920
nwave=nsym*nsps;//=606720
for (int islot = 0; islot < nslots; ++islot)
{
///////////Multi Answer protocol fox /////////////
QString msg_short = SlMsgs.at(islot);
//make_c77_i4tone(msg_short,c77,i4tone,i3bit);//,true,f_addc
//int n3 = 0;
for (int z =0; z<100; ++z) c77[z]=0;
TPackUnpackMsg77.pack77(msg_short,i3bit,n3,c77);// call pack77(msg,i3,n3,c77)
/*QString sss; // CQ type test to 29
for (int ii = 0; ii < 29; ++ii) sss.append(QString("%1").arg((int)c77[ii]));
qDebug()<<sss;*/
// no problem to be here 2.20 becouse -> encode174_91 add +14bit affter 76bit
bool unpk77_success;
QString tms = TPackUnpackMsg77.unpack77(c77,unpk77_success);
s_unpack_msg.append(tms);
if (islot < nslots - 1)
s_unpack_msg.append("#");
make_c77_i4tone(c77,i4tone);
double f0=f_tx + (60.0*(double)islot);//60.0 Hz slots diff, move freq up down f0=nfreq + fstep*(n-1)
if (f0<100.0)
f0=100.0;// min 100hz
if (f0>5000.0)
f0=5000.0;// max 5000.0
//////////////////////// GFSK MODULATOR ////////////////////////////////////////////
double hmod=1.0;
double dt=1.0/samp_rate;
double dphi_peak=twopi*hmod/(double)nsps;
for (int i= 0; i < 622100; ++i)//max tx=622080
dphi[i]=0.0;
for (int j= 0; j < nsym; ++j)//nsym=79 nsps=7680
{
int ib=j*nsps;
for (int i= 0; i < 3*nsps; ++i)//23040
dphi[i+ib] += dphi_peak*pulse_ft8_tx[i]*(double)i4tone[j];
}
//! Add dummy symbols at beginning and end with tone values equal to 1st and last symbol, respectively
//dphi(0:2*nsps-1)=dphi(0:2*nsps-1)+dphi_peak*itone(1)*pulse(nsps+1:3*nsps)
//dphi(nsym*nsps:(nsym+2)*nsps-1)=dphi(nsym*nsps:(nsym+2)*nsps-1)+dphi_peak*itone(nsym)*pulse(1:2*nsps)
int bgn =nsym*nsps;
for (int i= 0; i < 2*nsps; ++i)//15360
{
dphi[i]+=dphi_peak*i4tone[0]*pulse_ft8_tx[i+nsps];
dphi[i+bgn]+=dphi_peak*i4tone[nsym-1]*pulse_ft8_tx[i];
}
//qDebug()<<"dphi="<<bgn+2*nsps-1;
double ofs = twopi*f0*dt;
double phi=0.0;
k1=0;
for (int j= nsps; j < nsps+nwave; ++j)//nsps=7680 nwave=606720 alltx=614400
{
if (islot==0)//linux problem
d_iwave[k1]=0.0;
d_iwave[k1]+=sin(phi);//t_iwave[k1]=(short)(32600.0*sin(phi));
phi=fmod(phi+dphi[j]+ofs,twopi);
k1++;
}
//qDebug()<<"2dphi="<<nsps+nsps+nwave;
}
int nramp=(int)((double)nsps/8.0);
for (int i = 0; i < nramp; ++i)
d_iwave[i]*=(1.0-cos(twopi*(double)i/(2.0*nramp)))/2.0;
int k2=nsym*nsps-nramp+1; //k1=nsym*nsps-nramp+1 k2=(nsym+1)*nsps+1; int k2=k1-nramp;
for (int i = 0; i < nramp; ++i)
d_iwave[i+k2]*=(1.0+cos(twopi*(double)i/(2.0*nramp)))/2.0;//i+k1-nsps
//qDebug()<<"nsamp="<<k2+nramp-1<<k1;
if (nslots<1) nslots=1;// no div by zero
for (int z = 0; z < k1; ++z)
t_iwave[z]=(short)(32600.0*(d_iwave[z]/(double)nslots));//32767.0 realy is 128 do not make distortions
delete [] d_iwave;
delete [] dphi;
//delete c77;
for (int z = 0; z < 192000 ; ++z) //+4s duration=12.64s
{
t_iwave[k1] = 0;
k1++;
}
//delete d_iwave;//inportent to delete here or in the up return
//nwave = k1;//k;//k;//omly one msg 100050;
return k1;
}

View File

@ -0,0 +1,49 @@
#ifndef GEN_FT8_H
#define GEN_FT8_H
//#include <QObject>
#include <QString>
//#include <QApplication>
//#include <QCoreApplication>
//#include <stdio.h> /* printf */
//#include <math.h> /* fmod */
// JTMSK144 ///////////////////////
//#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
#include "../HvPackUnpackMsg/pack_unpack_msg77.h"
#include "../genpom.h"
//#include <QStringList>
//#include <complex.h> // gnu++11 c++11
//#define complex _Complex
class GenFt8 //: public QObject
{
//Q_OBJECT // hv
public:
explicit GenFt8(bool fl);//f_dec_gen = dec=true gen=false
~GenFt8();
int genft8(QString,short *t_iwave,double samp_rate,double f0);//,int i3b ,int &ntxslot
void make_c77_i4tone(bool *c77,int *i4tone);
void make_c77_i4tone_codeword(bool *c77,int *i4tone,bool*);
QString GetUnpackMsg(){return s_unpack_msg;};
void save_hash_call_from_dec(QString c13,int n10,int n12,int n22);
void save_hash_call_my_their_r1_r2(QString call,int pos);
//void save_hash_call_mam(QStringList ls);
QString unpack77(bool *c77,bool &unpk77_success);
void pack77(QString msgs,int &i3,int n3,bool *c77);
void split77(QString &msg,int &nwords,/*int *nw,*/QString *w);
private:
GenPomFt genPomFt;
PackUnpackMsg77 TPackUnpackMsg77;
QString s_unpack_msg;
double twopi;
//QString format_msg(char *message_in, int cmsg);
//void make_c77_i4tone(bool *c77,int *i4tone);//,bool f_gen,bool f_addc
};
#endif

View File

@ -0,0 +1,295 @@
#ifndef BPDECODE_MSK_H
#define BPDECODE_MSK_H
////////////// MSK144 /////////////////////////////
// N=128
static const char colorder_msk144[128] =
{
0,1,2,3,4,5,6,7,8,9,
10,11,12,13,14,15,24,26,29,30,
32,43,44,47,60,77,79,97,101,111,
96,38,64,53,93,34,59,94,74,90,
108,123,85,57,70,25,69,62,48,49,
50,51,52,33,54,55,56,21,58,36,
16,61,23,63,20,65,66,67,68,46,
22,71,72,73,31,75,76,45,78,17,
80,81,82,83,84,42,86,87,88,89,
39,91,92,35,37,95,19,27,98,99,
100,28,102,103,104,105,106,107,40,109,
110,18,112,113,114,115,116,117,118,119,
120,121,122,41,124,125,126,127
};
//integer Mn(3,N) ! 3 checks per bit 128x3
static const int Mn_msk144_[128][3] =
{
{1,14,38},
{2,4,41},
{3,19,39},
{5,29,34},
{6,35,40},
{7,20,45},
{8,28,48},
{9,22,25},
{10,24,36},
{11,12,37},
{13,43,44},
{15,18,46},
{16,17,47},
{21,32,33},
{23,30,31},
{26,27,42},
{1,12,46},
{2,36,38},
{3,5,10},
{4,9,23},
{6,13,39},
{7,15,17},
{8,18,27},
{11,33,40},
{14,28,44},
{16,29,31},
{19,20,22},
{21,30,42},
{24,26,47},
{25,37,48},
{32,34,45},
{8,35,41},
{12,31,43},
{1,19,21},
{2,43,45},
{3,4,11},
{5,18,33},
{6,25,47},
{7,28,30},
{9,14,34},
{10,35,42},
{13,15,22},
{16,37,38},
{17,41,44},
{20,24,29},
{18,23,39},
{12,26,32},
{27,38,40},
{15,36,48},
{2,30,46},
{1,4,13},
{3,28,32},
{5,43,47},
{6,34,46},
{7,9,40},
{8,11,45},
{10,17,23},
{14,31,35},
{16,22,42},
{19,37,44},
{20,33,48},
{21,24,41},
{25,27,29},
{26,39,48},
{19,31,36},
{1,5,7},
{2,29,39},
{3,16,46},
{4,26,37},
{6,28,45},
{8,22,33},
{9,21,43},
{10,25,38},
{11,14,24},
{12,17,40},
{13,27,30},
{15,32,35},
{18,44,47},
{20,23,36},
{34,41,42},
{1,32,48},
{2,3,33},
{4,29,42},
{5,14,37},
{6,7,36},
{8,9,39},
{10,13,19},
{11,18,30},
{12,16,20},
{15,29,44},
{17,34,38},
{6,21,22},
{23,32,40},
{24,27,46},
{25,41,45},
{7,26,43},
{28,31,47},
{20,35,38},
{1,33,41},
{2,42,44},
{3,23,48},
{4,31,45},
{5,8,30},
{9,16,36},
{10,40,47},
{11,17,46},
{12,21,34},
{13,24,28},
{14,18,43},
{15,25,26},
{19,27,35},
{22,37,39},
{1,16,18},
{2,6,20},
{3,30,43},
{4,28,33},
{5,22,23},
{7,39,42},
{8,12,38},
{9,35,46},
{10,27,32},
{11,15,34},
{13,36,37},
{14,41,47},
{17,21,25},
{19,29,45},
{24,31,48},
{26,40,44}
};
//integer Nm(8,M) ! 8 bits per check M=48 48x8
static const int Nm_msk144_[48][8] =
{
{1,17,34,51,66,81,99,113},
{2,18,35,50,67,82,100,114},
{3,19,36,52,68,82,101,115},
{2,20,36,51,69,83,102,116},
{4,19,37,53,66,84,103,117},
{5,21,38,54,70,85,92,114},
{6,22,39,55,66,85,96,118},
{7,23,32,56,71,86,103,119},
{8,20,40,55,72,86,104,120},
{9,19,41,57,73,87,105,121},
{10,24,36,56,74,88,106,122},
{10,17,33,47,75,89,107,119},
{11,21,42,51,76,87,108,123},
{1,25,40,58,74,84,109,124},
{12,22,42,49,77,90,110,122},
{13,26,43,59,68,89,104,113},
{13,22,44,57,75,91,106,125},
{12,23,37,46,78,88,109,113},
{3,27,34,60,65,87,111,126},
{6,27,45,61,79,89,98,114},
{14,28,34,62,72,92,107,125},
{8,27,42,59,71,92,112,117},
{15,20,46,57,79,93,101,117},
{9,29,45,62,74,94,108,127},
{8,30,38,63,73,95,110,125},
{16,29,47,64,69,96,110,128},
{16,23,48,63,76,94,111,121},
{7,25,39,52,70,97,108,116},
{4,26,45,63,67,83,90,126},
{15,28,39,50,76,88,103,115},
{15,26,33,58,65,97,102,127},
{14,31,47,52,77,81,93,121},
{14,24,37,61,71,82,99,116},
{4,31,40,54,80,91,107,122},
{5,32,41,58,77,98,111,120},
{9,18,49,65,79,85,104,123},
{10,30,43,60,69,84,112,123},
{1,18,43,48,73,91,98,119},
{3,21,46,64,67,86,112,118},
{5,24,48,55,75,93,105,128},
{2,32,44,62,80,95,99,124},
{16,28,41,59,80,83,100,118},
{11,33,35,53,72,96,109,115},
{11,25,44,60,78,90,100,128},
{6,31,35,56,70,95,102,126},
{12,17,50,54,68,94,106,120},
{13,29,38,53,78,97,105,124},
{7,30,49,61,64,81,101,127}
};
////////////// MSK144 /////////////////////////////
////////////// MSK40 /////////////////////////////
// N=32
static const char colorder_msk40[32] =
{
4,1,2,3,0,8,6,10,13,28,20,23,17,15,27,25,
16,12,18,19,7,21,22,11,24,5,26,14,9,29,30,31
};
//integer Mn(3,N) ! 3 checks per bit 32x3
static const int Mn_msk40_[32][3] =
{
{1,6,13},
{2,3,14},
{4,8,15},
{5,11,12},
{7,10,16},
{6,9,15},
{1,11,16},
{2,4,5},
{3,7,9},
{8,10,12},
{8,13,14},
{1,4,12},
{2,6,10},
{3,11,15},
{5,9,14},
{7,13,15},
{12,14,16},
{1,2,8},
{3,5,6},
{4,9,11},
{1,7,14},
{5,10,13},
{3,4,16},
{2,15,16},
{6,7,12},
{7,8,11},
{1,9,10},
{2,11,13},
{3,12,13},
{4,6,14},
{1,5,15},
{8,9,16}
};
/*
static const int Nm_[M][7] =
{
{1,7,12,18,21,27,31},
{2,8,13,18,24,28,0},
{2,9,14,19,23,29,0},
{3,8,12,20,23,30,0},
{4,8,15,19,22,31,0},
{1,6,13,19,25,30,0},
{5,9,16,21,25,26,0},
{3,10,11,18,26,32,0},
{6,9,15,20,27,32,0},
{5,10,13,22,27,0,0},
{4,7,14,20,26,28,0},
{4,10,12,17,25,29,0},
{1,11,16,22,28,29,0},
{2,11,15,17,21,30,0},
{3,6,14,16,24,31,0},
{5,7,17,23,24,32,0}
};
*/
// 16x7
static const int Nm_msk40_[16][7] =
{
{1,7,12,18,21,27,31},
{2,8,13,18,24,28,1},
{2,9,14,19,23,29,1},
{3,8,12,20,23,30,1},
{4,8,15,19,22,31,1},
{1,6,13,19,25,30,1},
{5,9,16,21,25,26,1},
{3,10,11,18,26,32,1},
{6,9,15,20,27,32,1},
{5,10,13,22,27,1,1},
{4,7,14,20,26,28,1},
{4,10,12,17,25,29,1},
{1,11,16,22,28,29,1},
{2,11,15,17,21,30,1},
{3,6,14,16,24,31,1},
{5,7,17,23,24,32,1}
};
////////////// MSK40 /////////////////////////////
#endif

View File

@ -0,0 +1,186 @@
#ifndef BPDECODE_MSK_128_90_H
#define BPDECODE_MSK_128_90_H
////////////// MSK144 v2 /////////////////////////////
// N=128, K=90, M=N-K=38
static const int Mn_msk144_128_90_[128][3] =
{
{21, 34, 36},
{1, 8, 28},
{2, 9, 37},
{3, 7, 19},
{4, 16, 32},
{2, 5, 22},
{6, 13, 25},
{10, 31, 33},
{11, 24, 27},
{12, 15, 23},
{14, 18, 26},
{17, 20, 29},
{17, 30, 34},
{6, 34, 35},
{1, 10, 30},
{3, 18, 23},
{4, 12, 25},
{5, 28, 36},
{7, 14, 21},
{8, 15, 31},
{9, 27, 32},
{11, 19, 35},
{13, 16, 37},
{20, 24, 38},
{21, 22, 26},
{12, 29, 33},
{1, 17, 35},
{2, 28, 30},
{3, 10, 32},
{4, 8, 36},
{5, 19, 29},
{6, 20, 27},
{7, 22, 37},
{9, 11, 33},
{13, 24, 26},
{14, 31, 34},
{15, 16, 25},
{13, 18, 38},
{8, 20, 23},
{1, 32, 33},
{2, 17, 19},
{3, 24, 34},
{4, 7, 38},
{5, 11, 31},
{6, 18, 21},
{9, 15, 36},
{10, 16, 28},
{12, 26, 30},
{14, 27, 29},
{22, 25, 35},
{23, 30, 32},
{4, 11, 37},
{1, 14, 23},
{2, 8, 25},
{3, 13, 27},
{5, 10, 37},
{6, 16, 31},
{7, 15, 18},
{9, 22, 24},
{12, 19, 36},
{17, 26, 38},
{20, 21, 33},
{20, 28, 35},
{4, 29, 34},
{1, 26, 36},
{2, 23, 34},
{3, 9, 38},
{5, 6, 17},
{7, 27, 35},
{8, 14, 32},
{10, 15, 22},
{11, 18, 29},
{12, 13, 28},
{16, 19, 33},
{21, 25, 31},
{24, 30, 37},
{1, 3, 21},
{2, 18, 31},
{4, 6, 9},
{5, 8, 33},
{7, 29, 32},
{10, 13, 19},
{11, 22, 23},
{12, 27, 34},
{14, 15, 30},
{16, 27, 38},
{17, 28, 37},
{20, 25, 26},
{5, 24, 35},
{3, 6, 36},
{1, 12, 31},
{2, 4, 33},
{3, 16, 30},
{1, 2, 24},
{5, 23, 27},
{6, 28, 32},
{7, 17, 36},
{8, 22, 38},
{9, 18, 20},
{10, 21, 29},
{11, 13, 34},
{4, 14, 20},
{11, 30, 38},
{14, 35, 37},
{15, 19, 26},
{3, 28, 29},
{7, 8, 9},
{5, 18, 34},
{13, 15, 17},
{12, 16, 35},
{10, 23, 25},
{19, 21, 37},
{17, 27, 31},
{24, 25, 36},
{1, 18, 19},
{6, 26, 33},
{22, 31, 32},
{3, 20, 22},
{4, 21, 27},
{2, 13, 29},
{6, 7, 12},
{15, 24, 32},
{9, 25, 30},
{23, 37, 38},
{5, 16, 26},
{11, 14, 28},
{33, 36, 38},
{8, 10, 35}
};
static const int Nm_msk144_128_90_[38][11] =
{
{ 2, 15, 27, 40, 53, 65, 77, 91, 94, 115, 0},
{3, 6, 28, 41, 54, 66, 78, 92, 94, 120, 0},
{4, 16, 29, 42, 55, 67, 77, 90, 93, 106, 118},
{5, 17, 30, 43, 52, 64, 79, 92, 102, 119, 0},
{6, 18, 31, 44, 56, 68, 80, 89, 95, 108, 125},
{7, 14, 32, 45, 57, 68, 79, 90, 96, 116, 121},
{4, 19, 33, 43, 58, 69, 81, 97, 107, 121, 0},
{2, 20, 30, 39, 54, 70, 80, 98, 107, 128, 0},
{3, 21, 34, 46, 59, 67, 79, 99, 107, 123, 0},
{8, 15, 29, 47, 56, 71, 82, 100, 111, 128, 0},
{9, 22, 34, 44, 52, 72, 83, 101, 103, 126, 0},
{10, 17, 26, 48, 60, 73, 84, 91, 110, 121, 0},
{7, 23, 35, 38, 55, 73, 82, 101, 109, 120, 0},
{11, 19, 36, 49, 53, 70, 85, 102, 104, 126, 0},
{10, 20, 37, 46, 58, 71, 85, 105, 109, 122, 0},
{5, 23, 37, 47, 57, 74, 86, 93, 110, 125, 0},
{12, 13, 27, 41, 61, 68, 87, 97, 109, 113, 0},
{11, 16, 38, 45, 58, 72, 78, 99, 108, 115, 0},
{4, 22, 31, 41, 60, 74, 82, 105, 112, 115, 0},
{12, 24, 32, 39, 62, 63, 88, 99, 102, 118, 0},
{1, 19, 25, 45, 62, 75, 77, 100, 112, 119, 0},
{6, 25, 33, 50, 59, 71, 83, 98, 117, 118, 0},
{10, 16, 39, 51, 53, 66, 83, 95, 111, 124, 0},
{9, 24, 35, 42, 59, 76, 89, 94, 114, 122, 0},
{7, 17, 37, 50, 54, 75, 88, 111, 114, 123, 0},
{11, 25, 35, 48, 61, 65, 88, 105, 116, 125, 0},
{9, 21, 32, 49, 55, 69, 84, 86, 95, 113, 119},
{2, 18, 28, 47, 63, 73, 87, 96, 106, 126, 0},
{12, 26, 31, 49, 64, 72, 81, 100, 106, 120, 0},
{13, 15, 28, 48, 51, 76, 85, 93, 103, 123, 0},
{8, 20, 36, 44, 57, 75, 78, 91, 113, 117, 0},
{5, 21, 29, 40, 51, 70, 81, 96, 117, 122, 0},
{8, 26, 34, 40, 62, 74, 80, 92, 116, 127, 0},
{1, 13, 14, 36, 42, 64, 66, 84, 101, 108, 0},
{14, 22, 27, 50, 63, 69, 89, 104, 110, 128, 0},
{1, 18, 30, 46, 60, 65, 90, 97, 114, 127, 0},
{3, 23, 33, 52, 56, 76, 87, 104, 112, 124, 0},
{24, 38, 43, 61, 67, 86, 98, 103, 124, 127, 0}
};
static const int nrw_msk144_128_90[38] =
{
10,10,11,10,11,11,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,11,10,10,10,10,10,10,10,10,10,
10,10
};
////////////// MSK144 /////////////////////////////
#endif

View File

@ -0,0 +1,12 @@
#ifndef __CONFIG_RPT_MSK40_H__
#define __CONFIG_RPT_MSK40_H__
static const char s8ms[8] = {0,1,0,0,1,1,1,0}; //ok 4 78 invers msk40 14s
static const char s8[8] = {0,1,1,1,0,0,1,0};
static const char s8r[8] = {1,0,1,1,0,0,0,1};
static const QString rpt_msk40[16] = {"-03 ","+00 ","+03 ","+06 ","+10 ","+13 ","+16 ",
"R-03","R+00","R+03","R+06","R+10","R+13","R+16",
"RRR ","73 "};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
#ifndef GENMESAGE_MSK_H
#define GENMESAGE_MSK_H
#include <QObject>
#include <QString>
//#include <QApplication>
//#include <QCoreApplication>
//#include <stdio.h> /* printf */
#include <math.h> /* fmod */
// JTMSK144 ///////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../HvPackUnpackMsg/pack_unpack_msg.h"
#include "../HvPackUnpackMsg/pack_unpack_msg77.h"
// JTMSK144 ///////////////////////
class GenMsk //: public QObject
{
//Q_OBJECT // hv
public:
GenMsk(bool f);//f_dec_gen = dec=true gen=false
~GenMsk();
int genmsk(char *msg0,double samfac,int *i4tone,bool f_generate,short *t_iwave,double samp_rate,
double k_srate,int ichk,int mode,bool rpt_db_msk);//QString mygridloc,
// vremenno
QString unpackmsg144(int *dat,char &ident,QString &c1,QString &c2,bool rpt_db_msk);
//QString unpackmsg(int *dat,char &ident);
QString GetUnpackMsg(){return s_unpack_msg;};
// JTMSK144 ///////////////////////
int hash_msk40(QString s);
//void ldpc_decode( double lratio[], char decoded[], int max_iterations, int &niterations, int max_dither, int &ndither);
void bpdecode144(double *llr,int maxiterations,char *decoded,int &niterations);
void bpdecode40(double *llr,int maxiterations,char *decoded,int &niterations);
void encode_msk40(char *message,char *codeword);
void save_hash_call_my_their_r1_r2(QString call,int pos);
QString unpack77(bool *c77,bool &unpk77_success);
void chkcrc13a(bool *decoded,int &nbadcrc);
void bpdecode128_90(double *llr,int max_iterations,bool *decoded77,int &nharderror);//,bool *cw ,bool *apmask, int &niterations
//QString Get_c1_msk40_hash(){return TPackUnpackMsg77.c1_msk40_hash;};
//QString Get_c2_msk40_hash(){return TPackUnpackMsg77.c2_msk40_hash;};
void Get_C1_C2_RX_Calls(QString &c1,QString &c2);
private:
int hash(QString s, int len, int ihash);
// MSK40 ///////////////////////
//char gen40_[16][16];//integer*1 gen144(48,80)
char gen40_[20][20];
bool first_msk40_enc;
//void encode_msk40(char *message,char *codeword);
QString genmsk40(QString msg,int ichk,int *itone,int &itype);
//bool first_msk40;
//int ig24_msk32[4096];
// MSK32 ///////////////////////
// MSK144 ///////////////////////
void platanh(double x,double &y);
//void ldpc_write_qpc_temp_file(char *qrc_f, char *file_t);
double pp[12];
void genmsk144(int *i4, unsigned char *i8, int *itone,bool *c77,bool msk144ms);
bool first_msk144;
void copy_char_ar(char*a,int a_beg,int a_end,char*b,int b_beg,int b_odd);
void copy_double_ar(double*a,int a_beg,int a_end,double*b,int b_beg);
//char gen144_[80][48];//integer*1 gen144(48,80)
char gen144_[82][50];
bool first_msk144_enc;
void encode_msk144(char *msg, char *cdw);// makms
short crc13(unsigned char const * data, int length);
bool gen144_v2_[95][43];//integer*1 gen(M,K) N=128, K=90, M=N-K=38
bool first_msk144_enc_v2;
void encode_128_90(bool *message77,bool* codeword);// msk144
QString RemWSpacesInside(QString s);// fmtmsg(QString msg,int iz);
// MSK144 ///////////////////////
QString s_unpack_msg;
PackUnpackMsg TPackUnpackMsg;
PackUnpackMsg77 TPackUnpackMsg77;
double twopi;
//QString addpfx;
};
#endif

View File

@ -0,0 +1,220 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV Q65 Generator
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2021
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "gen_q65.h"
//#include <QtGui>
GenQ65::GenQ65(bool f_dec_gen)//f_dec_gen = dec=true gen=false
{
TPackUnpackMsg77.initPackUnpack77(f_dec_gen);//f_dec_gen = dec=true gen=false
//twopi=8.0*atan(1.0);
}
GenQ65::~GenQ65()
{}
QString GenQ65::unpack77(bool *c77,bool &unpk77_success)
{
return TPackUnpackMsg77.unpack77(c77,unpk77_success);
}
void GenQ65::pack77(QString msgs,int &i3,int n3,bool *c77)// for apset v2
{
TPackUnpackMsg77.pack77(msgs,i3,n3,c77);
}
/*QString GenQ65::format_msg(char *message_in, int cmsg)
{
QString out;
//skip ' ' in begining
int c1 = 0;
for (c1 = 0; c1 < 20; ++c1)
{
if (message_in[c1]!=' ')
break;
}
int c2 = 0;
for (int ii = c1; ii < cmsg; ++ii)
{
message_in[c2]=message_in[ii];
c2++;
}
//end skip ' ' in begining
int end;
for (end = cmsg-1; end >= 0; --end)
{
if (message_in[end]!=' ')
break;
}
for (int z = 0; z < end+1; ++z)
out.append(message_in[z]);
return out;
QString out = "";
int beg,end;
for (beg = 0; beg < cmsg; ++beg)
{
if (message_in[beg]!=' ') break;
}
for (end = cmsg-1; end >= 0; --end)
{
if (message_in[end]!=' ') break;
}
for (int z = beg; z < end+1; ++z) out.append(message_in[z]);
return out;
}*/
int GenQ65::BinToInt32(bool*a,int b_a,int bits_sz)
{
int k = 0;
for (int i = b_a; i < bits_sz; ++i)
{
k <<= 1;
k |= a[i];
}
return k;
}
void GenQ65::genq65itone(QString msg0,int *itone,bool unpck)
{
int i3 = 0;
int n3 = 0;
bool c77[130];
int dgen[13+10];//13
int sent[63+10];//63
static const bool m73[15] =
{
1,1,1,1,1,1,0,1,0,0,1,0,0,1,1
}
;//=32403 ?
static const int isync[86] =
{
1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85
}
;//22
for (int i = 0; i < 100; ++i)
c77[i]=false;
TPackUnpackMsg77.pack77(msg0,i3,n3,c77);
int ng15 = BinToInt32(c77,59,74);
if (ng15 == 32373) //!Message is RR73 ??
{
for (int i = 0; i < 15; ++i) c77[59+i] = m73[i];
}
bool unpk77_success;
if (unpck) s_unpack_msg = TPackUnpackMsg77.unpack77(c77,unpk77_success);
int z = 0;
for (int i = 0; i < 12; ++i)
{
dgen[i] = BinToInt32(c77,z,z+6);
z += 6;
}
dgen[12] = BinToInt32(c77,72,77);
dgen[12]=2*dgen[12];//dgen(13)=2*dgen(13) !Convert 77-bit to 78-bit payload
//if(ichk.eq.1) go to 999 !Return if checking only ??
q65S.q65_enc(dgen,sent); //!Encode message, dgen(1:13) ==> sent(1:63)
z = 0;
int x = 0;
for (int i = 0; i < 85; ++i)
{//do i=1,85
if (i==isync[z]-1/* && z<22*/)
{
itone[i]=0; //!Insert sync symbol at tone 0
z++; //!Index for next sync symbol
}
else// if (k<63)
{
int pp = 0;
if (unpck) pp = 1;
itone[i]=sent[x] + pp; //!Q65 symbol=0 is transmitted at tone 1, etc.
x++;
}
}
//qDebug()<<x<<z;
/*if (msg0 == "CQ LZ2HV KN23")
{
QString sss;
for (int i = 0; i < 63; ++i)
{
sss.append(QString("%1").arg((int)sent[i]));
}
if (unpck) qDebug()<<"TX"<<msg0<<sss;
else qDebug()<<"RX"<<msg0<<sss;
}
qDebug()<<"22="<<z<<"63="<<x;*/
}
int GenQ65::genq65(QString message_in,short *t_iwave,double GEN_SAMPLE_RATE,double f_tx,
int mq65,int period_t)
{
//qDebug()<<f_tx;
int k1 = 0;
int itone[90];//85 //!QRA64 uses only 84
double twopi=8.0*atan(1.0);
QString msg0 = message_in;//format_msg(message_in,cmsg);
genq65itone(msg0,itone,true);
///////////////// generator wave //////////////////////////////////c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
int nsps=1800;
if (period_t== 30) nsps=3600;
if (period_t== 60) nsps=7200;
if (period_t==120) nsps=16000;
if (period_t==300) nsps=41472;
int nsps4=4*nsps; //48000 Hz sampling
int nsym=85;
//int nwave=(nsym+2)*nsps4;
double baud=GEN_SAMPLE_RATE/(double)nsps4;
double dt=1.0/GEN_SAMPLE_RATE;
double hb = baud*(double)mq65;
//double hb = baud*1.0;
double phi=0.0;
for (int j = 0; j < nsym; ++j)
{//do j=1,nsym
double freq = f_tx + hb*(double)itone[j];
double dphi = twopi*freq*dt;
for (int i = 0; i < nsps4; ++i)
{//do i=1,nsps
t_iwave[k1]=(short)(32600.0*sin(phi)); //t_iwave[k1]=(short)(32600.0*sin(phi));
phi+=dphi;
if (phi>twopi) phi-=twopi;
k1++;
}
}
int to_end = (period_t*GEN_SAMPLE_RATE) - k1; //qDebug()<<"Time="<<(double)to_end/GEN_SAMPLE_RATE;
for (int z = 0; z < to_end; ++z)
{
t_iwave[k1] = 0;
k1++;
}
///////////////// generator /////////////////////////////////////
//qDebug()<<"mmmm="<<s_unpack_msg<<ng15;
/*QString sss;
for (int i = 0; i < 14; ++i)
{
//if (i>58 && i<74) sss.append(",");
sss.append(QString("%1").arg((int)dgen[i]));
}
qDebug()<<sss;
sss.clear();
for (int i = 0; i < 63; ++i)
{
//if (i>58 && i<74) sss.append(",");
sss.append(QString("%1").arg((int)sent[i]));
}
qDebug()<<sss;
QString sss;
sss.clear();
for (int i = 0; i < 85; ++i)
{
//if (i>58 && i<74) sss.append(",");
sss.append(QString("%1").arg((int)itone[i]));
}
qDebug()<<k1<<"Time="<<(double)k1/48000.0;*/
return k1;
}

View File

@ -0,0 +1,41 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV Q65 Generator
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2021
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#ifndef GEN_Q65_H
#define GEN_Q65_H
//#include <QObject>
#include <QString>
#include "../HvPackUnpackMsg/pack_unpack_msg77.h"
#include "q65_subs.h"
class GenQ65
{
//Q_OBJECT // hv
public:
explicit GenQ65(bool fl);//f_dec_gen = dec=true gen=false
~GenQ65();
void genq65itone(QString msg0,int *itone,bool);
int genq65(QString,short *t_iwave,double samp_rate,double f0,int mq65,int period_t);//,int i3b ,int &ntxslot
QString GetUnpackMsg(){return s_unpack_msg;};
QString unpack77(bool *c77,bool &unpk77_success);
void pack77(QString msgs,int &i3,int n3,bool *c77);
private:
QString s_unpack_msg;
PackUnpackMsg77 TPackUnpackMsg77;
q65subs q65S;
int BinToInt32(bool*a,int b_a,int bits_sz);
//QString format_msg(char *message_in, int cmsg);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,156 @@
// (c) 2020 - Nico Palermo, IV3NWV - Microtelecom Srl, Italy
// ------------------------------------------------------------------------------
// This file is part of the qracodes project, a Forward Error Control
// encoding/decoding package based on Q-ary RA (Repeat and Accumulate) LDPC codes.
//
// qracodes 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.
// qracodes 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 qracodes source distribution.
// If not, see <http://www.gnu.org/licenses/>.
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV Q65 Subs
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2021
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#ifndef Q65_SUBS_H
#define Q65_SUBS_H
typedef struct
{
// code parameters
const int K; // number of information symbols
const int N; // codeword length in symbols
const int m; // bits/symbol
const int M; // Symbol alphabet cardinality (2^m)
const int a; // code grouping factor
const int NC; // number of check symbols (N-K)
const int V; // number of variables in the code graph (N)
const int C; // number of factors in the code graph (N +(N-K)+1)
const int NMSG; // number of msgs in the code graph
const int MAXVDEG; // maximum variable degree
const int MAXCDEG; // maximum factor degree
const int type; // see QRATYPE_xx defines
const float R; // code rate (K/N)
const char name[64]; // code name
// tables used by the encoder
const int *acc_input_idx;
const int *acc_input_wlog;
const int *gflog;
const int *gfexp;
// tables used by the decoder -------------------------
const int *msgw;
const int *vdeg;
const int *cdeg;
const int *v2cmidx;
const int *c2vmidx;
const int *gfpmat;
}
qracode;
#define Q65_FASTFADING_MAXWEIGTHS 65
typedef struct
{
const qracode *pQraCode; // qra code to be used by the codec
float decoderEsNoMetric; // value for which we optimize the decoder metric
int *x; // codec input
int *y; // codec output
float *qra_v2cmsg; // decoder v->c messages
float *qra_c2vmsg; // decoder c->v messages
float *ix; // decoder intrinsic information
float *ex; // decoder extrinsic information
// variables used to compute the intrinsics in the fast-fading case
int nBinsPerTone;
int nBinsPerSymbol;
float ffNoiseVar;
float ffEsNoMetric;
int nWeights;
float ffWeight[Q65_FASTFADING_MAXWEIGTHS];
}
q65_codec_ds;
class q65subs
{
public:
void q65_enc(int x[], int y[]);
void q65_intrinsics_ff(float s3[], int submode, float B90Ts, int fadingModel, float s3prob[]);
void q65_dec(float s3[], float s3prob[], int APmask[], int APsymbols[],int maxiters,float &esnodb0,
int xdec[], int &rc0);
void q65_dec_fullaplist(float s3[], float s3prob[], int codewords[],
int ncw, float &esnodb0, int xdec[], float &plog, int &rc0);
private:
int _q65_crc6(int *x, int sz);
void _q65_crc12(int *y, int *x, int sz);
float pd_norm(float *pd, int nlogdim);
int qra_encode(const qracode *pcode, int *y, const int *x);
int q65_encode(const q65_codec_ds *pCodec, int *pOutputCodeword, const int *pInputMsg);
void q65_free(q65_codec_ds *pCodec);
int q65_init(q65_codec_ds *pCodec, const qracode *pQraCode);
int q65_intrinsics_fastfading(q65_codec_ds *pCodec,
float *pIntrinsics, // intrinsic symbol probabilities output
const float *pInputEnergies, // received energies input
const int submode, // submode idx (0=A ... 4=E)
const float B90Ts, // normalized spread bandwidth (90% fractional energy)
const int fadingModel); // 0=Gaussian 1=Lorentzian fade model
int q65_esnodb_fastfading(
const q65_codec_ds *pCodec,
float *pEsNodB,
const int *ydec,
const float *pInputEnergies);
int q65_check_llh(float *llh, const int* ydec, const int nN, const int nM, const float *pIntrin);
int q65_decode(q65_codec_ds *pCodec, int* pDecodedCodeword, int *pDecodedMsg,
const float *pIntrinsics, const int *pAPMask, const int *pAPSymbols,int maxiters);
int q65_decode_fullaplist(q65_codec_ds *codec,
int *ydec,
int *xdec,
const float *pIntrinsics,
const int *pCodewords,
const int nCodewords);
int pd_argmax(float *pmax, float *src, int ndim);
float pd_max(float *src, int ndim);
void pd_bwdperm(float *dst, float *src, const int *perm, int ndim);
void pd_fwdperm(float *dst, float *src, const int *perm, int ndim);
void pd_imul(float *dst, const float *src, int nlogdim);
void np_fwht(int nlogdim, float *dst, float *src);
int qra_extrinsic(const qracode *pcode, float *pex, const float *pix, int maxiter,float *qra_v2cmsg,float *qra_c2vmsg);
void qra_mapdecode(const qracode *pcode, int *xdec, float *pex, const float *pix);
// helper functions
#define q65_get_message_length(pCodec) _q65_get_message_length((pCodec)->pQraCode)
#define q65_get_codeword_length(pCodec) _q65_get_codeword_length((pCodec)->pQraCode)
#define q65_get_code_rate(pCodec) _q65_get_code_rate((pCodec)->pQraCode)
#define q65_get_alphabet_size(pCodec) _q65_get_alphabet_size((pCodec)->pQraCode)
#define q65_get_bits_per_symbol(pCodec) _q65_get_bits_per_symbol((pCodec)->pQraCode)
// internally used but made public for the above defines
int _q65_get_message_length(const qracode *pCode);
int _q65_get_codeword_length(const qracode *pCode);
float _q65_get_code_rate(const qracode *pCode);
void _q65_mask(const qracode *pcode, float *ix, const int *mask, const int *x);
int _q65_get_alphabet_size(const qracode *pCode);
int _q65_get_bits_per_symbol(const qracode *pCode);
};
#endif

View File

@ -0,0 +1,775 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV PackMessage
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2017
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "pack_unpack_msg.h"
#include "../../../pfx_sfx.h"
//#include <QtGui>
void PackUnpackMsg::copy_qstr(QString &to,QString from,int b_from,int e_from)
{
for (int i = 0; i < e_from-b_from; i++)
to[i]=from[i+b_from];
for (int i = e_from-b_from; i < to.count(); i++)
to[i]=' ';
}
int PackUnpackMsg::max_2int(int a,int b)
{
int res = a;
if (b>res)
res=b;
return res;
}
QString PackUnpackMsg::qstr_beg_end(QString s_in,int b,int e)
{
QString str;
str=s_in.mid(b,e-b);
return str;
}
int PackUnpackMsg::index(QString in,char search)
{
int res = -1; // if not search return -1
for (int i = 0; i < in.count(); i++)
{
if (in[i]==search)
{
res = i;
break;
}
}
return res;
}
int PackUnpackMsg::nchar(char c)
{
//! Convert ascii number, letter, or space to 0-36 for callsign packing.
int n=0;
// n=0 //!Silence compiler warning
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (c>='0' && c<='9')
n=(int)c-(int)'0';
else if ((int)c>=(int)'A' && (int)c<=(int)'Z')
n=(int)c-(int)'A' + 10;
else if ((int)c>=(int)'a' && (int)c<=(int)'z')
n=(int)c-(int)'a' + 10;
else if ((int)c>=(int)' ')
n=36;
else
{
//printf ("%s \n", "Invalid character in callsign");
//qDebug()<<"Invalid character in callsign"<<c<<(int)c;
}
//Print*,'Invalid character in callsign ',c,' ',ichar(c)
//stop
//endif
//printf ("%s \n", "Invalid character in callsign");
//qDebug()<<"Invalid character in callsign"<<c<<(int)c;
return n;
}
void PackUnpackMsg::packcall(QString callsign,int &ncall,bool &text)
{
//! Pack a valid callsign into a 28-bit integer.
int NBASE=37*36*10*27*27*27;
//character callsign*6,c*1,tmp*6
QString tmp=" ";//20char
//char c;
text = false;
//qDebug()<<"CQ"<<callsign;
//s.replace(QString("9"), QString("n"));
//! Work-around for Swaziland prefix:
if (qstr_beg_end(callsign,0,4)=="3DA0") callsign.replace("3DA0","3D0");//callsign(5:6)
// ! Work-around for Guinea prefixes:
if (qstr_beg_end(callsign,0,2)=="3X") callsign.replace("3X","Q");
//if(callsign(1:2).eq.'3X') callsign='Q'//callsign(3:6)
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (qstr_beg_end(callsign,0,3)=="CQ ")
{
// qDebug()<<"CQ"<<callsign;
ncall=NBASE + 1;
if (callsign[3]>=(int)'0' && callsign[3]<=(int)'9' && callsign[4]>=(int)'0' && callsign[4]<=(int)'9' &&
callsign[5]>=(int)'0' && callsign[5]<=(int)'9')
{
int nfreq = qstr_beg_end(callsign,3,6).toInt();//read(callsign(4:6),*) nfreq;
ncall=NBASE + 3 + nfreq;
}
return;
}
else if (qstr_beg_end(callsign,0,4)=="QRZ ")
{
ncall=NBASE + 2;
return;
}
else if (qstr_beg_end(callsign,0,3)=="DE ")
{
ncall=267796945;
return;
}
//tmp=" ";
if (callsign[2]>=(int)'0' && callsign[2]<=(int)'9')
copy_qstr(tmp,callsign,0,callsign.count());//tmp=callsign;
else if (callsign[1]>=(int)'0' && callsign[1]<=(int)'9')
{
if (callsign[5]!=' ')
{
text=true;
return;
}
copy_qstr(tmp,callsign,0,5);//qDebug()<<"tmp"<<tmp;//tmp=" "+qstr_beg_end(callsign,0,5);//tmp=' '//callsign(:5)
tmp.prepend(' ');//qDebug()<<"tmp"<<tmp;
}
else
{
text=true;
return;
}
for (int i = 0; i < 6; i++)
{//do i=1,6
char c=tmp[i].toLatin1();
if ((int)c>=(int)'a' && (int)c<=(int)'z') tmp[i]=char((int)c-(int)'a'+(int)'A');
}
int n1=0;
if ((tmp[0]>=(int)'A' && tmp[0]<=(int)'Z') || tmp[0]==' ') n1=1;
if (tmp[0]>=(int)'0' && tmp[0]<=(int)'9') n1=1;
int n2=0;
if (tmp[1]>='A' && tmp[1]<=(int)'Z') n2=1;
if (tmp[1]>=(int)'0' && tmp[1]<=(int)'9') n2=1;
int n3=0;
if (tmp[2]>=(int)'0' && tmp[2]<=(int)'9') n3=1;
int n4=0;
if ((tmp[3]>=(int)'A' && tmp[3]<=(int)'Z') || tmp[3]==' ') n4=1;
int n5=0;
if ((tmp[4]>=(int)'A' && tmp[4]<=(int)'Z') || tmp[4]==' ') n5=1;
int n6=0;
if ((tmp[5]>=(int)'A' && tmp[5]<=(int)'Z') || tmp[5]==' ') n6=1;
if (n1+n2+n3+n4+n5+n6 != 6)
{
text=true;
return;
}
ncall=nchar(tmp[0].toLatin1());
ncall=36*ncall+nchar(tmp[1].toLatin1());
ncall=10*ncall+nchar(tmp[2].toLatin1());
ncall=27*ncall+nchar(tmp[3].toLatin1())-10;
ncall=27*ncall+nchar(tmp[4].toLatin1())-10;
ncall=27*ncall+nchar(tmp[5].toLatin1())-10;
}
void PackUnpackMsg::getpfx1(QString &callsign,int &k,int &nv2)
{
QString callsign0;
QString c;
QString lof;
QString rof;
QString tpfx=" ";//20char
QString tsfx=" ";//20char
bool ispfx=false;
bool issfx=false;
bool invalid = true;
//callsign0=qstr_beg_end(callsign,0,callsign.count());
nv2=1;
int iz=index(callsign,' ') - 1;//iz=index(callsign,' ') - 1
callsign0=qstr_beg_end(callsign,0,iz+1);
if (iz<0) iz=12; //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
int islash=index((qstr_beg_end(callsign,0,iz+1)),'/');//islash=index(callsign(1:iz),'/') may ako ne go nameri vra6ta -1
k=0;
//! if(k.eq.0) go to 10 !Tnx to DL9RDZ for reminder:this was for tests only!
//c=" ";
//qDebug()<<"prefix"<<qstr_beg_end(callsign,0,islash-0)<<islash<<iz-4<<(iz-1);//c=callsign(1:islash-1)
//qDebug()<<"sufix"<<qstr_beg_end(callsign,islash+1,iz+1);
if (islash>-1 && islash<=(iz-4))//if(islash.gt.0 .and. islash.le.(iz-4)) then
{
//! Add-on prefix
c=qstr_beg_end(callsign,0,islash-0);//c=callsign(1:islash-1)
copy_qstr(callsign,callsign,islash+1,iz+1);//callsign=callsign(islash+1:iz)
//qDebug()<<"PFX"<<c<<callsign;
for (int i = 0; i < NZ; i++)
{//do i=1,NZ
if (pfx[i]==c)//pfx(i)(1:4)==c
{
k=i+1;
nv2=2;
goto c10;
}
}
if (addpfx==c)
{
k=449;//448
nv2=2;
goto c10;
}
}
else if (islash==(iz-1))//if(islash.eq.(iz-1)) then
{
//! Add-on suffix
c=qstr_beg_end(callsign,islash+1,iz+1);//c=callsign(islash+1:iz)
copy_qstr(callsign,callsign,0,islash-0);//callsign=callsign(1:islash-1)
//qDebug()<<"SFX"<<c<<callsign;
for (int i = 0; i < NZ2; i++)
{//do i=1,NZ2
if (sfx[i]==c[0])//if(sfx(i).eq.c(1:1)) then
{
k=400+i+1;
nv2=3;
goto c10;
}
}
}
c10:
if (islash!=-1 && k==0) //if(islash.ne.0 .and.k.eq.0)
{
//! Original JT65 would force this compound callsign to be treated as
//! plain text. In JT65v2, we will encode the prefix or suffix into nc1.
//! The task here is to compute the proper value of k.
lof=qstr_beg_end(callsign0,0,islash-0);//lof=callsign0(:islash-1)
rof=qstr_beg_end(callsign0,islash+1,callsign0.count());//rof=callsign0(islash+1:)
//qDebug()<<"LOV ROT="<<lof<<rof;
//llof=len_trim(lof)//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
//lrof=len_trim(rof)
//qDebug()<<"IS PFX SFX="<<ispfx<<issfx;
if (lof.count()>0 && lof.count()<=4) ispfx=true;//ispfx=(llof.gt.0 .and. llof.le.4)
if (rof.count()>0 && rof.count()<=3) issfx=true;////issfx=(lrof.gt.0 .and. lrof.le.3)
//qDebug()<<"IS PFX SFX="<<ispfx<<issfx;
if (!ispfx || !issfx) invalid = false;//invalid=.not.(ispfx.or.issfx)
if (ispfx && issfx) //if(ispfx.and.issfx)
{
if (lof.count()<3) issfx=false;//if(llof.lt.3) issfx=.false.
if (rof.count()<3) ispfx=false;//if(lrof.lt.3) ispfx=.false.
if (ispfx && issfx) //if(ispfx.and.issfx) then
{
int i=(int)callsign0[islash-1].toLatin1();//i=ichar(callsign0(islash-1:islash-1))
if (i>=(int)'0' && i<=(int)'9') //if(i.ge.ichar('0') .and. i.le.ichar('9'))
issfx=false;
else
ispfx=false;
}
}
if (invalid)
k=-1;
else
{
//qDebug()<<"LOV ROT="<<ispfx<<issfx;
if (ispfx)
{
lof.append(" ");
copy_qstr(tpfx,lof,0,4);//tpfx=lof(1:4)
k=nchar(tpfx[0].toLatin1());
k=37*k + nchar(tpfx[1].toLatin1());
k=37*k + nchar(tpfx[2].toLatin1());
k=37*k + nchar(tpfx[3].toLatin1());
nv2=4;
int i=index(callsign0,'/');
copy_qstr(callsign,callsign0,0,i-0);//callsign=callsign0(:i-1);
copy_qstr(callsign,callsign0,i+1,callsign0.count());//callsign=callsign0(i+1:);
//qDebug()<<"TPFX="<<tpfx;
}
if (issfx)
{
rof.append(" ");
copy_qstr(tsfx,rof,0,3);//tsfx=rof(1:3)
k=nchar(tsfx[0].toLatin1());
k=37*k + nchar(tsfx[1].toLatin1());
k=37*k + nchar(tsfx[2].toLatin1());
nv2=5;
int i=index(callsign0,'/');
copy_qstr(callsign,callsign0,0,i-0);//callsign=callsign0(:i-1);
//qDebug()<<"TSFX="<<tsfx;
}
}
}
}
void PackUnpackMsg::packtext(QString msg,int &nc1,int &nc2,int &nc3)
{
/*parameter (MASK28=2**28 - 1)
character*13 msg
character*42 c
data c/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ +-./?'/
cc_JTMSK_TX*/
nc1=0;
nc2=0;
nc3=0;
int j=0;
for (int i = 0; i < 5; i++)
{//do i=1,5 //!First 5 characters in nc1
for (j = 0; j < 42; j++)//max=41=?
{//do j=1,42 //!Get character code
if (msg[i]==C_PACK_UNPACK_JT[j]) goto c10;
}
j=36;//j=37;pouse
c10:
//j=j-1; //!Codes should start at zero
nc1=42*nc1 + j;
//qDebug()<<"ppp="<<cc_JTMSK_TX[41];
}
for (int i = 5; i < 10; i++)
{//do i=6,10
for (j = 0; j < 42; j++) //max=41=? //!Characters 6-10 in nc2
{//do j=1,42 //!Get character code
if (msg[i]==C_PACK_UNPACK_JT[j]) goto c20;
}
j=36;//j=37; pouse
c20:
//j=j-1; //!Codes should start at zero
nc2=42*nc2 + j;
}
for (int i = 10; i < 13; i++)
{//do i=11,13 //!Characters 11-13 in nc3
for (j = 0; j < 42; j++)//max=41=?
{//do j=1,42 //!Get character code
if (msg[i]==C_PACK_UNPACK_JT[j]) goto c30;
}
j=36;//j=37; pouse
c30:
//j=j-1; //!Codes should start at zero
nc3=42*nc3 + j;
}
//! We now have used 17 bits in nc3. Must move one each to nc1 and nc2.
//qDebug()<<nc1;
nc1=nc1+nc1; //qDebug()<<nc1;
if ((nc3 & 32768)!=0) nc1=nc1+1;
nc2=nc2+nc2;
if ((nc3 & 65536)!=0) nc2=nc2+1;
nc3=(nc3 & 32767);
//qDebug()<<nc1<<nc2<<nc3;
}
void PackUnpackMsg::deg2grid(double dlong0,double dlat,QString &grid)
{
double dlong; //!West longitude (deg)
//double dlat //!Latitude (deg)
dlong=dlong0;//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (dlong<-180.0) dlong=dlong+360.0;
if (dlong>180.0) dlong=dlong-360.0;
//! Convert to units of 5 min of longitude, working east from 180 deg.
int nlong=int(60.0*(180.0-dlong)/5.0);
int n1=nlong/240; //!20-degree field
int n2=(nlong-240*n1)/24; //!2 degree square
int n3=nlong-240*n1-24*n2; //!5 minute subsquare
grid[0]=char((int)('A')+n1);
grid[2]=char((int)('0')+n2);
grid[4]=char((int)('a')+n3);
//! Convert to units of 2.5 min of latitude, working north from -90 deg.
int nlat=int(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[1]=char((int)('A')+n1);
grid[3]=char((int)('0')+n2);
grid[5]=char((int)('a')+n3);
}
void PackUnpackMsg::k2grid(int k,QString &grid)
{//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
double nlong=2*fmod((k-1)/5,90)-179;
if (k>450) nlong=nlong+180;
double nlat=fmod(k-1,5)+ 85;
double dlat=nlat;
double dlong=nlong;
deg2grid(dlong,dlat,grid);
}
void PackUnpackMsg::grid2deg(QString grid0,double &dlong,double &dlat)
{
//! Converts Maidenhead grid locator to degrees of West longitude
//! and North latitude.
QString grid;
char g1,g2,g3,g4,g5,g6;
grid=grid0;
int i=(int)grid[4].toLatin1();//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (grid[4]==' ' || i<=64 || i>=128) grid.replace(4,2,"mm"); //qDebug()<<"GRID="<<grid;
/*if ((int)grid[0].toLatin1()>=(int)'a' && grid[0]<=(int)'z') grid[0]=char((int)((int)grid[0].toLatin1())+(int)('A')-(int)('a'));
if ((int)grid[1].toLatin1()>=(int)'a' && grid[1]<=(int)'z') grid[1]=char((int)((int)grid[1].toLatin1())+(int)('A')-(int)('a'));
if ((int)grid[4].toLatin1()>=(int)'A' && grid[4]<=(int)'Z') grid[4]=char((int)((int)grid[4].toLatin1())-(int)('A')+(int)('a'));
if ((int)grid[5].toLatin1()>=(int)'A' && grid[5]<=(int)'Z') grid[5]=char((int)((int)grid[5].toLatin1())-(int)('A')+(int)('a'));*/
if (grid[0]>=(int)'a' && grid[0]<=(int)'z') grid[0]=char((int)grid[0].toLatin1()+(int)'A'-(int)'a');
if (grid[1]>=(int)'a' && grid[1]<=(int)'z') grid[1]=char((int)grid[1].toLatin1()+(int)'A'-(int)'a');
if (grid[4]>=(int)'A' && grid[4]<=(int)'Z') grid[4]=char((int)grid[4].toLatin1()-(int)'A'+(int)'a');
if (grid[5]>=(int)'A' && grid[5]<=(int)'Z') grid[5]=char((int)grid[5].toLatin1()-(int)'A'+(int)'a');
g1=grid[0].toLatin1();
g2=grid[1].toLatin1();
g3=grid[2].toLatin1();
g4=grid[3].toLatin1();
g5=grid[4].toLatin1();
g6=grid[5].toLatin1();
//qDebug()<<"G="<<g1<<g2<<g3<<g4<<g5<<g6;
double nlong = 180 - 20*((int)g1-(int)'A');
double n20d = 2*((int)g3-(int)'0');
double xminlong = 5*((int)g5-(int)'a'+0.5);
dlong = nlong - n20d - xminlong/60.0;
double nlat = -90+10*((int)g2-(int)'A') + (int)g4-(int)'0';
double xminlat = 2.5*((int)g6-(int)'a'+0.5);
dlat = nlat + xminlat/60.0;
}
void PackUnpackMsg::packgrid(QString grid,int &ng,bool &text,bool msk144ms)
{
int NGBASE=180*180;
char c1;
int n=0;
text=false;
double dlong = 0.0;
double dlat = 0.0;
int long1=0;
int lat=0;
//if(grid.isEmpty()) goto c90;//if(grid==' ') goto c90; //!Blank grid is OK
if (qstr_beg_end(grid,0,4)==" ") goto c90;
//! First, handle signal reports in the original range, -01 to -30 dB
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (grid[0]=='-')
{
//if (grid[1]>=(int)'0' && grid[1]<=(int)'9' && grid[2]>=(int)'0' && grid[2]<=(int)'9')
if (!grid[1].isLetter() && !grid[2].isLetter())
n =qstr_beg_end(grid,1,3).toInt();//read(grid(2:3),*,err=800,end=800) n
else
goto c800;
if (n>=1 && n<=30)
{
ng=NGBASE+1+n;
goto c900;
}
goto c10;
}
else if (qstr_beg_end(grid,0,2)=="R-")
{
//grid[2].isDigit()
//if (grid[2]>=(int)'0' && grid[2]<=(int)'9' && grid[3]>=(int)'0' && grid[3]<=(int)'9')
if (!grid[2].isLetter() && !grid[3].isLetter())
n =qstr_beg_end(grid,2,4).toInt();//read(grid(3:4),*,err=800,end=800) n
else
goto c800;
if (n>=1 && n<=30)
{
ng=NGBASE+31+n;
goto c900;
}
goto c10;
}
//! Now check for RO, RRR, or 73 in the message field normally used for grid
else if (qstr_beg_end(grid,0,4)=="RO ")
{
ng=NGBASE+62;
goto c900;
}
else if (qstr_beg_end(grid,0,4)=="RRR ")
{
ng=NGBASE+63;
goto c900;
}
else if (qstr_beg_end(grid,0,4)=="73 ")
{
ng=NGBASE+64;
goto c900;
}
//! Now check for extended-range signal reports: -50 to -31, and 0 to +49.
c10:
n=99;
c1=grid[0].toLatin1();
//qDebug()<<"GRID="<<grid<<grid.toInt();
if (c1=='R' && !grid[1].isLetter() && !grid[2].isLetter() && !grid[3].isLetter())//+ ne naru6awa rezultata
{
n =qstr_beg_end(grid,1,4).toInt();
goto c30;
}
else if (!grid[0].isLetter() && !grid[1].isLetter() && !grid[2].isLetter() && !grid[3].isLetter())
{
n=grid.toInt();
}
/*if (grid[0].isDigit()&&grid[1].isDigit()&&grid[2].isDigit()&&grid[3].isDigit())
n=grid.toInt();//read(grid,*,err=20,end=20) n
else
goto c20;
goto c30;
c20:
if (grid[1].isDigit()&&grid[2].isDigit()&&grid[3].isDigit())
n =qstr_beg_end(grid,1,4).toInt();//read(grid(2:4),*,err=30,end=30) n
else
goto c30;*/
c30:
if (msk144ms)
{
if (n>=-30 && n<=69)//for msk144ms
{
if (c1=='R')
{
grid="LA"+QString("%1").arg(n+30);
//grid="LA"+QString("%1").arg(n+50,2,10,QChar('0'));
}
else
{
grid="KA"+QString("%1").arg(n+30);
//grid="KA"+QString("%1").arg(n+50,2,10,QChar('0'));
}
goto c40;
}
}
else //old variant
{
if (n>=-50 && n<=49)//old variant
{
if (c1=='R')
{
grid="LA"+QString("%1").arg(n+50);
//grid="LA"+QString("%1").arg(n+50,2,10,QChar('0'));
}
else
{
grid="KA"+QString("%1").arg(n+50);
//grid="KA"+QString("%1").arg(n+50,2,10,QChar('0'));
}
goto c40;
}
}
//! Maybe it's free text ?//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (grid[0]<(int)'A' || grid[0]>(int)'R') text=true;
if (grid[1]<(int)'A' || grid[1]>(int)'R') text=true;
if (grid[2]<(int)'0' || grid[2]>(int)'9') text=true;
if (grid[3]<(int)'0' || grid[3]>(int)'9') text=true;
if (text) goto c900;
//! OK, we have a properly formatted grid locator
c40:
grid2deg(QString(grid+"mm"),dlong,dlat); //grid2deg(grid//'mm',dlong,dlat)
long1=int(dlong);
lat=int(dlat+ 90.0);
ng=((long1+180)/2)*180 + lat;
goto c900;
c90:
ng=NGBASE + 1;
goto c900;
c800:
text=true;
c900:
return;
}
void PackUnpackMsg::packmsg(char *msg0,int *dat,int &itype,bool msk144ms)
{
/*! Packs a JT4/JT9/JT65 message into twelve 6-bit symbols
! itype Message Type
!--------------------
! 1 Standardd message
! 2 Type 1 prefix
! 3 Type 1 suffix
! 4 Type 2 prefix
! 5 Type 2 suffix
! 6 Free text
! -1 Does not decode correctly*/
//parameter (NBASE=37*36*10*27*27*27)
//parameter (NBASE2=262178562)
//character*22 msg0,msg
QString msg;
//char cmsg[50];
//integer dat(12)
//character*12 c1,c2
QString c1=" ";//20char
QString c2=" ";//20char
QString c3=" ";//20char
QString grid6=" ";//20char
//character*4 c3
//character*6 grid6
//logical text1,text2,text3
int ia;
int ib;
int ic;
int k1=0;
int k2=0;
int nv2a = 0;
int nv2b = 0;
int nc1=0;
int nc2=0;
bool text1=true;
bool text2=true;
bool text3=true;
int ng =0;
int count = strlen(msg0);//qDebug()<<"count="<<count;
for (int j = 0; j<count; j++)
msg.append(msg0[j]);
itype=1; //v2.12 in ima smisal msk itype=0 nqma smisal
//call fmtmsg(msg,iz)
//if(msg(1:3).eq.'CQ ' .and. msg(4:4).ge.'0' .and. msg(4:4).le.'9' &
//.and. msg(5:5).eq.' ') msg='CQ 00'//msg(4:)
//and CQ 0..9 HV
if(qstr_beg_end(msg,0,3) =="CQ " && msg[3]>='0' && msg[3]<='9' && msg[4]==' ') msg="CQ 00"+qstr_beg_end(msg,3,msg.count());
if (qstr_beg_end(msg,0,6) == "CQ DX ") msg[2]='9';//if(msg(1:6).eq.'CQ DX ') msg(3:3)='9'
//qDebug()<<"new="<<msg;
/*v1.27 //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if(msg(1:3).eq."CQ " .and. &
msg(4:4).ge.'A' .and. msg(4:4).le.'Z' .and. &
msg(5:5).ge.'A' .and. msg(5:5).le.'Z' .and. &
msg(6:6).eq.' ') msg='E9'//msg(4:)*/
if (qstr_beg_end(msg,0,3)=="CQ " &&
msg[3]>='A' && msg[3]<='Z' &&
msg[4]>='A' && msg[4]<='Z' &&
msg[5]==' ') msg="E9"+qstr_beg_end(msg,3,msg.count());
//qDebug()<<"new="<<msg<<msg[3]<<(int)'W';
//! See if it's a CQ message
int i = 0;
if (qstr_beg_end(msg,0,3) == "CQ ")
{/*if(msg(1:3).eq.'CQ ') then
go to 1 endif*/
i=2; //mai 2 //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
//! ... and if so, does it have a reply frequency?
if (msg[3]>='0' && msg[3]<='9' && msg[4]>='0' && msg[4]<='9' && msg[5]>='0' && msg[5]<='9')
i=6;//mai 6
goto cc1;
}
for (i = 0; i < count; i++)
{//do i=1,22
if (msg[i]==' ') goto cc1; //!Get 1st blank
}
goto c10; //!Consider msg as plain text
cc1:
ia=i;
copy_qstr(c1,msg,0,ia);//c1=qstr_beg_end(msg,0,ia);//c1=msg(1:ia-1)
for (i = ia+1; i < count; i++)
{//do i=ia+1,22
if (msg[i]==' ') goto cc2; //!Get 2nd blank
}
goto c10; //!Consider msg as plain text
cc2:
ib=i;
copy_qstr(c2,msg,ia+1,ib);//c2=qstr_beg_end(msg,ia+1,ib);//c2=msg(ia+1:ib-1)
for (i = ib+1; i < count; i++)
{//do i=ib+1,22
if (msg[i]==' ') goto cc3; //!Get 3rd blank
}
goto c10; //!Consider msg as plain text
cc3:
ic=i; //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
//c3=' '
if (ic>=ib+1) copy_qstr(c3,msg,ib+1,ic);//c3=qstr_beg_end(msg,ib+1,ic); if(ic.ge.ib+1) c3=msg(ib+1:ic)
if (qstr_beg_end(c3,0,4)=="OOO ") c3.replace("OOO "," ");//if(c3.eq.'OOO ') c3=' ' !Strip out the OOO flag
//qDebug()<<"c1c2c3="<<c1<<c2<<c3;
getpfx1(c1,k1,nv2a);//za sega se wy6tat k1=0,nv2a=1
//qDebug()<<"getpfx1="<<c1<<"K="<<k1<<"nv2a="<<nv2a;
if (nv2a>=4) goto c10;
packcall(c1,nc1,text1);
//qDebug()<<"packcall_1="<<c1<<"nc1="<<nc1<<"text1="<<text1;
if (text1) goto c10;
getpfx1(c2,k2,nv2b);
packcall(c2,nc2,text2);
//qDebug()<<"packcall_2="<<c2<<"nc2="<<nc2<<"text2="<<text2;
if (text2) goto c10; //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (nv2a==2 || nv2a==3 || nv2b==2 || nv2b==3)
{
if (k1<0 || k2<0 || k1*k2!=0) goto c10;
if (k2>0) k2=k2+450;
int k=max_2int(k1,k2);
if (k>0)
{
//k=449;
k2grid(k,grid6);
copy_qstr(c3,grid6,0,4);//grid6(:4)
//qDebug()<<"c3="<<c3;
}
}
//qDebug()<<"c3="<<c3;
packgrid(c3,ng,text3,msk144ms);
if (nv2a<4 && nv2b<4 && (!text1) && (!text2) && (!text3)) goto c20;
nc1=0;
if (nv2b==4)
{
if (qstr_beg_end(c1,0,3)=="CQ ") nc1=262178563 + k2;
if (qstr_beg_end(c1,0,4)=="QRZ ") nc1=264002072 + k2;
if (qstr_beg_end(c1,0,3)=="DE ") nc1=265825581 + k2;
}
else if (nv2b==5)
{
if (qstr_beg_end(c1,0,3)=="CQ ") nc1=267649090 + k2;
if (qstr_beg_end(c1,0,4)=="QRZ ") nc1=267698375 + k2;
if (qstr_beg_end(c1,0,3)=="DE ") nc1=267747660 + k2;
}
if (nc1!=0) goto c20;
//! The message will be treated as plain text.
c10:
itype=6;
packtext(msg,nc1,nc2,ng);
ng=ng+32768;
//qDebug()<<msg<<nc1<<nc2<<ng;
//! Encode data into 6-bit words
c20:
//continue;
//qDebug()<<"nv2a="<<nv2a<<"nv2a="<<nv2b<<"text1="<<text1<<"text2="<<text2<<"text3="<<text3;
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
//sent(k)=iand(1,ishft(i-1,-n)) -> sent[k]=1 & (i >> n)
//Left Shift ISHFT ISHFT(N,M) (M > 0) << n<<m n shifted left by m bits
//Right Shift ISHFT ISHFT(N,M) (M < 0) >> n>>m n shifted right by m bits
if (itype!=6) itype=max_2int(nv2a,nv2b);//moze bi -> nv2b=1;//2hv
dat[0]=((nc1 >> 22) & 63); //dat(1)=iand(ishft(nc1,-22),63) !6 bits //VNIMANIE -22 ???? //!6 bits
dat[1]=((nc1 >> 16) & 63); //!6 bits
dat[2]=((nc1 >> 10) & 63); //!6 bits
dat[3]=((nc1 >> 4) & 63); //!6 bits
dat[4]=4*(nc1 & 15)+((nc2 >> 26) & 3);//qDebug()<<"nc1="<<nc1<<"dat="<<dat[0]<<dat[1]<<dat[2]<<dat[3]<<dat[4]; //!4+2 bits
dat[5]=((nc2 >> 20) & 63); //!6 bits
dat[6]=((nc2 >> 14) & 63); //!6 bits
dat[7]=((nc2 >> 8) & 63); //!6 bits
dat[8]=((nc2 >> 2) & 63); //!6 bits
dat[9]=16*(nc2 & 3)+((ng >>12) & 15); //!2+4 bits
dat[10]=((ng >> 6) & 63);
dat[11]=(ng & 63);//dat(12)=iand(ng,63)
}

View File

@ -0,0 +1,49 @@
#ifndef PACK_UNPACK_MSG_H
#define PACK_UNPACK_MSG_H
#include <QString>
//#include <QStringList>
#include <math.h> /* fmod */
#include "../../../HvTxW/hvqthloc.h"
static const char C_PACK_UNPACK_JT[42]=
{'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I',
'J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','+',
'-','.','/','?'
};
class PackUnpackMsg
{
public:
void packmsg(char *message,int *i,int &itype,bool msk144ms);
QString unpackmsg144(int *dat,char &ident,QString &c1,QString &c2,bool msk144ms);
QString unpackmsg(int *dat,char &ident,bool msk144ms);
int index(QString,char search);
void copy_qstr(QString &to,QString from,int b_from,int e_from);
void grid2deg(QString grid0,double &dlong,double &dlat);
QString qstr_beg_end(QString s_in,int b,int e);
void deg2grid(double dlong0,double dlat,QString &grid);
private:
int CalcDistance(QString c_my_loc,QString c_test_loc);
HvQthLoc THvQthLoc;
QString RemBegEndWSpaces(QString str);
int max_2int(int a,int b);
int nchar(char c);
void packcall(QString c1,int &nc1,bool &text1);
void getpfx1(QString &callsign,int &k,int &nv2);
void packtext(QString msg,int &nc1,int &nc2,int &nc3);
void k2grid(int k,QString &grid);
void packgrid(QString grid,int &ng,bool &text,bool msk144ms);
///Pack///
///UnPack///
QString unpacktext(int nc1,int nc2,int nc3,QString msg);
void unpackcall(int nc1,QString &c1,int &iv2,QString &psfx);
void grid2k(QString grid6,int &k);
void unpackgrid(int ng,QString &grid,bool msk144ms);
void getpfx2(int k0,QString &callsign);
///UnPack///
QString addpfx;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV PackUnpackMessage77bit
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2018
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#ifndef PACK_UNPACK_MSG77_H
#define PACK_UNPACK_MSG77_H
#include <math.h> // fmod fabs
//#include <stdlib.h> // abs
#include <QString>
#include <QStringList>
class PackUnpackMsg77 //: public QObject
{
//Q_OBJECT // hv
public:
void initPackUnpack77(bool f_dec_gen);
void pack77(QString mes,int &i3,int n3,bool*c77);
QString unpack77(bool *c77,bool &unpk77_success);
void save_hash_call(QString c13,int &n10,int &n12,int &n22);
void save_hash_call_my_their_r1_r2(QString call,int pos);
void save_hash_call_mam(QStringList ls);
QString c1_rx_calls;
QString c2_rx_calls;
void split77(QString &msg,int &nwords,/*int *nw,*/QString *w);
private:
bool sf_dec_gen;
int BinToInt32(bool*a,int b_a,int bits_sz);
void mp_short_div(unsigned char *w,unsigned char *u,int b_u,int n,int iv,int &ir);
void int_to_8bit(int in,unsigned char *creg);
void mp_short_add(unsigned char *w,unsigned char *u,int beg_u,int n,int iv);
void mp_short_mult(unsigned char *w,unsigned char *u,int beg_u,int n,int iv);
QString RemWSpacesInside(QString s);
QString RemBegEndWSpaces(QString str);
void chkcall(QString w,QString &bc,bool &cok);
//QString adjustr(QString);
int ihashcall(QString c0,int m);
void pack28(QString c13,int &n28);
void SetArrayBits(int in,int in_bits,bool *ar,int &co);
//void split77(QString &msg,int &nwords,/*int *nw,*/QString *w);
void pack77_01(int nwords,QString *w,int &i3,int &n3,bool *c77);
bool is_grid4(QString);
bool is_grid6(QString);
//old EU Cont void pack77_02(int nwords,QString *w,int &i3,int &n3,bool *c77);
void pack77_03(int nwords,QString *w,int &i3,int &n3,bool *c77);
void pack77_1(int nwords,QString *w,int &i3,int &n3,bool *c77);
void pack77_3(int nwords,QString *w,int &i3,int &n3,bool *c77);
void pack77_4(int nwords,QString *w,int &i3,int &n3,bool *c77);
void pack77_5(int nwords,QString *w,int &i3,int &n3,bool *c77);
void packtext77(QString,int &i3,int &n3,bool *c77);
//// unpack //////////////////////////////////////
bool to_grid4(int n,QString &grid4);
bool to_grid6(int n,QString &grid6);
void unpacktext77(bool *c77,QString &c13);
void hash10(int n10,QString &c13);
void hash12(int n12,QString &c13);
void hash22(int n22,QString &c13);
void unpack28(int n28_0,QString &c13,bool &success);
};
#endif

View File

@ -0,0 +1,712 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV UnpackMessage
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2017
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "pack_unpack_msg.h"
#include "../../../pfx_sfx.h"
//#include <QtGui>
/*QString GenMsk::CharToQString(char* ch, int count)
{
QString s;
for (int j = 0; j<count; j++)
s.append(ch[j]);
return s;
}*/
QString PackUnpackMsg::RemBegEndWSpaces(QString str)
{
QString s;
/*int msg_count = 0;//2.64 stop
for (msg_count = str.count()-1; msg_count>=0; msg_count--)
{
if (str.at(msg_count)!=' ')
break;
}
s = str.mid(0,msg_count+1);
msg_count = 0;
for (msg_count = 0; msg_count<s.count(); msg_count++)
{
if (s.at(msg_count)!=' ')
break;
}
s = s.mid(msg_count,(s.count()-msg_count));*/
s = str.trimmed();
return s;
}
QString PackUnpackMsg::unpacktext(int nc1,int nc2,int nc3,QString msg)
{
/*character*22 msg
character*44 c
data c/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ +-./?'/*/
int j = 0;
nc3=(nc3 & 32767); //!Remove the "plain text" bit
if ((nc1 & 1)!=0) nc3=nc3+32768;
nc1=nc1/2;
if ((nc2 & 1)!=0) nc3=nc3+65536;
nc2=nc2/2;
for (int i = 4; i >= 0; i--)
{//do i=5,1,-1
//j=fmod(nc1,42)+0;
j=(nc1 % 42);
msg[i]=C_PACK_UNPACK_JT[j];
nc1=nc1/42;
}
for (int i = 9; i >= 5; i--)
{//do i=10,6,-1
//j=fmod(nc2,42)+0;
j=(nc2 % 42);
msg[i]=C_PACK_UNPACK_JT[j];
nc2=nc2/42;
}
for (int i = 12; i >= 10; i--)
{//do i=13,11,-1
//j=fmod(nc3,42)+0;
j=(nc3 % 42);
msg[i]=C_PACK_UNPACK_JT[j];
nc3=nc3/42;
}
for (int i = 13; i < 23; i++)
msg[i] = ' ';
return msg;
}
void PackUnpackMsg::unpackcall(int ncall,QString &word,int &iv2,QString &psfx)
{
//parameter (NBASE=37*36*10*27*27*27)
//character word*12,c*37,psfx*4
//data c/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ '/
char c[37]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E',
'F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' '};
int i = 0;
word="......";
psfx=" ";
int n=ncall;
iv2=0; //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (n>=262177560) goto c20;
word="......";
//! if(n.ge.262177560) go to 999 !Plain text message ...262177561
//i=fmod(n,27)+10;
i=(n % 27)+10;
word[5]=c[i];
n=n/27;
//i=fmod(n,27)+10;
i=(n % 27)+10;
word[4]=c[i];
n=n/27;
//i=fmod(n,27)+10;
i=(n % 27)+10;
word[3]=c[i];
n=n/27;
//i=fmod(n,10)+0;
i=(n % 10);
word[2]=c[i];
n=n/10;
//i=fmod(n,36)+0;
i=(n % 36);
word[1]=c[i];
n=n/36;
i=n+0;
word[0]=c[i];
for (i = 0; i < 4; i++)
{//do i=1,4
if (word[i]!=' ') goto c10;
}
goto c999;
c10:
word=qstr_beg_end(word,i,word.count());
goto c999;
c20:
if (n>=267796946) goto c999;//262177561
//qDebug()<<"DDDDDDDDDDDDDDDDDDDDD";
//! We have a JT65v2 message//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if ((n>=262178563) && (n<=264002071))
//! CQ with prefix
{ iv2=1;
n=n-262178563;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[3]=c[i];
n=n/37;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[2]=c[i];
n=n/37;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[1]=c[i];
n=n/37;
i=n+0;
psfx[0]=c[i];
}
else if ((n>=264002072) && (n<=265825580))
//! QRZ with prefix
{ iv2=2;
n=n-264002072;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[3]=c[i];
n=n/37;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[2]=c[i];
n=n/37;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[1]=c[i];
n=n/37;
i=n+0;
psfx[0]=c[i];
}
else if ((n>=265825581) && (n<=267649089))//262177561
//! DE with prefix
{ iv2=3;
n=n-265825581;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[3]=c[i];
n=n/37;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[2]=c[i];
n=n/37;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[1]=c[i];
n=n/37;
i=n+0;
psfx[0]=c[i];
}
else if ((n>=267649090) && (n<=267698374))//262177561
//! CQ with suffix
{ iv2=4;
n=n-267649090;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[2]=c[i];
n=n/37;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[1]=c[i];
n=n/37;
i=n+0;
psfx[0]=c[i];
}
else if ((n>=267698375) && (n<=267747659))
//! QRZ with suffix
{ iv2=5;
n=n-267698375;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[2]=c[i];
n=n/37;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[1]=c[i];
n=n/37;
i=n+0;
psfx[0]=c[i];
}
else if ((n>=267747660) && (n<=267796944))
//! DE with suffix
{ iv2=6;
n=n-267747660;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[2]=c[i];
n=n/37;
//i=fmod(n,37)+0;
i=(n % 37);
psfx[1]=c[i];
n=n/37;
i=n+0;
psfx[0]=c[i]; //qDebug()<<"DDDDDDDDDDDDDDDDDDDDD";
}
else if (n==267796945)
//! DE with no prefix or suffix
{ iv2=7;
psfx = " ";
}
c999:
if (qstr_beg_end(word,0,3)=="3D0") word="3DA0"+qstr_beg_end(word,3,word.count());//word(4:)
if (qstr_beg_end(word,0,1)=="Q") word="3X"+qstr_beg_end(word,1,word.count());
//if(word(1:1).eq.'Q') word='3X'//word(2:)
word = RemBegEndWSpaces(word);
psfx = RemBegEndWSpaces(psfx);
//qDebug()<<"DDD="<<iv2<<psfx;
}
void PackUnpackMsg::unpackgrid(int ng,QString &grid,bool msk144ms)// rpt_db_msk
{
int NGBASE=180*180;
QString grid6=" ";//vazno da e taka hv
int n;
grid=" ";//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
double dlat=fmod(ng,180)-90;
double dlong=(ng/180)*2 - 180 + 2;
if (ng>=32400) goto c10;
deg2grid(dlong,dlat,grid6);
grid=qstr_beg_end(grid6,0,4);
if (qstr_beg_end(grid,0,2)=="KA")// old loc
{
//read(grid(3:4),*) n
n=qstr_beg_end(grid,2,4).toInt();
//n=n-50; //qDebug()<<"NNNNNN1="<<n;
if (msk144ms)
{
n=n-30;
grid = QString("%1").arg(n,2,10,QChar('0'))+" ";
}
else
{
n=n-50;
grid = "+"+QString("%1").arg(n,2,10,QChar('0'))+" ";
}
//if (grid[0]==' ') grid[0]='+';
}
else if (qstr_beg_end(grid,0,2)=="LA")// old loc
{
//read(grid(3:4),*) n
n=qstr_beg_end(grid,2,4).toInt();
//n=n-50; //qDebug()<<"NNNNNN2="<<n;
if (msk144ms)
{
n=n-30;
grid = "R"+QString("%1").arg(n,2,10,QChar('0'));
}
else
{
n=n-50;
grid = "R+"+QString("%1").arg(n,2,10,QChar('0'));
}
//if (grid[1]==' ') grid[1]='+';
}
goto c900;
c10:
n=ng-NGBASE-1;//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (n>=1 && n<=30)
{
//grid.replace(2,2,QString("%1").arg((n)));
grid = "-"+QString("%1").arg(n,2,10,QChar('0'))+" ";
//write(grid,1012) -n
//1012 format(i3.2)
}
else if (n>=31 && n<=60)
{
n=n-30;
//grid.replace(2,2,QString("%1").arg((n)));
grid = "R-"+QString("%1").arg(n,2,10,QChar('0'));
//write(grid,1022) -n
//1022 format('R',i3.2)
}
else if (n==61)
{
grid="RO ";
}
else if (n==62)
{
grid="RRR ";
}
else if (n==63)
{
grid="73 ";
}
c900:
return;
}
void PackUnpackMsg::grid2k(QString grid,int &k)
{
/*double xlong,xlat;
grid2deg(grid,xlong,xlat);
int nlong=(int)xlong;
int nlat=(int)xlat; //qDebug()<<"LONGLAT="<<xlong<<xlat<<grid;
k=0;
if (nlat>=85) k=5*(nlong+179)/2 + nlat-84+0;//if(nlat.ge.85) k=5*(nlong+179)/2 + nlat-84*/
double xlong,xlat;
grid2deg(grid,xlong,xlat);
k=0;
if (xlat>=85.0) k=5.0*(xlong+179.0)/2.0 + xlat-84.0+1;
//qDebug()<<"KK="<<k;
}
void PackUnpackMsg::getpfx2(int k0,QString &callsign)
{
//character callsign*12
//include 'pfx.f90'
//character addpfx*8
//common/pfxcom/addpfx
//int iz;
int k=k0;//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (k>450) k=k-450;//if(k.gt.450) k=k-450
//qDebug()<<"K="<<k;
if (k>=1 && k<=NZ) //if(k.ge.1 .and. k.le.NZ) then
{
//iz=index(pfx[k],' ') - 1;
callsign=pfx[k-1]+"/"+callsign;//callsign=pfx(k)(1:iz)//'/'//callsign
//qDebug()<<"PFX="<<pfx[k];
}
else if (k>=401 && k<=400+NZ2) //else if(k.ge.401 .and. k.le.400+NZ2) then
{
//iz=index(callsign,' ') - 1
callsign=callsign+"/"+sfx[k-400-1];//callsign=callsign(1:iz)//'/'//sfx(k-400)
}
else if (k==449) //else if(k.eq.449) then
{
//iz=index(addpfx,' ') - 1
//if(iz.lt.1) iz=8
callsign=addpfx+"/"+callsign;//callsign=addpfx(1:iz)//'/'//callsign
}
}
int PackUnpackMsg::CalcDistance(QString c_my_loc,QString c_test_loc)
{
int dist_km = 0;
double dlong1 = THvQthLoc.getLon(c_my_loc);
double dlat1 = THvQthLoc.getLat(c_my_loc);
double dlong2 = THvQthLoc.getLon(c_test_loc);
double dlat2 = THvQthLoc.getLat(c_test_loc);
dist_km = THvQthLoc.getDistanceKilometres(dlong1,dlat1,dlong2,dlat2);
return dist_km;
}
QString PackUnpackMsg::unpackmsg144(int *dat,char &ident,QString &c1,QString &c2,bool rpt_db_msk)//false rpt_db_msk
{
QString msg;
int nc1,nc2,ng;//,i;
//QString c1,c2,psfx,junk2,grid,grid6;
QString psfx,junk2,grid,grid6;
int iv2,junk1;
bool cqnnn=false;
int NBASE=37*36*10*27*27*27;
int k =0;
//int j = 0;
//QString ss="aA";
//char aa = 'A';
nc1=(dat[0]<<22) + (dat[1]<<16) + (dat[2]<<10)+(dat[3]<<4) + ((dat[4]>>2)&15);
nc2=((dat[4]&3)<<26) + (dat[5]<<20) +(dat[6]<<14) + (dat[7]<<8) + (dat[8]<<2) +((dat[9]>>4)&3);
ng=((dat[9]&15)<<12) + (dat[10]<<6) + dat[11];
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (ng>=32768)
{
msg = unpacktext(nc1,nc2,ng,msg);
c1="";
c2="";
ident = '$';
goto c100;
}
//nc1=262178563;
unpackcall(nc1,c1,iv2,psfx);
ident = '*';
if (iv2==0)
//! This is an "original JT65" message
{
if (nc1==NBASE+1) c1="CQ";
if (nc1==NBASE+2) c1="QRZ";
int nfreq=nc1-NBASE-3;
if (nfreq>=0 && nfreq<=999)
{
//write(c1,1002) nfreq
//1002 format('CQ ',i3.3)
//
c1=("CQ "+QString("%1").arg(nfreq));
cqnnn=true;
}
}
unpackcall(nc2,c2,junk1,junk2);
unpackgrid(ng,grid,rpt_db_msk);//false rpt_db_msk
//qDebug()<<"psfx="<<iv2<<psfx<<grid;
if (iv2>0) //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
{
//! This is a JT65v2 message
/*for (i = 0; i < 4; i++)
{//do i=1,4
if (((int)psfx[i].toLatin1())==0) psfx[i]=' ';
}*/
//n1=len_trim(psfx)
//n2=len_trim(c2)
if (iv2==1) msg="CQ "+psfx+"/"+c2+" "+grid; //psfx(:n1)//'/'//c2(:n2)//' '//grid
if (iv2==2) msg="QRZ "+psfx+"/"+c2+" "+grid; //psfx(:n1)//'/'//c2(:n2)//' '//grid
if (iv2==3) msg="DE "+psfx+"/"+c2+" "+grid; //psfx(:n1)//'/'//c2(:n2)//' '//grid
if (iv2==4) msg="CQ "+c2+"/"+psfx+" "+grid; //c2(:n2)//'/'//psfx(:n1)//' '//grid
if (iv2==5) msg="QRZ "+c2+"/"+psfx+" "+grid; //c2(:n2)//'/'//psfx(:n1)//' '//grid
if (iv2==6) msg="DE "+c2+"/"+psfx+" "+grid; //c2(:n2)//'/'//psfx(:n1)//' '//grid
if (iv2==7) msg="DE "+c2+" "+grid; //c2(:n2)//' '//grid
if (iv2==8) msg=" ";
goto c100;
//else
}
//qDebug()<<"DDD="<<c1<<c2<<grid<<psfx;//<<junk2;
grid6=grid+"ma";
//grid6="IR94ma"; //ima->"IR95ma"; niama->"IR94ma";
//qDebug()<<"Grid K_in="<<grid<<k;
grid2k(grid6,k);
//qDebug()<<"K_out="<<k;
if (k>=1 && k<=450) getpfx2(k,c1);//if(k.ge.1 .and. k.le.450) call getpfx2(k,c1)
if (k>=451 && k<=900) getpfx2(k,c2);//if(k.ge.451 .and. k.le.900) call getpfx2(k,c2)
//qDebug()<<"addpfx1="<<addpfx1;
//qDebug()<<"C1="<<c1<<"C2="<<c2;
//k=0;
//i=index(c1,char(0))
//if(i>=3) c1=c1(1:i-1)//' '
//i=index(c2,char(0))
//if(i>=3) c2=c2(1:i-1)//' '
//msg=" ";
//j=-1;
if (cqnnn)
{
//msg=c1+" ";
//j=7;
msg.append(c1);
msg.append(" ");
goto c10;
}
/*for (i = 0; i < 12; i++)
{//do i=1,12
j++;//j=j+1
msg[j]=c1[i];
if (c1[i]==' ') goto c10;
}
j++;//j=j+1
msg[j]=' ';*/
msg.append(c1);
msg.append(" ");
c10:
/*for (i = 0; i < 12; i++) //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
{//do i=1,12
if (j<=21) j++;
msg[j]=c2[i];
if (c2[i]==' ') goto c20;
}
if (j<=21) j++;//j=j+1
msg[j]=' '; */
msg.append(c2);
if (grid!=" ")
msg.append(" ");
//c20:
if (k==0)
{
/*for (i = 0; i < 4; i++)
{//do i=1,4
if (j<=21) j++;
msg[j]=grid[i];//qDebug()<<"DDD1="<<c1<<c2<<grid[i]<<psfx<<"MSG="<<j;//<<junk2;
}
if (j<=21) j++;
msg[j]=' ';*/
if (grid!=" ")
msg.append(grid);
}
c100: //continue
if (qstr_beg_end(msg,0,6)=="CQ9DX ") msg[2]=' ';
//qDebug()<<"DDD2="<<c1<<c2<<grid<<psfx<<"MSG="<<msg<<k;//<<junk2;
/* v1.27
if(msg(1:2).eq.'E9' .and. &
msg(3:3).ge.'A' .and. msg(3:3).le.'Z' .and. &
msg(4:4).ge.'A' .and. msg(4:4).le.'Z' .and. &
msg(5:5).eq.' ') msg='CQ '//msg(3:)*/
if (qstr_beg_end(msg,0,2)=="E9" &&
msg[2]>='A' && msg[2]<='Z' &&
msg[3]>='A' && msg[3]<='Z' &&
msg[4]==' ') msg="CQ "+qstr_beg_end(msg,2,msg.count());
msg = RemBegEndWSpaces(msg);
return msg;
}
QString PackUnpackMsg::unpackmsg(int *dat,char &ident,bool rpt_db_msk)//false rpt_db_msk
{
QString msg;
int nc1,nc2,ng;//,i;
QString c1,c2,psfx,junk2,grid,grid6;
int iv2,junk1;
bool cqnnn=false;
int NBASE=37*36*10*27*27*27;
int k =0;
//int j = 0;
//QString ss="aA";
//char aa = 'A';
nc1=(dat[0]<<22) + (dat[1]<<16) + (dat[2]<<10)+(dat[3]<<4) + ((dat[4]>>2)&15);
nc2=((dat[4]&3)<<26) + (dat[5]<<20) +(dat[6]<<14) + (dat[7]<<8) + (dat[8]<<2) +((dat[9]>>4)&3);
ng=((dat[9]&15)<<12) + (dat[10]<<6) + dat[11];
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (ng>=32768)
{
msg = unpacktext(nc1,nc2,ng,msg);
ident = '$';
goto c100;
}
//nc1=262178563;
unpackcall(nc1,c1,iv2,psfx);
ident = '*';
if (iv2==0)
//! This is an "original JT65" message
{
if (nc1==NBASE+1) c1="CQ";
if (nc1==NBASE+2) c1="QRZ";
int nfreq=nc1-NBASE-3;
if (nfreq>=0 && nfreq<=999)
{
//write(c1,1002) nfreq
//1002 format('CQ ',i3.3)
//
c1=("CQ "+QString("%1").arg(nfreq));
cqnnn=true;
}
}
unpackcall(nc2,c2,junk1,junk2);
unpackgrid(ng,grid,rpt_db_msk);//false rpt_db_msk
//qDebug()<<"psfx="<<iv2<<psfx<<grid;
if (iv2>0) //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
{
//! This is a JT65v2 message
/*for (i = 0; i < 4; i++)
{//do i=1,4
if (((int)psfx[i].toLatin1())==0) psfx[i]=' ';
}*/
//n1=len_trim(psfx)
//n2=len_trim(c2)
if (iv2==1) msg="CQ "+psfx+"/"+c2+" "+grid; //psfx(:n1)//'/'//c2(:n2)//' '//grid
if (iv2==2) msg="QRZ "+psfx+"/"+c2+" "+grid; //psfx(:n1)//'/'//c2(:n2)//' '//grid
if (iv2==3) msg="DE "+psfx+"/"+c2+" "+grid; //psfx(:n1)//'/'//c2(:n2)//' '//grid
if (iv2==4) msg="CQ "+c2+"/"+psfx+" "+grid; //c2(:n2)//'/'//psfx(:n1)//' '//grid
if (iv2==5) msg="QRZ "+c2+"/"+psfx+" "+grid; //c2(:n2)//'/'//psfx(:n1)//' '//grid
if (iv2==6) msg="DE "+c2+"/"+psfx+" "+grid; //c2(:n2)//'/'//psfx(:n1)//' '//grid
if (iv2==7) msg="DE "+c2+" "+grid; //c2(:n2)//' '//grid
if (iv2==8) msg=" ";
goto c100;
//else
}
//qDebug()<<"DDD="<<c1<<c2<<grid<<psfx;//<<junk2;
grid6=grid+"ma";
//grid6="IR94ma"; //ima->"IR95ma"; niama->"IR94ma";
//qDebug()<<"Grid K_in="<<grid<<k;
grid2k(grid6,k);
//qDebug()<<"K_out="<<k;
if (k>=1 && k<=450) getpfx2(k,c1);//if(k.ge.1 .and. k.le.450) call getpfx2(k,c1)
if (k>=451 && k<=900) getpfx2(k,c2);//if(k.ge.451 .and. k.le.900) call getpfx2(k,c2)
//qDebug()<<"addpfx1="<<addpfx1;
//qDebug()<<"C1="<<c1<<"C2="<<c2;
//k=0;
//i=index(c1,char(0))
//if(i>=3) c1=c1(1:i-1)//' '
//i=index(c2,char(0))
//if(i>=3) c2=c2(1:i-1)//' '
//msg=" ";
//j=-1;
if (cqnnn)
{
//msg=c1+" ";
//j=7;
msg.append(c1);
msg.append(" ");
goto c10;
}
/*for (i = 0; i < 12; i++)
{//do i=1,12
j++;//j=j+1
msg[j]=c1[i];
if (c1[i]==' ') goto c10;
}
j++;//j=j+1
msg[j]=' ';*/
msg.append(c1);
msg.append(" ");
c10:
/*for (i = 0; i < 12; i++) //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
{//do i=1,12
if (j<=21) j++;
msg[j]=c2[i];
if (c2[i]==' ') goto c20;
}
if (j<=21) j++;//j=j+1
msg[j]=' '; */
msg.append(c2);
if (grid!=" ")
msg.append(" ");
//c20:
if (k==0)
{
/*for (i = 0; i < 4; i++)
{//do i=1,4
if (j<=21) j++;
msg[j]=grid[i];//qDebug()<<"DDD1="<<c1<<c2<<grid[i]<<psfx<<"MSG="<<j;//<<junk2;
}
if (j<=21) j++;
msg[j]=' ';*/
if (grid!=" ")
msg.append(grid);
}
c100: //continue
if (qstr_beg_end(msg,0,6)=="CQ9DX ") msg[2]=' ';
//qDebug()<<"DDD2="<<c1<<c2<<grid<<psfx<<"MSG="<<msg<<k;//<<junk2;
/* v1.27
if(msg(1:2).eq.'E9' .and. &
msg(3:3).ge.'A' .and. msg(3:3).le.'Z' .and. &
msg(4:4).ge.'A' .and. msg(4:4).le.'Z' .and. &
msg(5:5).eq.' ') msg='CQ '//msg(3:)*/
if (qstr_beg_end(msg,0,2)=="E9" &&
msg[2]>='A' && msg[2]<='Z' &&
msg[3]>='A' && msg[3]<='Z' &&
msg[4]==' ') msg="CQ "+qstr_beg_end(msg,2,msg.count());
//if(msg(1:5).eq.'CQ 00' .and. msg(6:6).ge.'0' .and. &
//msg(6:6).le.'9') msg='CQ '//msg(6:)
//and CQ 0..9 HV
if(qstr_beg_end(msg,0,5)=="CQ 00" && msg[5]>='0' && msg[5]<='9') msg="CQ "+qstr_beg_end(msg,5,msg.count());
msg = RemBegEndWSpaces(msg);
return msg;
}

View File

@ -0,0 +1,368 @@
/* MSHV RawFilter
* Copyright 2015 Hrisimir Hristov, LZ2HV
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "hvrawfilter.h"
//#include <QtGui>
HvRawFilter::HvRawFilter(int all_gain, double min_down_frq, double max_up_frq, bool type_lhsh_lhpf)
{
Gain_all = 1.00;
a0 = 0.00;
a1 = 0.00;
a2 = 0.00;
b0 = 0.00;
b1 = 0.00;
b2 = 0.00;
memset(&eq,0,sizeof(EQSTATE));//2.12 0.0 or 0 ? malloc(sizeof(EQSTATE));
srate = 0.0;//fiktivno posle se smenia ot vzavisimost ot GenMessage::testwave() set_rate(double)
A = pow(10, 0.00/40); //dbGine = 0 za 0 db (0/40)
beta = sqrt(A + A);
TYPE_LHSH_LHPF = type_lhsh_lhpf;//TX true=LSH&HSH, RX false=LPF&HPF
bandw_LPF = 1.0;// 1.0 v1.15 za ravna harakteristika
bandw_HPF = 1.0;// 1.0 v1.15 za ravna harakteristika
alpha = 1.0;
//two_pass_filt = false;
freq1 = min_down_frq;//62.0;//62 - 100.0
//freq2 = min_down_frq;
freq10 = max_up_frq;//10000.0;// 13000.0
//freq11 = max_up_frq;//10000.0;// 13000.0
dbGain1((double)(0 - 50)/4);//45hz
//dbGain2((double)(0 - 50)/4);//45hz
dbGain10((double)(0 - 50)/4);//13000hz
//dbGain11((double)(0 - 50)/4);//13000hz
AlldbGain((double)(all_gain - 50)/4);//AlldbGain11((double)(45 - 50)/4);//gine 45 zaradi windows
//qDebug()<<"1two_pass_filt"<<two_pass_filt;
}
HvRawFilter::~HvRawFilter()
{}
void HvRawFilter::set_rate(double rate)
{
//qDebug()<<"RATE"<<rate;
srate = rate;
dbGain1((double)(0 - 50)/4);
//dbGain2((double)(0 - 50)/4);
dbGain10((double)(0 - 50)/4);
//dbGain11((double)(0 - 50)/4);
}
/*
void HvRawFilter::filter_parm(int all_gain, double min_down_frq, double max_up_frq, bool type_lhsh_lhpf)
{
two_pass_filt = true;
TYPE_LHSH_LHPF = type_lhsh_lhpf;
freq1 = min_down_frq;// - 500;
//freq2 = min_down_frq;
freq10 = max_up_frq;//10000.0;// 13000.0
freq11 = max_up_frq + 300;
AlldbGain11((double)(all_gain - 50)/4);
//qDebug()<<"2two_pass_filt"<<two_pass_filt;
}
*/
void HvRawFilter::dbGain1(double val)
{
A = pow(10, val/40);
beta = sqrt(A + A);
omega = (double)2 * M_PI_HV * freq1 /(double)srate;
sn = sin(omega);
cs = cos(omega);
if (TYPE_LHSH_LHPF)
{
//LSH: /* Low shelf filter */
b0 = A * ((A + 1) - (A - 1) * cs + beta * sn);
b1 = 2 * A * ((A - 1) - (A + 1) * cs);
b2 = A * ((A + 1) - (A - 1) * cs - beta * sn);
a0 = (A + 1) + (A - 1) * cs + beta * sn;
a1 = -2 * ((A - 1) + (A + 1) * cs);
a2 = (A + 1) + (A - 1) * cs - beta * sn;
}
else
{
//HPF: /* High pass filter */
alpha = sn/(2.0*bandw_HPF);
b0 = (1 + cs)/2.0;
b1 = -(1 + cs);
b2 = (1 + cs)/2.0;
a0 = 1 + alpha;
a1 = -2 * cs;
a2 = 1 - alpha;
//NOTCH:
/*alpha = sn/(2.0*bandw_HPF);
b0 = 1;
b1 = -2 * cs;
b2 = 1;
a0 = 1 + alpha;
a1 = -2 * cs;
a2 = 1 - alpha;*/
}
/*eq.f1a0_l = eq.f1a0_r = b0 /a0;
eq.f1a1_l = eq.f1a1_r = b1 /a0;
eq.f1a2_l = eq.f1a2_r = b2 /a0;
eq.f1a3_l = eq.f1a3_r = a1 /a0;
eq.f1a4_l = eq.f1a4_r = a2 /a0;
eq.f1x1_l = eq.f1x2_l = eq.f1x1_r = eq.f1x2_r = 0;
eq.f1y1_l = eq.f1y2_l = eq.f1y1_r = eq.f1y2_r = 0;*/
eq.f1a0_l = b0 /a0;
eq.f1a1_l = b1 /a0;
eq.f1a2_l = b2 /a0;
eq.f1a3_l = a1 /a0;
eq.f1a4_l = a2 /a0;
eq.f1x1_l = eq.f1x2_l = 0;
eq.f1y1_l = eq.f1y2_l = 0;
}
/*
void HvRawFilter::dbGain2(double val)
{
A = pow(10, val/40);
beta = sqrt(A + A);
omega = (double)2 * M_PI_HV * freq2 /(double)srate;
sn = sin(omega);
cs = cos(omega);
if (TYPE_LHSH_LHPF)
{
//LSH: // Low shelf filter /
b0 = A * ((A + 1) - (A - 1) * cs + beta * sn);
b1 = 2 * A * ((A - 1) - (A + 1) * cs);
b2 = A * ((A + 1) - (A - 1) * cs - beta * sn);
a0 = (A + 1) + (A - 1) * cs + beta * sn;
a1 = -2 * ((A - 1) + (A + 1) * cs);
a2 = (A + 1) + (A - 1) * cs - beta * sn;
}
else
{
//HPF: // High pass filter
alpha = sn/(2.0*bandw_HPF);
b0 = (1 + cs)/2.0;
b1 = -(1 + cs);
b2 = (1 + cs)/2.0;
a0 = 1 + alpha;
a1 = -2 * cs;
a2 = 1 - alpha;
}
eq.f2a0_l = eq.f2a0_r = b0 /a0;
eq.f2a1_l = eq.f2a1_r = b1 /a0;
eq.f2a2_l = eq.f2a2_r = b2 /a0;
eq.f2a3_l = eq.f2a3_r = a1 /a0;
eq.f2a4_l = eq.f2a4_r = a2 /a0;
eq.f2x1_l = eq.f2x2_l = eq.f2x1_r = eq.f2x2_r = 0;
eq.f2y1_l = eq.f2y2_l = eq.f2y1_r = eq.f2y2_r = 0;
}
*/
void HvRawFilter::dbGain10(double val)
{
A = pow(10, val/40);
beta = sqrt(A + A);
omega = (double)2 * M_PI_HV * freq10 /(double)srate;
sn = sin(omega);
cs = cos(omega);
if (TYPE_LHSH_LHPF)
{
//HSH: /* High shelf filter */
b0 = A * ((A + 1) + (A - 1) * cs + beta * sn);
b1 = -2 * A * ((A - 1) + (A + 1) * cs);
b2 = A * ((A + 1) + (A - 1) * cs - beta * sn);
a0 = (A + 1) - (A - 1) * cs + beta * sn;
a1 = 2 * ((A - 1) - (A + 1) * cs);
a2 = (A + 1) - (A - 1) * cs - beta * sn;
}
else
{
//LPF: /* low pass filter */
alpha = sn/(2.0*bandw_LPF);
b0 = (1 - cs)/2.0;
b1 = 1 - cs;
b2 = (1 - cs)/2.0;
a0 = 1 + alpha;
a1 = -2 * cs;
a2 = 1 - alpha;
//NOTCH:
/*alpha = sn/(2.0*bandw_HPF);
b0 = 1;
b1 = -2 * cs;
b2 = 1;
a0 = 1 + alpha;
a1 = -2 * cs;
a2 = 1 - alpha;*/
}
/*eq.f10a0_l = eq.f10a0_r = b0 /a0;
eq.f10a1_l = eq.f10a1_r = b1 /a0;
eq.f10a2_l = eq.f10a2_r = b2 /a0;
eq.f10a3_l = eq.f10a3_r = a1 /a0;
eq.f10a4_l = eq.f10a4_r = a2 /a0;
eq.f10x1_l = eq.f10x2_l = eq.f10x1_r = eq.f10x2_r = 0;
eq.f10y1_l = eq.f10y2_l = eq.f10y1_r = eq.f10y2_r = 0;*/
eq.f10a0_l = b0 /a0;
eq.f10a1_l = b1 /a0;
eq.f10a2_l = b2 /a0;
eq.f10a3_l = a1 /a0;
eq.f10a4_l = a2 /a0;
eq.f10x1_l = eq.f10x2_l = 0;
eq.f10y1_l = eq.f10y2_l = 0;
}
/*
void HvRawFilter::dbGain11(double val)
{
A = pow(10, val/40);
beta = sqrt(A + A);
omega = (double)2 * M_PI_HV * freq11 /(double)srate;
sn = sin(omega);
cs = cos(omega);
if (TYPE_LHSH_LHPF)
{
//HSH: High shelf filter
b0 = A * ((A + 1) + (A - 1) * cs + beta * sn);
b1 = -2 * A * ((A - 1) + (A + 1) * cs);
b2 = A * ((A + 1) + (A - 1) * cs - beta * sn);
a0 = (A + 1) - (A - 1) * cs + beta * sn;
a1 = 2 * ((A - 1) - (A + 1) * cs);
a2 = (A + 1) - (A - 1) * cs - beta * sn;
}
else
{
//LPF: low pass filter
alpha = sn/(2.4*bandw_LPF);
//alpha = sn/(1.5);
b0 = (1 - cs)/2.0;
b1 = 1 - cs;
b2 = (1 - cs)/2.0;
a0 = 1 + alpha;
a1 = -2 * cs;
a2 = 1 - alpha;
//NOTCH:
//alpha = sn/(2.0*bandw_HPF);
//b0 = 1;
//b1 = -2 * cs;
//b2 = 1;
//a0 = 1 + alpha;
//a1 = -2 * cs;
//a2 = 1 - alpha;
}
eq.f11a0_l = eq.f11a0_r = b0 /a0;
eq.f11a1_l = eq.f11a1_r = b1 /a0;
eq.f11a2_l = eq.f11a2_r = b2 /a0;
eq.f11a3_l = eq.f11a3_r = a1 /a0;
eq.f11a4_l = eq.f11a4_r = a2 /a0;
eq.f11x1_l = eq.f11x2_l = eq.f11x1_r = eq.f11x2_r = 0;
eq.f11y1_l = eq.f11y2_l = eq.f11y1_r = eq.f11y2_r = 0;
}
*/
void HvRawFilter::AlldbGain(double val)
{
Gain_all = pow(10, val/20); // +- 12.5db
//qDebug()<<Gain_all;
}
double HvRawFilter::band_l(double sample)
{
double out1, out10, sl;//out2, out11,
out1 = eq.f1a0_l * sample + eq.f1a1_l * eq.f1x1_l + eq.f1a2_l * eq.f1x2_l - eq.f1a3_l * eq.f1y1_l - eq.f1a4_l * eq.f1y2_l;
eq.f1x2_l = eq.f1x1_l;
eq.f1x1_l = sample;
eq.f1y2_l = eq.f1y1_l;
eq.f1y1_l = out1;
/*if (two_pass_filt)
{
out2 = eq.f2a0_l * out1 + eq.f2a1_l * eq.f2x1_l + eq.f2a2_l * eq.f2x2_l - eq.f2a3_l * eq.f2y1_l - eq.f2a4_l * eq.f2y2_l;
eq.f2x2_l = eq.f2x1_l;
eq.f2x1_l = out1;
eq.f2y2_l = eq.f2y1_l;
eq.f2y1_l = out2;
}
else
out2 = out1;*/
out10 = eq.f10a0_l * out1 + eq.f10a1_l * eq.f10x1_l + eq.f10a2_l * eq.f10x2_l - eq.f10a3_l * eq.f10y1_l - eq.f10a4_l * eq.f10y2_l;
eq.f10x2_l = eq.f10x1_l;
eq.f10x1_l = out1;
eq.f10y2_l = eq.f10y1_l;
eq.f10y1_l = out10;
/*if (two_pass_filt)
{
out11 = eq.f11a0_l * out10 + eq.f11a1_l * eq.f11x1_l + eq.f11a2_l * eq.f11x2_l - eq.f11a3_l * eq.f11y1_l - eq.f11a4_l * eq.f11y2_l;
eq.f11x2_l = eq.f11x1_l;
eq.f11x1_l = out10;
eq.f11y2_l = eq.f11y1_l;
eq.f11y1_l = out11;
}
else
out11 = out10;*/
sl = out10*Gain_all;
// hv limiter max +32767 min -32768 <- !!!! 8 hi for 16bit*/
/*if (sl > 32766)
sl = 32766;
if (sl < -32767)
sl = -32767;*/
return sl;
}
/*double HvRawFilter::band_r(double sample)
{
double out1, out10, sl;//out2, out11,
out1 = eq.f1a0_r * sample + eq.f1a1_r * eq.f1x1_r + eq.f1a2_r * eq.f1x2_r - eq.f1a3_r * eq.f1y1_r - eq.f1a4_r * eq.f1y2_r;
eq.f1x2_r = eq.f1x1_r;
eq.f1x1_r = sample;
eq.f1y2_r = eq.f1y1_r;
eq.f1y1_r = out1;
if (two_pass_filt)
{
out2 = eq.f2a0_r * out1 + eq.f2a1_r * eq.f2x1_r + eq.f2a2_r * eq.f2x2_r - eq.f2a3_r * eq.f2y1_r - eq.f2a4_r * eq.f2y2_r;
eq.f2x2_r = eq.f2x1_r;
eq.f2x1_r = out1;
eq.f2y2_r = eq.f2y1_r;
eq.f2y1_r = out2;
}
else
out2 = out1;
out10 = eq.f10a0_r * out1 + eq.f10a1_r * eq.f10x1_r + eq.f10a2_r * eq.f10x2_r - eq.f10a3_r * eq.f10y1_r - eq.f10a4_r * eq.f10y2_r;
eq.f10x2_r = eq.f10x1_r;
eq.f10x1_r = out1;
eq.f10y2_r = eq.f10y1_r;
eq.f10y1_r = out10;
if (two_pass_filt)
{
out11 = eq.f11a0_r * out10 + eq.f11a1_r * eq.f11x1_r + eq.f11a2_r * eq.f11x2_r - eq.f11a3_r * eq.f11y1_r - eq.f11a4_r * eq.f11y2_r;
eq.f11x2_r = eq.f11x1_r;
eq.f11x1_r = out10;
eq.f11y2_r = eq.f11y1_r;
eq.f11y1_r = out11;
}
else
out11 = out10;
sl = out10*Gain_all;
// hv limiter max +32767 min -32768 <- !!!! 8 hi for 16bit
if (sl > 32766)
sl = 32766;
if (sl < -32767)
sl = -32767;
return sl;
}*/

View File

@ -0,0 +1,140 @@
/* MSHV
*
* By Hrisimir Hristov - LZ2HV
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#ifndef HVRAWFILTER_H
#define HVRAWFILTER_H
#include <math.h>
#include <string.h>
//#include <stdlib.h> // zaradi malloc
//#include <QtGui>
#define M_LN2_HV 0.69314718055994530942
#define M_PI_HV 3.14159265358979323846
class HvRawFilter
{
public:
HvRawFilter(int all_gain, double min_down_frq, double max_up_frq, bool type_lhsh_lhpf);
~HvRawFilter();
double band_l(double);
//double band_r(double);
void set_rate(double);
//void filter_parm(int all_gain, double min_down_frq, double max_up_frq, bool type_lhsh_lhpf);
private:
typedef struct
{
double f1a0_l;
double f1a1_l;
double f1a2_l;
double f1a3_l;
double f1a4_l;
double f1x1_l;
double f1x2_l;
double f1y1_l;
double f1y2_l;
/*double f1a0_r;
double f1a1_r;
double f1a2_r;
double f1a3_r;
double f1a4_r;
double f1x1_r;
double f1x2_r;
double f1y1_r;
double f1y2_r;*/
/*double f2a0_l;
double f2a1_l;
double f2a2_l;
double f2a3_l;
double f2a4_l;
double f2x1_l;
double f2x2_l;
double f2y1_l;
double f2y2_l;
double f2a0_r;
double f2a1_r;
double f2a2_r;
double f2a3_r;
double f2a4_r;
double f2x1_r;
double f2x2_r;
double f2y1_r;
double f2y2_r;*/
double f10a0_l;
double f10a1_l;
double f10a2_l;
double f10a3_l;
double f10a4_l;
double f10x1_l;
double f10x2_l;
double f10y1_l;
double f10y2_l;
/*double f10a0_r;
double f10a1_r;
double f10a2_r;
double f10a3_r;
double f10a4_r;
double f10x1_r;
double f10x2_r;
double f10y1_r;
double f10y2_r;*/
/*double f11a0_l;
double f11a1_l;
double f11a2_l;
double f11a3_l;
double f11a4_l;
double f11x1_l;
double f11x2_l;
double f11y1_l;
double f11y2_l;
double f11a0_r;
double f11a1_r;
double f11a2_r;
double f11a3_r;
double f11a4_r;
double f11x1_r;
double f11x2_r;
double f11y1_r;
double f11y2_r;*/
}
EQSTATE;
EQSTATE eq;
double srate;
double a0, a1, a2, b0, b1, b2;
double omega, sn, cs;
double bandw_LPF, bandw_HPF, alpha;
double A, beta;
bool TYPE_LHSH_LHPF;
double freq1;
//double freq2;
double freq10;
//double freq11;
double Gain_all;
void dbGain1(double);
//void dbGain2(double);
void dbGain10(double);
//void dbGain11(double);
void AlldbGain(double);
//bool two_pass_filt;
};
#endif

View File

@ -0,0 +1,33 @@
// (C) Copyright John Maddock 2001 - 2002.
// 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 for most recent version.
// IBM/Aix specific config options:
#define BOOST_PLATFORM "IBM Aix"
#define BOOST_HAS_UNISTD_H
#define BOOST_HAS_NL_TYPES_H
#define BOOST_HAS_NANOSLEEP
#define BOOST_HAS_CLOCK_GETTIME
// This needs support in "boost/cstdint.hpp" exactly like FreeBSD.
// This platform has header named <inttypes.h> which includes all
// the things needed.
#define BOOST_HAS_STDINT_H
// Threading API's:
#define BOOST_HAS_PTHREADS
#define BOOST_HAS_PTHREAD_DELAY_NP
#define BOOST_HAS_SCHED_YIELD
//#define BOOST_HAS_PTHREAD_YIELD
// boilerplate code:
#include "posix_features.hpp"

View File

@ -0,0 +1,15 @@
// (C) Copyright John Maddock 2002.
// 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 for most recent version.
#define BOOST_PLATFORM "AmigaOS"
#define BOOST_DISABLE_THREADS
#define BOOST_NO_CWCHAR
#define BOOST_NO_STD_WSTRING
#define BOOST_NO_INTRINSIC_WCHAR_T

View File

@ -0,0 +1,26 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// BeOS specific config options:
#define BOOST_PLATFORM "BeOS"
#define BOOST_NO_CWCHAR
#define BOOST_NO_CWCTYPE
#define BOOST_HAS_UNISTD_H
#define BOOST_HAS_BETHREADS
#ifndef BOOST_DISABLE_THREADS
# define BOOST_HAS_THREADS
#endif
// boilerplate code:
#include "posix_features.hpp"

View File

@ -0,0 +1,30 @@
#include "crc.hpp"
#include "config.hpp"
//#define POLY10 0x08f //for 10bit crc
//#define POLY12 0xc06
#define POLY14 0x2757
//#define BOOST_NO_CXX11_CONSTEXPR
#ifdef BOOST_NO_CXX11_CONSTEXPR
//#define TRUNCATED_POLYNOMIAL10 POLY10
//#define TRUNCATED_POLYNOMIAL12 POLY12
#define TRUNCATED_POLYNOMIAL14 POLY14
#else
/*
namespace
{
unsigned long constexpr TRUNCATED_POLYNOMIAL10 = POLY10;
}
namespace
{
unsigned long constexpr TRUNCATED_POLYNOMIAL12 = POLY12;
}
*/
namespace
{
unsigned long constexpr TRUNCATED_POLYNOMIAL14 = POLY14;
}
#endif
// assumes CRC is last 16 bits of the data and is set to zero
// caller should assign the returned CRC into the message in big endian byte order

View File

@ -0,0 +1,86 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Darin Adler 2001.
// (C) Copyright Douglas Gregor 2002.
// 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 for most recent version.
// generic BSD config options:
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
#error "This platform is not BSD"
#endif
#ifdef __FreeBSD__
#define BOOST_PLATFORM "FreeBSD " BOOST_STRINGIZE(__FreeBSD__)
#elif defined(__NetBSD__)
#define BOOST_PLATFORM "NetBSD " BOOST_STRINGIZE(__NetBSD__)
#elif defined(__OpenBSD__)
#define BOOST_PLATFORM "OpenBSD " BOOST_STRINGIZE(__OpenBSD__)
#elif defined(__DragonFly__)
#define BOOST_PLATFORM "DragonFly " BOOST_STRINGIZE(__DragonFly__)
#endif
//
// is this the correct version check?
// FreeBSD has <nl_types.h> but does not
// advertise the fact in <unistd.h>:
//
#if (defined(__FreeBSD__) && (__FreeBSD__ >= 3)) || defined(__DragonFly__)
# define BOOST_HAS_NL_TYPES_H
#endif
//
// FreeBSD 3.x has pthreads support, but defines _POSIX_THREADS in <pthread.h>
// and not in <unistd.h>
//
#if (defined(__FreeBSD__) && (__FreeBSD__ <= 3))\
|| defined(__OpenBSD__) || defined(__DragonFly__)
# define BOOST_HAS_PTHREADS
#endif
//
// No wide character support in the BSD header files:
//
#if defined(__NetBSD__)
#define __NetBSD_GCC__ (__GNUC__ * 1000000 \
+ __GNUC_MINOR__ * 1000 \
+ __GNUC_PATCHLEVEL__)
// XXX - the following is required until c++config.h
// defines _GLIBCXX_HAVE_SWPRINTF and friends
// or the preprocessor conditionals are removed
// from the cwchar header.
#define _GLIBCXX_HAVE_SWPRINTF 1
#endif
#if !((defined(__FreeBSD__) && (__FreeBSD__ >= 5)) \
|| (defined(__NetBSD_GCC__) && (__NetBSD_GCC__ >= 2095003)) || defined(__DragonFly__))
# define BOOST_NO_CWCHAR
#endif
//
// The BSD <ctype.h> has macros only, no functions:
//
#if !defined(__OpenBSD__) || defined(__DragonFly__)
# define BOOST_NO_CTYPE_FUNCTIONS
#endif
//
// thread API's not auto detected:
//
#define BOOST_HAS_SCHED_YIELD
#define BOOST_HAS_NANOSLEEP
#define BOOST_HAS_GETTIMEOFDAY
#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
#define BOOST_HAS_SIGACTION
// boilerplate code:
#define BOOST_HAS_UNISTD_H
#include "posix_features.hpp"

View File

@ -0,0 +1,67 @@
// Boost config.hpp configuration header file ------------------------------//
// (C) Copyright John Maddock 2002.
// 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/config for most recent version.
// Boost config.hpp policy and rationale documentation has been moved to
// http://www.boost.org/libs/config
//
// CAUTION: This file is intended to be completely stable -
// DO NOT MODIFY THIS FILE!
//
#ifndef BOOST_CONFIG_HPP
#define BOOST_CONFIG_HPP
// if we don't have a user config, then use the default location:
#if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG)
# define BOOST_USER_CONFIG "user.hpp"
#if 0
// For dependency trackers:
# include "user.hpp"
#endif
#endif
// include it first:
#ifdef BOOST_USER_CONFIG
# include BOOST_USER_CONFIG
#endif
// if we don't have a compiler config set, try and find one:
#if !defined(BOOST_COMPILER_CONFIG) && !defined(BOOST_NO_COMPILER_CONFIG) && !defined(BOOST_NO_CONFIG)
# include "select_compiler_config.hpp"
#endif
// if we have a compiler config, include it now:
#ifdef BOOST_COMPILER_CONFIG
# include BOOST_COMPILER_CONFIG
#endif
// if we don't have a std library config set, try and find one:
#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) && defined(__cplusplus)
# include "select_stdlib_config.hpp"
#endif
// if we have a std library config, include it now:
#ifdef BOOST_STDLIB_CONFIG
# include BOOST_STDLIB_CONFIG
#endif
// if we don't have a platform config set, try and find one:
#if !defined(BOOST_PLATFORM_CONFIG) && !defined(BOOST_NO_PLATFORM_CONFIG) && !defined(BOOST_NO_CONFIG)
# include "select_platform_config.hpp"
#endif
// if we have a platform config, include it now:
#ifdef BOOST_PLATFORM_CONFIG
# include BOOST_PLATFORM_CONFIG
#endif
// get config suffix code:
#include "suffix.hpp"
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#endif // BOOST_CONFIG_HPP

View File

@ -0,0 +1,18 @@
// (C) Copyright John Maddock 2011.
// 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 for most recent version.
// SGI Irix specific config options:
#define BOOST_PLATFORM "Cray"
// boilerplate code:
#define BOOST_HAS_UNISTD_H
#include "posix_features.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,546 @@
// boost cstdint.hpp header file ------------------------------------------//
// (C) Copyright Beman Dawes 1999.
// (C) Copyright Jens Mauer 2001
// (C) Copyright John Maddock 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/integer for documentation.
// Revision History
// 31 Oct 01 use BOOST_HAS_LONG_LONG to check for "long long" (Jens M.)
// 16 Apr 01 check LONGLONG_MAX when looking for "long long" (Jens Maurer)
// 23 Jan 01 prefer "long" over "int" for int32_t and intmax_t (Jens Maurer)
// 12 Nov 00 Merged <boost/stdint.h> (Jens Maurer)
// 23 Sep 00 Added INTXX_C macro support (John Maddock).
// 22 Sep 00 Better 64-bit support (John Maddock)
// 29 Jun 00 Reimplement to avoid including stdint.h within namespace boost
// 8 Aug 99 Initial version (Beman Dawes)
#ifndef BOOST_CSTDINT_HPP
#define BOOST_CSTDINT_HPP
//
// Since we always define the INT#_C macros as per C++0x,
// define __STDC_CONSTANT_MACROS so that <stdint.h> does the right
// thing if possible, and so that the user knows that the macros
// are actually defined as per C99.
//
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif
#include "config.hpp"
//
// Note that GLIBC is a bit inconsistent about whether int64_t is defined or not
// depending upon what headers happen to have been included first...
// so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG.
// See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990
//
#if defined(BOOST_HAS_STDINT_H) \
&& (!defined(__GLIBC__) \
|| defined(__GLIBC_HAVE_LONG_LONG) \
|| (defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 17)))))
// The following #include is an implementation artifact; not part of interface.
# ifdef __hpux
// HP-UX has a vaguely nice <stdint.h> in a non-standard location
# include <inttypes.h>
# ifdef __STDC_32_MODE__
// this is triggered with GCC, because it defines __cplusplus < 199707L
# define BOOST_NO_INT64_T
# endif
# elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
# include <inttypes.h>
# else
# include <stdint.h>
// There is a bug in Cygwin two _C macros
# if defined(__STDC_CONSTANT_MACROS) && defined(__CYGWIN__)
# undef INTMAX_C
# undef UINTMAX_C
# define INTMAX_C(c) c##LL
# define UINTMAX_C(c) c##ULL
# endif
# endif
#if defined(__QNX__) && defined(__EXT_QNX)
// QNX (Dinkumware stdlib) defines these as non-standard names.
// Reflect to the standard names.
typedef ::intleast8_t int_least8_t;
typedef ::intfast8_t int_fast8_t;
typedef ::uintleast8_t uint_least8_t;
typedef ::uintfast8_t uint_fast8_t;
typedef ::intleast16_t int_least16_t;
typedef ::intfast16_t int_fast16_t;
typedef ::uintleast16_t uint_least16_t;
typedef ::uintfast16_t uint_fast16_t;
typedef ::intleast32_t int_least32_t;
typedef ::intfast32_t int_fast32_t;
typedef ::uintleast32_t uint_least32_t;
typedef ::uintfast32_t uint_fast32_t;
# ifndef BOOST_NO_INT64_T
typedef ::intleast64_t int_least64_t;
typedef ::intfast64_t int_fast64_t;
typedef ::uintleast64_t uint_least64_t;
typedef ::uintfast64_t uint_fast64_t;
# endif
#endif
namespace boost
{
using ::int8_t;
using ::int_least8_t;
using ::int_fast8_t;
using ::uint8_t;
using ::uint_least8_t;
using ::uint_fast8_t;
using ::int16_t;
using ::int_least16_t;
using ::int_fast16_t;
using ::uint16_t;
using ::uint_least16_t;
using ::uint_fast16_t;
using ::int32_t;
using ::int_least32_t;
using ::int_fast32_t;
using ::uint32_t;
using ::uint_least32_t;
using ::uint_fast32_t;
# ifndef BOOST_NO_INT64_T
using ::int64_t;
using ::int_least64_t;
using ::int_fast64_t;
using ::uint64_t;
using ::uint_least64_t;
using ::uint_fast64_t;
# endif
using ::intmax_t;
using ::uintmax_t;
} // namespace boost
#elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__) || defined(__VMS) || defined(__SOLARIS9__) || defined(__NetBSD__)
// FreeBSD and Tru64 have an <inttypes.h> that contains much of what we need.
# include <inttypes.h>
namespace boost {
using ::int8_t;
typedef int8_t int_least8_t;
typedef int8_t int_fast8_t;
using ::uint8_t;
typedef uint8_t uint_least8_t;
typedef uint8_t uint_fast8_t;
using ::int16_t;
typedef int16_t int_least16_t;
typedef int16_t int_fast16_t;
using ::uint16_t;
typedef uint16_t uint_least16_t;
typedef uint16_t uint_fast16_t;
using ::int32_t;
typedef int32_t int_least32_t;
typedef int32_t int_fast32_t;
using ::uint32_t;
typedef uint32_t uint_least32_t;
typedef uint32_t uint_fast32_t;
# ifndef BOOST_NO_INT64_T
using ::int64_t;
typedef int64_t int_least64_t;
typedef int64_t int_fast64_t;
using ::uint64_t;
typedef uint64_t uint_least64_t;
typedef uint64_t uint_fast64_t;
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
# else
typedef int32_t intmax_t;
typedef uint32_t uintmax_t;
# endif
} // namespace boost
#else // BOOST_HAS_STDINT_H
# include <boost/limits.hpp> // implementation artifact; not part of interface
# include <limits.h> // needed for limits macros
namespace boost
{
// These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit
// platforms. For other systems, they will have to be hand tailored.
//
// Because the fast types are assumed to be the same as the undecorated types,
// it may be possible to hand tailor a more efficient implementation. Such
// an optimization may be illusionary; on the Intel x86-family 386 on, for
// example, byte arithmetic and load/stores are as fast as "int" sized ones.
// 8-bit types ------------------------------------------------------------//
# if UCHAR_MAX == 0xff
typedef signed char int8_t;
typedef signed char int_least8_t;
typedef signed char int_fast8_t;
typedef unsigned char uint8_t;
typedef unsigned char uint_least8_t;
typedef unsigned char uint_fast8_t;
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
// 16-bit types -----------------------------------------------------------//
# if USHRT_MAX == 0xffff
# if defined(__crayx1)
// The Cray X1 has a 16-bit short, however it is not recommend
// for use in performance critical code.
typedef short int16_t;
typedef short int_least16_t;
typedef int int_fast16_t;
typedef unsigned short uint16_t;
typedef unsigned short uint_least16_t;
typedef unsigned int uint_fast16_t;
# else
typedef short int16_t;
typedef short int_least16_t;
typedef short int_fast16_t;
typedef unsigned short uint16_t;
typedef unsigned short uint_least16_t;
typedef unsigned short uint_fast16_t;
# endif
# elif (USHRT_MAX == 0xffffffff) && defined(__MTA__)
// On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified
// MTA / XMT does support the following non-standard integer types
typedef __short16 int16_t;
typedef __short16 int_least16_t;
typedef __short16 int_fast16_t;
typedef unsigned __short16 uint16_t;
typedef unsigned __short16 uint_least16_t;
typedef unsigned __short16 uint_fast16_t;
# elif (USHRT_MAX == 0xffffffff) && defined(CRAY)
// no 16-bit types on Cray:
typedef short int_least16_t;
typedef short int_fast16_t;
typedef unsigned short uint_least16_t;
typedef unsigned short uint_fast16_t;
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
// 32-bit types -----------------------------------------------------------//
# if UINT_MAX == 0xffffffff
typedef int int32_t;
typedef int int_least32_t;
typedef int int_fast32_t;
typedef unsigned int uint32_t;
typedef unsigned int uint_least32_t;
typedef unsigned int uint_fast32_t;
# elif (USHRT_MAX == 0xffffffff)
typedef short int32_t;
typedef short int_least32_t;
typedef short int_fast32_t;
typedef unsigned short uint32_t;
typedef unsigned short uint_least32_t;
typedef unsigned short uint_fast32_t;
# elif ULONG_MAX == 0xffffffff
typedef long int32_t;
typedef long int_least32_t;
typedef long int_fast32_t;
typedef unsigned long uint32_t;
typedef unsigned long uint_least32_t;
typedef unsigned long uint_fast32_t;
# elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__)
// Integers are 64 bits on the MTA / XMT
typedef __int32 int32_t;
typedef __int32 int_least32_t;
typedef __int32 int_fast32_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int32 uint_least32_t;
typedef unsigned __int32 uint_fast32_t;
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
// 64-bit types + intmax_t and uintmax_t ----------------------------------//
# if defined(BOOST_HAS_LONG_LONG) && \
!defined(BOOST_MSVC) && !defined(__BORLANDC__) && \
(!defined(__GLIBCPP__) || defined(_GLIBCPP_USE_LONG_LONG)) && \
(defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
# if defined(__hpux)
// HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL)
// 2**64 - 1
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
typedef ::boost::long_long_type intmax_t;
typedef ::boost::ulong_long_type uintmax_t;
typedef ::boost::long_long_type int64_t;
typedef ::boost::long_long_type int_least64_t;
typedef ::boost::long_long_type int_fast64_t;
typedef ::boost::ulong_long_type uint64_t;
typedef ::boost::ulong_long_type uint_least64_t;
typedef ::boost::ulong_long_type uint_fast64_t;
# elif ULONG_MAX != 0xffffffff
# if ULONG_MAX == 18446744073709551615 // 2**64 - 1
typedef long intmax_t;
typedef unsigned long uintmax_t;
typedef long int64_t;
typedef long int_least64_t;
typedef long int_fast64_t;
typedef unsigned long uint64_t;
typedef unsigned long uint_least64_t;
typedef unsigned long uint_fast64_t;
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# elif defined(__GNUC__) && defined(BOOST_HAS_LONG_LONG)
__extension__ typedef long long intmax_t;
__extension__ typedef unsigned long long uintmax_t;
__extension__ typedef long long int64_t;
__extension__ typedef long long int_least64_t;
__extension__ typedef long long int_fast64_t;
__extension__ typedef unsigned long long uint64_t;
__extension__ typedef unsigned long long uint_least64_t;
__extension__ typedef unsigned long long uint_fast64_t;
# elif defined(BOOST_HAS_MS_INT64)
//
// we have Borland/Intel/Microsoft __int64:
//
typedef __int64 intmax_t;
typedef unsigned __int64 uintmax_t;
typedef __int64 int64_t;
typedef __int64 int_least64_t;
typedef __int64 int_fast64_t;
typedef unsigned __int64 uint64_t;
typedef unsigned __int64 uint_least64_t;
typedef unsigned __int64 uint_fast64_t;
# else // assume no 64-bit integers
# define BOOST_NO_INT64_T
typedef int32_t intmax_t;
typedef uint32_t uintmax_t;
# endif
} // namespace boost
#endif // BOOST_HAS_STDINT_H
// intptr_t/uintptr_t are defined separately because they are optional and not universally available
#if defined(BOOST_WINDOWS) && !defined(_WIN32_WCE) && !defined(BOOST_HAS_STDINT_H)
// Older MSVC don't have stdint.h and have intptr_t/uintptr_t defined in stddef.h
#include <stddef.h>
#endif
// PGI seems to not support intptr_t/uintptr_t properly. BOOST_HAS_STDINT_H is not defined for this compiler by Boost.Config.
#if !defined(__PGIC__)
#if (defined(BOOST_WINDOWS) && !defined(_WIN32_WCE)) \
|| (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__)) \
|| defined(__CYGWIN__) \
|| defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \
|| defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(sun)
namespace boost {
using ::intptr_t;
using ::uintptr_t;
}
#define BOOST_HAS_INTPTR_T
// Clang pretends to be GCC, so it'll match this condition
#elif defined(__GNUC__) && defined(__INTPTR_TYPE__) && defined(__UINTPTR_TYPE__)
namespace boost {
typedef __INTPTR_TYPE__ intptr_t;
typedef __UINTPTR_TYPE__ uintptr_t;
}
#define BOOST_HAS_INTPTR_T
#endif
#endif // !defined(__PGIC__)
#endif // BOOST_CSTDINT_HPP
/****************************************************
Macro definition section:
Added 23rd September 2000 (John Maddock).
Modified 11th September 2001 to be excluded when
BOOST_HAS_STDINT_H is defined (John Maddock).
Modified 11th Dec 2009 to always define the
INT#_C macros if they're not already defined (John Maddock).
******************************************************/
#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && \
(!defined(INT8_C) || !defined(INT16_C) || !defined(INT32_C) || !defined(INT64_C))
//
// For the following code we get several warnings along the lines of:
//
// boost/cstdint.hpp:428:35: error: use of C99 long long integer constant
//
// So we declare this a system header to suppress these warnings.
//
#if defined(__GNUC__) && (__GNUC__ >= 4)
#pragma GCC system_header
#endif
#include <limits.h>
# define BOOST__STDC_CONSTANT_MACROS_DEFINED
# if defined(BOOST_HAS_MS_INT64)
//
// Borland/Intel/Microsoft compilers have width specific suffixes:
//
#ifndef INT8_C
# define INT8_C(value) value##i8
#endif
#ifndef INT16_C
# define INT16_C(value) value##i16
#endif
#ifndef INT32_C
# define INT32_C(value) value##i32
#endif
#ifndef INT64_C
# define INT64_C(value) value##i64
#endif
# ifdef __BORLANDC__
// Borland bug: appending ui8 makes the type a signed char
# define UINT8_C(value) static_cast<unsigned char>(value##u)
# else
# define UINT8_C(value) value##ui8
# endif
#ifndef UINT16_C
# define UINT16_C(value) value##ui16
#endif
#ifndef UINT32_C
# define UINT32_C(value) value##ui32
#endif
#ifndef UINT64_C
# define UINT64_C(value) value##ui64
#endif
#ifndef INTMAX_C
# define INTMAX_C(value) value##i64
# define UINTMAX_C(value) value##ui64
#endif
# else
// do it the old fashioned way:
// 8-bit types ------------------------------------------------------------//
# if (UCHAR_MAX == 0xff) && !defined(INT8_C)
# define INT8_C(value) static_cast<boost::int8_t>(value)
# define UINT8_C(value) static_cast<boost::uint8_t>(value##u)
# endif
// 16-bit types -----------------------------------------------------------//
# if (USHRT_MAX == 0xffff) && !defined(INT16_C)
# define INT16_C(value) static_cast<boost::int16_t>(value)
# define UINT16_C(value) static_cast<boost::uint16_t>(value##u)
# endif
// 32-bit types -----------------------------------------------------------//
#ifndef INT32_C
# if (UINT_MAX == 0xffffffff)
# define INT32_C(value) value
# define UINT32_C(value) value##u
# elif ULONG_MAX == 0xffffffff
# define INT32_C(value) value##L
# define UINT32_C(value) value##uL
# endif
#endif
// 64-bit types + intmax_t and uintmax_t ----------------------------------//
#ifndef INT64_C
# if defined(BOOST_HAS_LONG_LONG) && \
(defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_ULLONG_MAX) || defined(_LLONG_MAX))
# if defined(__hpux)
// HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
# define INT64_C(value) value##LL
# define UINT64_C(value) value##uLL
# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || \
(defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || \
(defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) || \
(defined(_ULLONG_MAX) && _ULLONG_MAX == 18446744073709551615ULL) || \
(defined(_LLONG_MAX) && _LLONG_MAX == 9223372036854775807LL)
# define INT64_C(value) value##LL
# define UINT64_C(value) value##uLL
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# elif ULONG_MAX != 0xffffffff
# if ULONG_MAX == 18446744073709551615U // 2**64 - 1
# define INT64_C(value) value##L
# define UINT64_C(value) value##uL
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# elif defined(BOOST_HAS_LONG_LONG)
// Usual macros not defined, work things out for ourselves:
# if(~0uLL == 18446744073709551615ULL)
# define INT64_C(value) value##LL
# define UINT64_C(value) value##uLL
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# ifdef BOOST_NO_INT64_T
# define INTMAX_C(value) INT32_C(value)
# define UINTMAX_C(value) UINT32_C(value)
# else
# define INTMAX_C(value) INT64_C(value)
# define UINTMAX_C(value) UINT64_C(value)
# endif
#endif
# endif // Borland/Microsoft specific width suffixes
#endif // INT#_C macros.

View File

@ -0,0 +1,58 @@
// (C) Copyright John Maddock 2001 - 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 for most recent version.
// cygwin specific config options:
#define BOOST_PLATFORM "Cygwin"
#define BOOST_HAS_DIRENT_H
#define BOOST_HAS_LOG1P
#define BOOST_HAS_EXPM1
//
// Threading API:
// See if we have POSIX threads, if we do use them, otherwise
// revert to native Win threads.
#define BOOST_HAS_UNISTD_H
#include <unistd.h>
#if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS)
# define BOOST_HAS_PTHREADS
# define BOOST_HAS_SCHED_YIELD
# define BOOST_HAS_GETTIMEOFDAY
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# define BOOST_HAS_SIGACTION
#else
# if !defined(BOOST_HAS_WINTHREADS)
# define BOOST_HAS_WINTHREADS
# endif
# define BOOST_HAS_FTIME
#endif
//
// find out if we have a stdint.h, there should be a better way to do this:
//
#include <sys/types.h>
#ifdef _STDINT_H
#define BOOST_HAS_STDINT_H
#endif
/// Cygwin has no fenv.h
#define BOOST_NO_FENV_H
// boilerplate code:
#include "posix_features.hpp"
//
// Cygwin lies about XSI conformance, there is no nl_types.h:
//
#ifdef BOOST_HAS_NL_TYPES_H
# undef BOOST_HAS_NL_TYPES_H
#endif

View File

@ -0,0 +1,209 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Jens Maurer 2001.
// (C) Copyright Peter Dimov 2001.
// (C) Copyright David Abrahams 2002.
// (C) Copyright Guillaume Melquiond 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 for most recent version.
// Dinkumware standard library config:
#if !defined(_YVALS) && !defined(_CPPLIB_VER)
#include "utility.hpp"
#if !defined(_YVALS) && !defined(_CPPLIB_VER)
#error This is not the Dinkumware lib!
#endif
#endif
#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306)
// full dinkumware 3.06 and above
// fully conforming provided the compiler supports it:
# if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(__BORLANDC__) && !defined(_STD) && !(defined(__ICC) && (__ICC >= 700)) // can be defined in yvals.h
# define BOOST_NO_STDC_NAMESPACE
# endif
# if !(defined(_HAS_MEMBER_TEMPLATES_REBIND) && (_HAS_MEMBER_TEMPLATES_REBIND+0 > 0)) && !(defined(_MSC_VER) && (_MSC_VER > 1300)) && defined(BOOST_MSVC)
# define BOOST_NO_STD_ALLOCATOR
# endif
# define BOOST_HAS_PARTIAL_STD_ALLOCATOR
# if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
// if this lib version is set up for vc6 then there is no std::use_facet:
# define BOOST_NO_STD_USE_FACET
# define BOOST_HAS_TWO_ARG_USE_FACET
// C lib functions aren't in namespace std either:
# define BOOST_NO_STDC_NAMESPACE
// and nor is <exception>
# define BOOST_NO_EXCEPTION_STD_NAMESPACE
# endif
// There's no numeric_limits<long long> support unless _LONGLONG is defined:
# if !defined(_LONGLONG) && (_CPPLIB_VER <= 310)
# define BOOST_NO_MS_INT64_NUMERIC_LIMITS
# endif
// 3.06 appears to have (non-sgi versions of) <hash_set> & <hash_map>,
// and no <slist> at all
#else
# define BOOST_MSVC_STD_ITERATOR 1
# define BOOST_NO_STD_ITERATOR
# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
# define BOOST_NO_STD_ALLOCATOR
# define BOOST_NO_STDC_NAMESPACE
# define BOOST_NO_STD_USE_FACET
# define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN
# define BOOST_HAS_MACRO_USE_FACET
# ifndef _CPPLIB_VER
// Updated Dinkum library defines this, and provides
// its own min and max definitions, as does MTA version.
# ifndef __MTA__
# define BOOST_NO_STD_MIN_MAX
# endif
# define BOOST_NO_MS_INT64_NUMERIC_LIMITS
# endif
#endif
//
// std extension namespace is stdext for vc7.1 and later,
// the same applies to other compilers that sit on top
// of vc7.1 (Intel and Comeau):
//
#if defined(_MSC_VER) && (_MSC_VER >= 1310) && !defined(__BORLANDC__)
# define BOOST_STD_EXTENSION_NAMESPACE stdext
#endif
#if (defined(_MSC_VER) && (_MSC_VER <= 1300) && !defined(__BORLANDC__)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306)
// if we're using a dinkum lib that's
// been configured for VC6/7 then there is
// no iterator traits (true even for icl)
# define BOOST_NO_STD_ITERATOR_TRAITS
#endif
#if defined(__ICL) && (__ICL < 800) && defined(_CPPLIB_VER) && (_CPPLIB_VER <= 310)
// Intel C++ chokes over any non-trivial use of <locale>
// this may be an overly restrictive define, but regex fails without it:
# define BOOST_NO_STD_LOCALE
#endif
// Fix for VC++ 8.0 on up ( I do not have a previous version to test )
// or clang-cl. If exceptions are off you must manually include the
// <exception> header before including the <typeinfo> header. Admittedly
// trying to use Boost libraries or the standard C++ libraries without
// exception support is not suggested but currently clang-cl ( v 3.4 )
// does not support exceptions and must be compiled with exceptions off.
#if !_HAS_EXCEPTIONS && ((defined(BOOST_MSVC) && BOOST_MSVC >= 1400) || (defined(__clang__) && defined(_MSC_VER)))
#include <exception>
#endif
#include <typeinfo>
#if ( (!_HAS_EXCEPTIONS && !defined(__ghs__)) || (!_HAS_NAMESPACE && defined(__ghs__)) ) && !defined(__TI_COMPILER_VERSION__) && !defined(__VISUALDSPVERSION__)
# define BOOST_NO_STD_TYPEINFO
#endif
// C++0x headers implemented in 520 (as shipped by Microsoft)
//
#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520
# define BOOST_NO_CXX11_HDR_ARRAY
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_RANDOM
# define BOOST_NO_CXX11_HDR_REGEX
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_SMART_PTR
#endif
#if ((!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_CXX11_HDR_TUPLE)) \
&& (!defined(_CPPLIB_VER) || _CPPLIB_VER < 610)
# define BOOST_NO_CXX11_HDR_TUPLE
#endif
// C++0x headers implemented in 540 (as shipped by Microsoft)
//
#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 540
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
#endif
// C++0x headers implemented in 610 (as shipped by Microsoft)
//
#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 610
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_ALLOCATOR
// 540 has std::align but it is not a conforming implementation
# define BOOST_NO_CXX11_STD_ALIGN
#endif
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif (__cplusplus < 201402) && !defined(_MSC_VER)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#elif !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
// C++14 features
#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650)
# define BOOST_NO_CXX14_STD_EXCHANGE
#endif
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650)
# define BOOST_NO_CXX17_STD_INVOKE
#endif
#if defined(BOOST_INTEL) && (BOOST_INTEL <= 1400)
// Intel's compiler can't handle this header yet:
# define BOOST_NO_CXX11_HDR_ATOMIC
#endif
// 520..610 have std::addressof, but it doesn't support functions
//
#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 650
# define BOOST_NO_CXX11_ADDRESSOF
#endif
// Bug specific to VC14,
// See https://connect.microsoft.com/VisualStudio/feedback/details/1348277/link-error-when-using-std-codecvt-utf8-utf16-char16-t
// and discussion here: http://blogs.msdn.com/b/vcblog/archive/2014/11/12/visual-studio-2015-preview-now-available.aspx?PageIndex=2
#if defined(_CPPLIB_VER) && (_CPPLIB_VER == 650)
# define BOOST_NO_CXX11_HDR_CODECVT
#endif
#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 650)
// If _HAS_AUTO_PTR_ETC is defined to 0, std::auto_ptr is not available.
// See https://www.visualstudio.com/en-us/news/vs2015-vs.aspx#C++
// and http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
# if defined(_HAS_AUTO_PTR_ETC) && (_HAS_AUTO_PTR_ETC == 0)
# define BOOST_NO_AUTO_PTR
# endif
#endif
#ifdef _CPPLIB_VER
# define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER
#else
# define BOOST_DINKUMWARE_STDLIB 1
#endif
#ifdef _CPPLIB_VER
# define BOOST_STDLIB "Dinkumware standard library version " BOOST_STRINGIZE(_CPPLIB_VER)
#else
# define BOOST_STDLIB "Dinkumware standard library version 1.x"
#endif

View File

@ -0,0 +1,328 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Darin Adler 2001 - 2002.
// (C) Copyright Jens Maurer 2001 - 2002.
// (C) Copyright Beman Dawes 2001 - 2003.
// (C) Copyright Douglas Gregor 2002.
// (C) Copyright David Abrahams 2002 - 2003.
// (C) Copyright Synge Todo 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 for most recent version.
// GNU C++ compiler setup.
//
// Define BOOST_GCC so we know this is "real" GCC and not some pretender:
//
#define BOOST_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#if !defined(__CUDACC__)
#define BOOST_GCC BOOST_GCC_VERSION
#endif
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
# define BOOST_GCC_CXX11
#endif
#if __GNUC__ == 3
# if defined (__PATHSCALE__)
# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
# define BOOST_NO_IS_ABSTRACT
# endif
# if __GNUC_MINOR__ < 4
# define BOOST_NO_IS_ABSTRACT
# endif
# define BOOST_NO_CXX11_EXTERN_TEMPLATE
#endif
#if __GNUC__ < 4
//
// All problems to gcc-3.x and earlier here:
//
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
# ifdef __OPEN64__
# define BOOST_NO_IS_ABSTRACT
# endif
#endif
// GCC prior to 3.4 had #pragma once too but it didn't work well with filesystem links
#if BOOST_GCC_VERSION >= 30400
#define BOOST_HAS_PRAGMA_ONCE
#endif
#if BOOST_GCC_VERSION < 40400
// Previous versions of GCC did not completely implement value-initialization:
// GCC Bug 30111, "Value-initialization of POD base class doesn't initialize
// members", reported by Jonathan Wakely in 2006,
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 (fixed for GCC 4.4)
// GCC Bug 33916, "Default constructor fails to initialize array members",
// reported by Michael Elizabeth Chastain in 2007,
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 (fixed for GCC 4.2.4)
// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
#endif
#if !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
# define BOOST_NO_EXCEPTIONS
#endif
//
// Threading support: Turn this on unconditionally here (except for
// those platforms where we can know for sure). It will get turned off again
// later if no threading API is detected.
//
#if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__)
# define BOOST_HAS_THREADS
#endif
//
// gcc has "long long"
// Except on Darwin with standard compliance enabled (-pedantic)
// Apple gcc helpfully defines this macro we can query
//
#if !defined(__DARWIN_NO_LONG_LONG)
# define BOOST_HAS_LONG_LONG
#endif
//
// gcc implements the named return value optimization since version 3.1
//
#define BOOST_HAS_NRVO
// Branch prediction hints
#define BOOST_LIKELY(x) __builtin_expect(x, 1)
#define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
//
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
//
#if __GNUC__ >= 4
# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__)
// All Win32 development environments, including 64-bit Windows and MinGW, define
// _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment,
// so does not define _WIN32 or its variants.
# define BOOST_HAS_DECLSPEC
# define BOOST_SYMBOL_EXPORT __attribute__((__dllexport__))
# define BOOST_SYMBOL_IMPORT __attribute__((__dllimport__))
# else
# define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
# define BOOST_SYMBOL_IMPORT
# endif
# define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
#else
// config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
# define BOOST_SYMBOL_EXPORT
#endif
//
// RTTI and typeinfo detection is possible post gcc-4.3:
//
#if BOOST_GCC_VERSION > 40300
# ifndef __GXX_RTTI
# ifndef BOOST_NO_TYPEID
# define BOOST_NO_TYPEID
# endif
# ifndef BOOST_NO_RTTI
# define BOOST_NO_RTTI
# endif
# endif
#endif
//
// Recent GCC versions have __int128 when in 64-bit mode.
//
// We disable this if the compiler is really nvcc with C++03 as it
// doesn't actually support __int128 as of CUDA_VERSION=7500
// even though it defines __SIZEOF_INT128__.
// See https://svn.boost.org/trac/boost/ticket/8048
// https://svn.boost.org/trac/boost/ticket/11852
// Only re-enable this for nvcc if you're absolutely sure
// of the circumstances under which it's supported:
//
#if defined(__CUDACC__)
# if defined(BOOST_GCC_CXX11)
# define BOOST_NVCC_CXX11
# else
# define BOOST_NVCC_CXX03
# endif
#endif
#if defined(__SIZEOF_INT128__) && !defined(BOOST_NVCC_CXX03)
# define BOOST_HAS_INT128
#endif
//
// Recent GCC versions have a __float128 native type, we need to
// include a std lib header to detect this - not ideal, but we'll
// be including <cstddef> later anyway when we select the std lib.
//
// Nevertheless, as of CUDA 7.5, using __float128 with the host
// compiler in pre-C++11 mode is still not supported.
// See https://svn.boost.org/trac/boost/ticket/11852
//
#ifdef __cplusplus
#include <cstddef>
#else
#include <stddef.h>
#endif
#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(BOOST_NVCC_CXX03)
# define BOOST_HAS_FLOAT128
#endif
// C++0x features in 4.3.n and later
//
#if (BOOST_GCC_VERSION >= 40300) && defined(BOOST_GCC_CXX11)
// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
// passed on the command line, which in turn defines
// __GXX_EXPERIMENTAL_CXX0X__.
# define BOOST_HAS_DECLTYPE
# define BOOST_HAS_RVALUE_REFS
# define BOOST_HAS_STATIC_ASSERT
# define BOOST_HAS_VARIADIC_TMPL
#else
# define BOOST_NO_CXX11_DECLTYPE
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
# define BOOST_NO_CXX11_RVALUE_REFERENCES
# define BOOST_NO_CXX11_STATIC_ASSERT
#endif
// C++0x features in 4.4.n and later
//
#if (BOOST_GCC_VERSION < 40400) || !defined(BOOST_GCC_CXX11)
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
# define BOOST_NO_CXX11_CHAR16_T
# define BOOST_NO_CXX11_CHAR32_T
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
# define BOOST_NO_CXX11_INLINE_NAMESPACES
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
#endif
#if BOOST_GCC_VERSION < 40500
# define BOOST_NO_SFINAE_EXPR
#endif
// GCC 4.5 forbids declaration of defaulted functions in private or protected sections
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 5) || !defined(BOOST_GCC_CXX11)
# define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS
#endif
// C++0x features in 4.5.0 and later
//
#if (BOOST_GCC_VERSION < 40500) || !defined(BOOST_GCC_CXX11)
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
# define BOOST_NO_CXX11_LAMBDAS
# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
# define BOOST_NO_CXX11_RAW_LITERALS
# define BOOST_NO_CXX11_UNICODE_LITERALS
#endif
// C++0x features in 4.5.1 and later
//
#if (BOOST_GCC_VERSION < 40501) || !defined(BOOST_GCC_CXX11)
// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_CXX11_SCOPED_ENUMS before 4.5.1
// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064
# define BOOST_NO_CXX11_SCOPED_ENUMS
#endif
// C++0x features in 4.6.n and later
//
#if (BOOST_GCC_VERSION < 40600) || !defined(BOOST_GCC_CXX11)
#define BOOST_NO_CXX11_CONSTEXPR
#define BOOST_NO_CXX11_NOEXCEPT
#define BOOST_NO_CXX11_NULLPTR
#define BOOST_NO_CXX11_RANGE_BASED_FOR
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
#endif
// C++0x features in 4.7.n and later
//
#if (BOOST_GCC_VERSION < 40700) || !defined(BOOST_GCC_CXX11)
# define BOOST_NO_CXX11_FINAL
# define BOOST_NO_CXX11_TEMPLATE_ALIASES
# define BOOST_NO_CXX11_USER_DEFINED_LITERALS
# define BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
#endif
// C++0x features in 4.8.n and later
//
#if (BOOST_GCC_VERSION < 40800) || !defined(BOOST_GCC_CXX11)
# define BOOST_NO_CXX11_ALIGNAS
# define BOOST_NO_CXX11_THREAD_LOCAL
#endif
// C++0x features in 4.8.1 and later
//
#if (BOOST_GCC_VERSION < 40801) || !defined(BOOST_GCC_CXX11)
# define BOOST_NO_CXX11_DECLTYPE_N3276
# define BOOST_NO_CXX11_REF_QUALIFIERS
# define BOOST_NO_CXX14_BINARY_LITERALS
#endif
// C++14 features in 4.9.0 and later
//
#if (BOOST_GCC_VERSION < 40900) || (__cplusplus < 201300)
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
# define BOOST_NO_CXX14_DECLTYPE_AUTO
# if !((BOOST_GCC_VERSION >= 40801) && (BOOST_GCC_VERSION < 40900) && defined(BOOST_GCC_CXX11))
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
# endif
#endif
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
#endif
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
# define BOOST_NO_CXX14_CONSTEXPR
#endif
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
#endif
//
// Unused attribute:
#if __GNUC__ >= 4
# define BOOST_ATTRIBUTE_UNUSED __attribute__((__unused__))
#endif
//
// __builtin_unreachable:
#if BOOST_GCC_VERSION >= 40800
#define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable();
#endif
#ifndef BOOST_COMPILER
# define BOOST_COMPILER "GNU C++ version " __VERSION__
#endif
// ConceptGCC compiler:
// http://www.generic-programming.org/software/ConceptGCC/
#ifdef __GXX_CONCEPTS__
# define BOOST_HAS_CONCEPTS
# define BOOST_COMPILER "ConceptGCC version " __VERSION__
#endif
// versions check:
// we don't know gcc prior to version 3.30:
#if (BOOST_GCC_VERSION< 30300)
# error "Compiler not configured - please reconfigure"
#endif
//
// last known and checked version is 4.9:
#if (BOOST_GCC_VERSION > 40900)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# else
// we don't emit warnings here anymore since there are no defect macros defined for
// gcc post 3.4, so any failures are gcc regressions...
//# warning "Unknown compiler version - please run the configure tests and report the results"
# endif
#endif

View File

@ -0,0 +1,96 @@
// (C) Copyright John Maddock 2006.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// GCC-XML C++ compiler setup:
# if !defined(__GCCXML_GNUC__) || ((__GCCXML_GNUC__ <= 3) && (__GCCXML_GNUC_MINOR__ <= 3))
# define BOOST_NO_IS_ABSTRACT
# endif
//
// Threading support: Turn this on unconditionally here (except for
// those platforms where we can know for sure). It will get turned off again
// later if no threading API is detected.
//
#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(linux) && !defined(__linux) && !defined(__linux__)
# define BOOST_HAS_THREADS
#endif
//
// gcc has "long long"
//
#define BOOST_HAS_LONG_LONG
// C++0x features:
//
# define BOOST_NO_CXX11_CONSTEXPR
# define BOOST_NO_CXX11_NULLPTR
# define BOOST_NO_CXX11_TEMPLATE_ALIASES
# define BOOST_NO_CXX11_DECLTYPE
# define BOOST_NO_CXX11_DECLTYPE_N3276
# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
# define BOOST_NO_CXX11_RVALUE_REFERENCES
# define BOOST_NO_CXX11_STATIC_ASSERT
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
# define BOOST_NO_CXX11_VARIADIC_MACROS
# define BOOST_NO_CXX11_AUTO_DECLARATIONS
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
# define BOOST_NO_CXX11_CHAR16_T
# define BOOST_NO_CXX11_CHAR32_T
# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
# define BOOST_NO_CXX11_DELETED_FUNCTIONS
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_SCOPED_ENUMS
# define BOOST_NO_SFINAE_EXPR
# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
# define BOOST_NO_CXX11_LAMBDAS
# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
# define BOOST_NO_CXX11_RANGE_BASED_FOR
# define BOOST_NO_CXX11_RAW_LITERALS
# define BOOST_NO_CXX11_UNICODE_LITERALS
# define BOOST_NO_CXX11_NOEXCEPT
# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
# define BOOST_NO_CXX11_USER_DEFINED_LITERALS
# define BOOST_NO_CXX11_ALIGNAS
# define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
# define BOOST_NO_CXX11_INLINE_NAMESPACES
# define BOOST_NO_CXX11_REF_QUALIFIERS
# define BOOST_NO_CXX11_FINAL
# define BOOST_NO_CXX11_THREAD_LOCAL
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
#endif
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
# define BOOST_NO_CXX14_BINARY_LITERALS
#endif
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
# define BOOST_NO_CXX14_CONSTEXPR
#endif
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
# define BOOST_NO_CXX14_DECLTYPE_AUTO
#endif
#if (__cplusplus < 201304) // There's no SD6 check for this....
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
#endif
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
#endif
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
#endif
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
#endif
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
#endif
#define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__

View File

@ -0,0 +1,87 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Jens Maurer 2001 - 2003.
// (C) Copyright David Abrahams 2002.
// (C) Copyright Toon Knapen 2003.
// (C) Copyright Boris Gubenko 2006 - 2007.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// hpux specific config options:
#define BOOST_PLATFORM "HP-UX"
// In principle, HP-UX has a nice <stdint.h> under the name <inttypes.h>
// However, it has the following problem:
// Use of UINT32_C(0) results in "0u l" for the preprocessed source
// (verifyable with gcc 2.95.3)
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__HP_aCC)
# define BOOST_HAS_STDINT_H
#endif
#if !(defined(__HP_aCC) || !defined(_INCLUDE__STDC_A1_SOURCE))
# define BOOST_NO_SWPRINTF
#endif
#if defined(__HP_aCC) && !defined(_INCLUDE__STDC_A1_SOURCE)
# define BOOST_NO_CWCTYPE
#endif
#if defined(__GNUC__)
# if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
// GNU C on HP-UX does not support threads (checked up to gcc 3.3)
# define BOOST_DISABLE_THREADS
# elif !defined(BOOST_DISABLE_THREADS)
// threads supported from gcc-3.3 onwards:
# define BOOST_HAS_THREADS
# define BOOST_HAS_PTHREADS
# endif
#elif defined(__HP_aCC) && !defined(BOOST_DISABLE_THREADS)
# define BOOST_HAS_PTHREADS
#endif
// boilerplate code:
#define BOOST_HAS_UNISTD_H
#include "posix_features.hpp"
// the following are always available:
#ifndef BOOST_HAS_GETTIMEOFDAY
# define BOOST_HAS_GETTIMEOFDAY
#endif
#ifndef BOOST_HAS_SCHED_YIELD
# define BOOST_HAS_SCHED_YIELD
#endif
#ifndef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
#endif
#ifndef BOOST_HAS_NL_TYPES_H
# define BOOST_HAS_NL_TYPES_H
#endif
#ifndef BOOST_HAS_NANOSLEEP
# define BOOST_HAS_NANOSLEEP
#endif
#ifndef BOOST_HAS_GETTIMEOFDAY
# define BOOST_HAS_GETTIMEOFDAY
#endif
#ifndef BOOST_HAS_DIRENT_H
# define BOOST_HAS_DIRENT_H
#endif
#ifndef BOOST_HAS_CLOCK_GETTIME
# define BOOST_HAS_CLOCK_GETTIME
#endif
#ifndef BOOST_HAS_SIGACTION
# define BOOST_HAS_SIGACTION
#endif
#ifndef BOOST_HAS_NRVO
# ifndef __parisc
# define BOOST_HAS_NRVO
# endif
#endif
#ifndef BOOST_HAS_LOG1P
# define BOOST_HAS_LOG1P
#endif
#ifndef BOOST_HAS_EXPM1
# define BOOST_HAS_EXPM1
#endif

View File

@ -0,0 +1,262 @@
// boost integer.hpp header file -------------------------------------------//
// Copyright Beman Dawes and Daryle Walker 1999. 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/integer for documentation.
// Revision History
// 22 Sep 01 Added value-based integer templates. (Daryle Walker)
// 01 Apr 01 Modified to use new <boost/limits.hpp> header. (John Maddock)
// 30 Jul 00 Add typename syntax fix (Jens Maurer)
// 28 Aug 99 Initial version
#ifndef BOOST_INTEGER_HPP
#define BOOST_INTEGER_HPP
#include "integer_fwd.hpp" // self include
#include "integer_traits.hpp" // for boost::::boost::integer_traits
#include "limits.hpp" // for ::std::numeric_limits
#include "cstdint.hpp" // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T
#include "static_assert.hpp"
//
// We simply cannot include this header on gcc without getting copious warnings of the kind:
//
// boost/integer.hpp:77:30: warning: use of C99 long long integer constant
//
// And yet there is no other reasonable implementation, so we declare this a system header
// to suppress these warnings.
//
#if defined(__GNUC__) && (__GNUC__ >= 4)
#pragma GCC system_header
#endif
namespace boost
{
// Helper templates ------------------------------------------------------//
// fast integers from least integers
// int_fast_t<> works correctly for unsigned too, in spite of the name.
template< typename LeastInt >
struct int_fast_t
{
typedef LeastInt fast;
typedef fast type;
}; // imps may specialize
namespace detail{
// convert category to type
template< int Category > struct int_least_helper {}; // default is empty
template< int Category > struct uint_least_helper {}; // default is empty
// specializatons: 1=long, 2=int, 3=short, 4=signed char,
// 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char
// no specializations for 0 and 5: requests for a type > long are in error
#ifdef BOOST_HAS_LONG_LONG
template<> struct int_least_helper<1> { typedef boost::long_long_type least; };
#elif defined(BOOST_HAS_MS_INT64)
template<> struct int_least_helper<1> { typedef __int64 least; };
#endif
template<> struct int_least_helper<2> { typedef long least; };
template<> struct int_least_helper<3> { typedef int least; };
template<> struct int_least_helper<4> { typedef short least; };
template<> struct int_least_helper<5> { typedef signed char least; };
#ifdef BOOST_HAS_LONG_LONG
template<> struct uint_least_helper<1> { typedef boost::ulong_long_type least; };
#elif defined(BOOST_HAS_MS_INT64)
template<> struct uint_least_helper<1> { typedef unsigned __int64 least; };
#endif
template<> struct uint_least_helper<2> { typedef unsigned long least; };
template<> struct uint_least_helper<3> { typedef unsigned int least; };
template<> struct uint_least_helper<4> { typedef unsigned short least; };
template<> struct uint_least_helper<5> { typedef unsigned char least; };
template <int Bits>
struct exact_signed_base_helper{};
template <int Bits>
struct exact_unsigned_base_helper{};
template <> struct exact_signed_base_helper<sizeof(signed char)* CHAR_BIT> { typedef signed char exact; };
template <> struct exact_unsigned_base_helper<sizeof(unsigned char)* CHAR_BIT> { typedef unsigned char exact; };
#if USHRT_MAX != UCHAR_MAX
template <> struct exact_signed_base_helper<sizeof(short)* CHAR_BIT> { typedef short exact; };
template <> struct exact_unsigned_base_helper<sizeof(unsigned short)* CHAR_BIT> { typedef unsigned short exact; };
#endif
#if UINT_MAX != USHRT_MAX
template <> struct exact_signed_base_helper<sizeof(int)* CHAR_BIT> { typedef int exact; };
template <> struct exact_unsigned_base_helper<sizeof(unsigned int)* CHAR_BIT> { typedef unsigned int exact; };
#endif
#if ULONG_MAX != UINT_MAX && ( !defined __TI_COMPILER_VERSION__ || \
( __TI_COMPILER_VERSION__ >= 7000000 && !defined __TI_40BIT_LONG__ ) )
template <> struct exact_signed_base_helper<sizeof(long)* CHAR_BIT> { typedef long exact; };
template <> struct exact_unsigned_base_helper<sizeof(unsigned long)* CHAR_BIT> { typedef unsigned long exact; };
#endif
#if defined(BOOST_HAS_LONG_LONG) &&\
((defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX)) ||\
(defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX != ULONG_MAX)) ||\
(defined(ULONGLONG_MAX) && (ULONGLONG_MAX != ULONG_MAX)) ||\
(defined(_ULLONG_MAX) && (_ULLONG_MAX != ULONG_MAX)))
template <> struct exact_signed_base_helper<sizeof(boost::long_long_type)* CHAR_BIT> { typedef boost::long_long_type exact; };
template <> struct exact_unsigned_base_helper<sizeof(boost::ulong_long_type)* CHAR_BIT> { typedef boost::ulong_long_type exact; };
#endif
} // namespace detail
// integer templates specifying number of bits ---------------------------//
// signed
template< int Bits > // bits (including sign) required
struct int_t : public boost::detail::exact_signed_base_helper<Bits>
{
BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::intmax_t) * CHAR_BIT),
"No suitable signed integer type with the requested number of bits is available.");
typedef typename boost::detail::int_least_helper
<
#ifdef BOOST_HAS_LONG_LONG
(Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
#else
1 +
#endif
(Bits-1 <= ::std::numeric_limits<long>::digits) +
(Bits-1 <= ::std::numeric_limits<int>::digits) +
(Bits-1 <= ::std::numeric_limits<short>::digits) +
(Bits-1 <= ::std::numeric_limits<signed char>::digits)
>::least least;
typedef typename int_fast_t<least>::type fast;
};
// unsigned
template< int Bits > // bits required
struct uint_t : public boost::detail::exact_unsigned_base_helper<Bits>
{
BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::uintmax_t) * CHAR_BIT),
"No suitable unsigned integer type with the requested number of bits is available.");
#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T)
// It's really not clear why this workaround should be needed... shrug I guess! JM
BOOST_STATIC_CONSTANT(int, s =
6 +
(Bits <= ::std::numeric_limits<unsigned long>::digits) +
(Bits <= ::std::numeric_limits<unsigned int>::digits) +
(Bits <= ::std::numeric_limits<unsigned short>::digits) +
(Bits <= ::std::numeric_limits<unsigned char>::digits));
typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least;
#else
typedef typename boost::detail::uint_least_helper
<
#ifdef BOOST_HAS_LONG_LONG
(Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
#else
1 +
#endif
(Bits <= ::std::numeric_limits<unsigned long>::digits) +
(Bits <= ::std::numeric_limits<unsigned int>::digits) +
(Bits <= ::std::numeric_limits<unsigned short>::digits) +
(Bits <= ::std::numeric_limits<unsigned char>::digits)
>::least least;
#endif
typedef typename int_fast_t<least>::type fast;
// int_fast_t<> works correctly for unsigned too, in spite of the name.
};
// integer templates specifying extreme value ----------------------------//
// signed
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::long_long_type MaxValue > // maximum value to require support
#else
template< long MaxValue > // maximum value to require support
#endif
struct int_max_value_t
{
typedef typename boost::detail::int_least_helper
<
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG)
(MaxValue <= ::boost::integer_traits<boost::long_long_type>::const_max) +
#else
1 +
#endif
(MaxValue <= ::boost::integer_traits<long>::const_max) +
(MaxValue <= ::boost::integer_traits<int>::const_max) +
(MaxValue <= ::boost::integer_traits<short>::const_max) +
(MaxValue <= ::boost::integer_traits<signed char>::const_max)
>::least least;
typedef typename int_fast_t<least>::type fast;
};
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::long_long_type MinValue > // minimum value to require support
#else
template< long MinValue > // minimum value to require support
#endif
struct int_min_value_t
{
typedef typename boost::detail::int_least_helper
<
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG)
(MinValue >= ::boost::integer_traits<boost::long_long_type>::const_min) +
#else
1 +
#endif
(MinValue >= ::boost::integer_traits<long>::const_min) +
(MinValue >= ::boost::integer_traits<int>::const_min) +
(MinValue >= ::boost::integer_traits<short>::const_min) +
(MinValue >= ::boost::integer_traits<signed char>::const_min)
>::least least;
typedef typename int_fast_t<least>::type fast;
};
// unsigned
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::ulong_long_type MaxValue > // minimum value to require support
#else
template< unsigned long MaxValue > // minimum value to require support
#endif
struct uint_value_t
{
#if (defined(__BORLANDC__) || defined(__CODEGEAR__))
// It's really not clear why this workaround should be needed... shrug I guess! JM
#if defined(BOOST_NO_INTEGRAL_INT64_T)
BOOST_STATIC_CONSTANT(unsigned, which =
1 +
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
#else // BOOST_NO_INTEGRAL_INT64_T
BOOST_STATIC_CONSTANT(unsigned, which =
1 +
(MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
typedef typename detail::uint_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
#endif // BOOST_NO_INTEGRAL_INT64_T
#else
typedef typename boost::detail::uint_least_helper
<
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
(MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
#else
1 +
#endif
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
(MaxValue <= ::boost::integer_traits<unsigned char>::const_max)
>::least least;
#endif
typedef typename int_fast_t<least>::type fast;
};
} // namespace boost
#endif // BOOST_INTEGER_HPP

View File

@ -0,0 +1,187 @@
// Boost integer_fwd.hpp header file ---------------------------------------//
// (C) Copyright Dave Abrahams and Daryle Walker 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/integer for documentation.
#ifndef BOOST_INTEGER_FWD_HPP
#define BOOST_INTEGER_FWD_HPP
#include <climits> // for UCHAR_MAX, etc.
#include <cstddef> // for std::size_t
#include "config.hpp" // for BOOST_NO_INTRINSIC_WCHAR_T
#include "limits.hpp" // for std::numeric_limits
#include "cstdint.hpp" // For intmax_t
namespace boost
{
#ifdef BOOST_NO_INTEGRAL_INT64_T
typedef unsigned long static_log2_argument_type;
typedef int static_log2_result_type;
typedef long static_min_max_signed_type;
typedef unsigned long static_min_max_unsigned_type;
#else
typedef boost::uintmax_t static_min_max_unsigned_type;
typedef boost::intmax_t static_min_max_signed_type;
typedef boost::uintmax_t static_log2_argument_type;
typedef int static_log2_result_type;
#endif
// From <boost/cstdint.hpp> ------------------------------------------------//
// Only has typedefs or using statements, with #conditionals
// From <boost/integer_traits.hpp> -----------------------------------------//
template < class T >
class integer_traits;
template < >
class integer_traits< bool >;
template < >
class integer_traits< char >;
template < >
class integer_traits< signed char >;
template < >
class integer_traits< unsigned char >;
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template < >
class integer_traits< wchar_t >;
#endif
template < >
class integer_traits< short >;
template < >
class integer_traits< unsigned short >;
template < >
class integer_traits< int >;
template < >
class integer_traits< unsigned int >;
template < >
class integer_traits< long >;
template < >
class integer_traits< unsigned long >;
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template < >
class integer_traits< ::boost::long_long_type>;
template < >
class integer_traits< ::boost::ulong_long_type >;
#elif !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_MS_INT64)
template < >
class integer_traits<__int64>;
template < >
class integer_traits<unsigned __int64>;
#endif
// From <boost/integer.hpp> ------------------------------------------------//
template < typename LeastInt >
struct int_fast_t;
template< int Bits >
struct int_t;
template< int Bits >
struct uint_t;
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::long_long_type MaxValue > // maximum value to require support
#else
template< long MaxValue > // maximum value to require support
#endif
struct int_max_value_t;
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::long_long_type MinValue > // minimum value to require support
#else
template< long MinValue > // minimum value to require support
#endif
struct int_min_value_t;
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template< boost::ulong_long_type MaxValue > // maximum value to require support
#else
template< unsigned long MaxValue > // maximum value to require support
#endif
struct uint_value_t;
// From <boost/integer/integer_mask.hpp> -----------------------------------//
template < std::size_t Bit >
struct high_bit_mask_t;
template < std::size_t Bits >
struct low_bits_mask_t;
template < >
struct low_bits_mask_t< ::std::numeric_limits<unsigned char>::digits >;
// From <boost/integer/static_log2.hpp> ------------------------------------//
template <static_log2_argument_type Value >
struct static_log2;
template <> struct static_log2<0u>;
// From <boost/integer/static_min_max.hpp> ---------------------------------//
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_min;
template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_max;
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_min;
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_max;
// From <boost/integer/common_factor_ct.hpp>
#ifdef BOOST_NO_INTEGRAL_INT64_T
typedef unsigned long static_gcd_type;
#else
typedef boost::uintmax_t static_gcd_type;
#endif
template < static_gcd_type Value1, static_gcd_type Value2 >
struct static_gcd;
template < static_gcd_type Value1, static_gcd_type Value2 >
struct static_lcm;
// From <boost/integer/common_factor_rt.hpp>
template < typename IntegerType >
class gcd_evaluator;
template < typename IntegerType >
class lcm_evaluator;
} // namespace boost
#endif // BOOST_INTEGER_FWD_HPP

View File

@ -0,0 +1,256 @@
/* boost integer_traits.hpp header file
*
* Copyright Jens Maurer 2000
* 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)
*
* $Id$
*
* Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
*/
// See http://www.boost.org/libs/integer for documentation.
#ifndef BOOST_INTEGER_TRAITS_HPP
#define BOOST_INTEGER_TRAITS_HPP
#include "config.hpp"
#include "limits.hpp"
// These are an implementation detail and not part of the interface
#include <limits.h>
// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it,
// and some may have <wchar.h> but not <cwchar> ...
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun) || defined(__QNX__))
#include <wchar.h>
#endif
//
// We simply cannot include this header on gcc without getting copious warnings of the kind:
//
// ../../../boost/integer_traits.hpp:164:66: warning: use of C99 long long integer constant
//
// And yet there is no other reasonable implementation, so we declare this a system header
// to suppress these warnings.
//
#if defined(__GNUC__) && (__GNUC__ >= 4)
#pragma GCC system_header
#endif
namespace boost {
template<class T>
class integer_traits : public std::numeric_limits<T>
{
public:
BOOST_STATIC_CONSTANT(bool, is_integral = false);
};
namespace detail {
template<class T, T min_val, T max_val>
class integer_traits_base
{
public:
BOOST_STATIC_CONSTANT(bool, is_integral = true);
BOOST_STATIC_CONSTANT(T, const_min = min_val);
BOOST_STATIC_CONSTANT(T, const_max = max_val);
};
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
// A definition is required even for integral static constants
template<class T, T min_val, T max_val>
const bool integer_traits_base<T, min_val, max_val>::is_integral;
template<class T, T min_val, T max_val>
const T integer_traits_base<T, min_val, max_val>::const_min;
template<class T, T min_val, T max_val>
const T integer_traits_base<T, min_val, max_val>::const_max;
#endif
} // namespace detail
template<>
class integer_traits<bool>
: public std::numeric_limits<bool>,
public detail::integer_traits_base<bool, false, true>
{ };
template<>
class integer_traits<char>
: public std::numeric_limits<char>,
public detail::integer_traits_base<char, CHAR_MIN, CHAR_MAX>
{ };
template<>
class integer_traits<signed char>
: public std::numeric_limits<signed char>,
public detail::integer_traits_base<signed char, SCHAR_MIN, SCHAR_MAX>
{ };
template<>
class integer_traits<unsigned char>
: public std::numeric_limits<unsigned char>,
public detail::integer_traits_base<unsigned char, 0, UCHAR_MAX>
{ };
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<>
class integer_traits<wchar_t>
: public std::numeric_limits<wchar_t>,
// Don't trust WCHAR_MIN and WCHAR_MAX with Mac OS X's native
// library: they are wrong!
#if defined(WCHAR_MIN) && defined(WCHAR_MAX) && !defined(__APPLE__)
public detail::integer_traits_base<wchar_t, WCHAR_MIN, WCHAR_MAX>
#elif defined(__BORLANDC__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__BEOS__) && defined(__GNUC__))
// No WCHAR_MIN and WCHAR_MAX, whar_t is short and unsigned:
public detail::integer_traits_base<wchar_t, 0, 0xffff>
#elif (defined(__sgi) && (!defined(__SGI_STL_PORT) || __SGI_STL_PORT < 0x400))\
|| (defined __APPLE__)\
|| (defined(__OpenBSD__) && defined(__GNUC__))\
|| (defined(__NetBSD__) && defined(__GNUC__))\
|| (defined(__FreeBSD__) && defined(__GNUC__))\
|| (defined(__DragonFly__) && defined(__GNUC__))\
|| (defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 3) && !defined(__SGI_STL_PORT))
// No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as int.
// - SGI MIPSpro with native library
// - gcc 3.x on HP-UX
// - Mac OS X with native library
// - gcc on FreeBSD, OpenBSD and NetBSD
public detail::integer_traits_base<wchar_t, INT_MIN, INT_MAX>
#else
#error No WCHAR_MIN and WCHAR_MAX present, please adjust integer_traits<> for your compiler.
#endif
{ };
#endif // BOOST_NO_INTRINSIC_WCHAR_T
template<>
class integer_traits<short>
: public std::numeric_limits<short>,
public detail::integer_traits_base<short, SHRT_MIN, SHRT_MAX>
{ };
template<>
class integer_traits<unsigned short>
: public std::numeric_limits<unsigned short>,
public detail::integer_traits_base<unsigned short, 0, USHRT_MAX>
{ };
template<>
class integer_traits<int>
: public std::numeric_limits<int>,
public detail::integer_traits_base<int, INT_MIN, INT_MAX>
{ };
template<>
class integer_traits<unsigned int>
: public std::numeric_limits<unsigned int>,
public detail::integer_traits_base<unsigned int, 0, UINT_MAX>
{ };
template<>
class integer_traits<long>
: public std::numeric_limits<long>,
public detail::integer_traits_base<long, LONG_MIN, LONG_MAX>
{ };
template<>
class integer_traits<unsigned long>
: public std::numeric_limits<unsigned long>,
public detail::integer_traits_base<unsigned long, 0, ULONG_MAX>
{ };
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T)
#if defined(ULLONG_MAX) && defined(BOOST_HAS_LONG_LONG)
template<>
class integer_traits< ::boost::long_long_type>
: public std::numeric_limits< ::boost::long_long_type>,
public detail::integer_traits_base< ::boost::long_long_type, LLONG_MIN, LLONG_MAX>
{ };
template<>
class integer_traits< ::boost::ulong_long_type>
: public std::numeric_limits< ::boost::ulong_long_type>,
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULLONG_MAX>
{ };
#elif defined(ULONG_LONG_MAX) && defined(BOOST_HAS_LONG_LONG)
template<>
class integer_traits< ::boost::long_long_type> : public std::numeric_limits< ::boost::long_long_type>, public detail::integer_traits_base< ::boost::long_long_type, LONG_LONG_MIN, LONG_LONG_MAX>{ };
template<>
class integer_traits< ::boost::ulong_long_type>
: public std::numeric_limits< ::boost::ulong_long_type>,
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONG_LONG_MAX>
{ };
#elif defined(ULONGLONG_MAX) && defined(BOOST_HAS_LONG_LONG)
template<>
class integer_traits< ::boost::long_long_type>
: public std::numeric_limits< ::boost::long_long_type>,
public detail::integer_traits_base< ::boost::long_long_type, LONGLONG_MIN, LONGLONG_MAX>
{ };
template<>
class integer_traits< ::boost::ulong_long_type>
: public std::numeric_limits< ::boost::ulong_long_type>,
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONGLONG_MAX>
{ };
#elif defined(_LLONG_MAX) && defined(_C2) && defined(BOOST_HAS_LONG_LONG)
template<>
class integer_traits< ::boost::long_long_type>
: public std::numeric_limits< ::boost::long_long_type>,
public detail::integer_traits_base< ::boost::long_long_type, -_LLONG_MAX - _C2, _LLONG_MAX>
{ };
template<>
class integer_traits< ::boost::ulong_long_type>
: public std::numeric_limits< ::boost::ulong_long_type>,
public detail::integer_traits_base< ::boost::ulong_long_type, 0, _ULLONG_MAX>
{ };
#elif defined(BOOST_HAS_LONG_LONG)
//
// we have long long but no constants, this happens for example with gcc in -ansi mode,
// we'll just have to work out the values for ourselves (assumes 2's compliment representation):
//
template<>
class integer_traits< ::boost::long_long_type>
: public std::numeric_limits< ::boost::long_long_type>,
public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1)), ~(1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1))>
{ };
template<>
class integer_traits< ::boost::ulong_long_type>
: public std::numeric_limits< ::boost::ulong_long_type>,
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ~0uLL>
{ };
#elif defined(BOOST_HAS_MS_INT64)
template<>
class integer_traits< __int64>
: public std::numeric_limits< __int64>,
public detail::integer_traits_base< __int64, _I64_MIN, _I64_MAX>
{ };
template<>
class integer_traits< unsigned __int64>
: public std::numeric_limits< unsigned __int64>,
public detail::integer_traits_base< unsigned __int64, 0, _UI64_MAX>
{ };
#endif
#endif
} // namespace boost
#endif /* BOOST_INTEGER_TRAITS_HPP */

View File

@ -0,0 +1,31 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Jens Maurer 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 for most recent version.
// SGI Irix specific config options:
#define BOOST_PLATFORM "SGI Irix"
#define BOOST_NO_SWPRINTF
//
// these are not auto detected by POSIX feature tests:
//
#define BOOST_HAS_GETTIMEOFDAY
#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
#ifdef __GNUC__
// GNU C on IRIX does not support threads (checked up to gcc 3.3)
# define BOOST_DISABLE_THREADS
#endif
// boilerplate code:
#define BOOST_HAS_UNISTD_H
#include "posix_features.hpp"

View File

@ -0,0 +1,90 @@
// (C) Copyright John Maddock 2002 - 2003.
// (C) Copyright Jens Maurer 2002 - 2003.
// (C) Copyright Beman Dawes 2002 - 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 for most recent version.
// Comeau STL:
#if !defined(__LIBCOMO__)
# include "utility.hpp"
# if !defined(__LIBCOMO__)
# error "This is not the Comeau STL!"
# endif
#endif
//
// std::streambuf<wchar_t> is non-standard
// NOTE: versions of libcomo prior to beta28 have octal version numbering,
// e.g. version 25 is 21 (dec)
#if __LIBCOMO_VERSION__ <= 22
# define BOOST_NO_STD_WSTREAMBUF
#endif
#if (__LIBCOMO_VERSION__ <= 31) && defined(_WIN32)
#define BOOST_NO_SWPRINTF
#endif
#if __LIBCOMO_VERSION__ >= 31
# define BOOST_HAS_HASH
# define BOOST_HAS_SLIST
#endif
// C++0x headers not yet implemented
//
# define BOOST_NO_CXX11_HDR_ARRAY
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RANDOM
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_REGEX
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_SMART_PTR
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_STD_ALIGN
# define BOOST_NO_CXX11_ADDRESSOF
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus < 201402
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#else
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
// C++14 features
# define BOOST_NO_CXX14_STD_EXCHANGE
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
//
// Intrinsic type_traits support.
// The SGI STL has it's own __type_traits class, which
// has intrinsic compiler support with SGI's compilers.
// Whatever map SGI style type traits to boost equivalents:
//
#define BOOST_HAS_SGI_TYPE_TRAITS
#define BOOST_STDLIB "Comeau standard library " BOOST_STRINGIZE(__LIBCOMO_VERSION__)

View File

@ -0,0 +1,113 @@
// (C) Copyright Christopher Jefferson 2011.
// 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 for most recent version.
// config for libc++
// Might need more in here later.
#if !defined(_LIBCPP_VERSION)
# include <ciso646>
# if !defined(_LIBCPP_VERSION)
# error "This is not libc++!"
# endif
#endif
#define BOOST_STDLIB "libc++ version " BOOST_STRINGIZE(_LIBCPP_VERSION)
#define BOOST_HAS_THREADS
#ifdef _LIBCPP_HAS_NO_VARIADICS
# define BOOST_NO_CXX11_HDR_TUPLE
#endif
// BOOST_NO_CXX11_ALLOCATOR should imply no support for the C++11
// allocator model. The C++11 allocator model requires a conforming
// std::allocator_traits which is only possible with C++11 template
// aliases since members rebind_alloc and rebind_traits require it.
#if defined(_LIBCPP_HAS_NO_TEMPLATE_ALIASES)
# define BOOST_NO_CXX11_ALLOCATOR
#endif
#if __cplusplus < 201103
//
// These two appear to be somewhat useable in C++03 mode, there may be others...
//
//# define BOOST_NO_CXX11_HDR_ARRAY
//# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RANDOM
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_REGEX
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_SMART_PTR
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
# define BOOST_NO_CXX11_STD_ALIGN
# define BOOST_NO_CXX11_ADDRESSOF
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_FUTURE
#elif _LIBCPP_VERSION < 3700
//
// These appear to be unusable/incomplete so far:
//
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_FUTURE
#endif
#if _LIBCPP_VERSION < 3700
// libc++ uses a non-standard messages_base
#define BOOST_NO_STD_MESSAGES
#endif
// C++14 features
#if (_LIBCPP_VERSION < 3700) || (__cplusplus <= 201402L)
# define BOOST_NO_CXX14_STD_EXCHANGE
#endif
// C++17 features
#if (_LIBCPP_VERSION < 3700) || (__cplusplus <= 201402L)
# define BOOST_NO_CXX17_STD_INVOKE
#endif
#if (_LIBCPP_VERSION < 4000) || (__cplusplus <= 201402L)
# define BOOST_NO_CXX17_STD_APPLY
#endif
#if (_LIBCPP_VERSION <= 1101) && !defined(BOOST_NO_CXX11_THREAD_LOCAL)
// This is a bit of a sledgehammer, because really it's just libc++abi that has no
// support for thread_local, leading to linker errors such as
// "undefined reference to `__cxa_thread_atexit'". It is fixed in the
// most recent releases of libc++abi though...
# define BOOST_NO_CXX11_THREAD_LOCAL
#endif
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus <= 201103
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#elif __cplusplus < 201402
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
// --- end ---

View File

@ -0,0 +1,314 @@
// (C) Copyright John Maddock 2001.
// (C) Copyright Jens Maurer 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// config for libstdc++ v3
// not much to go in here:
#define BOOST_GNU_STDLIB 1
#ifdef __GLIBCXX__
#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCXX__)
#else
#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__)
#endif
#if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T)
# define BOOST_NO_CWCHAR
# define BOOST_NO_CWCTYPE
# define BOOST_NO_STD_WSTRING
# define BOOST_NO_STD_WSTREAMBUF
#endif
#if defined(__osf__) && !defined(_REENTRANT) \
&& ( defined(_GLIBCXX_HAVE_GTHR_DEFAULT) || defined(_GLIBCPP_HAVE_GTHR_DEFAULT) )
// GCC 3 on Tru64 forces the definition of _REENTRANT when any std lib header
// file is included, therefore for consistency we define it here as well.
# define _REENTRANT
#endif
#ifdef __GLIBCXX__ // gcc 3.4 and greater:
# if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
|| defined(_GLIBCXX__PTHREADS) \
|| defined(_GLIBCXX_HAS_GTHREADS) \
|| defined(_WIN32) \
|| defined(_AIX) \
|| defined(__HAIKU__)
//
// If the std lib has thread support turned on, then turn it on in Boost
// as well. We do this because some gcc-3.4 std lib headers define _REENTANT
// while others do not...
//
# define BOOST_HAS_THREADS
# else
# define BOOST_DISABLE_THREADS
# endif
#elif defined(__GLIBCPP__) \
&& !defined(_GLIBCPP_HAVE_GTHR_DEFAULT) \
&& !defined(_GLIBCPP__PTHREADS)
// disable thread support if the std lib was built single threaded:
# define BOOST_DISABLE_THREADS
#endif
#if (defined(linux) || defined(__linux) || defined(__linux__)) && defined(__arm__) && defined(_GLIBCPP_HAVE_GTHR_DEFAULT)
// linux on arm apparently doesn't define _REENTRANT
// so just turn on threading support whenever the std lib is thread safe:
# define BOOST_HAS_THREADS
#endif
#if !defined(_GLIBCPP_USE_LONG_LONG) \
&& !defined(_GLIBCXX_USE_LONG_LONG)\
&& defined(BOOST_HAS_LONG_LONG)
// May have been set by compiler/*.hpp, but "long long" without library
// support is useless.
# undef BOOST_HAS_LONG_LONG
#endif
// Apple doesn't seem to reliably defined a *unix* macro
#if !defined(CYGWIN) && ( defined(__unix__) \
|| defined(__unix) \
|| defined(unix) \
|| defined(__APPLE__) \
|| defined(__APPLE) \
|| defined(APPLE))
# include <unistd.h>
#endif
#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0
# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx
# define BOOST_HAS_SLIST
# define BOOST_HAS_HASH
# define BOOST_SLIST_HEADER <ext/slist>
# if !defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
# define BOOST_HASH_SET_HEADER <ext/hash_set>
# define BOOST_HASH_MAP_HEADER <ext/hash_map>
# else
# define BOOST_HASH_SET_HEADER <backward/hash_set>
# define BOOST_HASH_MAP_HEADER <backward/hash_map>
# endif
#endif
//
// Decide whether we have C++11 support turned on:
//
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103)
# define BOOST_LIBSTDCXX11
#endif
//
// Decide which version of libstdc++ we have, normally
// stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly
// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++
// developers. He also commented:
//
// "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in
// GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305.
// Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support
// than any release in the 4.2 series."
//
// Another resource for understanding stdlibc++ features is:
// http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x
//
// However, using the GCC version number fails when the compiler is clang since this
// only ever claims to emulate GCC-4.2, see https://svn.boost.org/trac/boost/ticket/7473
// for a long discussion on this issue. What we can do though is use clang's __has_include
// to detect the presence of a C++11 header that was introduced with a specific GCC release.
// We still have to be careful though as many such headers were buggy and/or incomplete when
// first introduced, so we only check for headers that were fully featured from day 1, and then
// use that to infer the underlying GCC version:
//
#ifdef __clang__
#if __has_include(<experimental/memory_resource>)
# define BOOST_LIBSTDCXX_VERSION 60100
#elif __has_include(<experimental/any>)
# define BOOST_LIBSTDCXX_VERSION 50100
#elif __has_include(<shared_mutex>)
# define BOOST_LIBSTDCXX_VERSION 40900
#elif __has_include(<ext/cmath>)
# define BOOST_LIBSTDCXX_VERSION 40800
#elif __has_include(<scoped_allocator>)
# define BOOST_LIBSTDCXX_VERSION 40700
#elif __has_include(<typeindex>)
# define BOOST_LIBSTDCXX_VERSION 40600
#elif __has_include(<future>)
# define BOOST_LIBSTDCXX_VERSION 40500
#elif __has_include(<ratio>)
# define BOOST_LIBSTDCXX_VERSION 40400
#elif __has_include(<array>)
# define BOOST_LIBSTDCXX_VERSION 40300
#endif
//
// GCC 4.8 and 9 add working versions of <atomic> and <regex> respectively.
// However, we have no test for these as the headers were present but broken
// in early GCC versions.
//
#endif
#if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) && (__cplusplus >= 201103L)
//
// Oracle Solaris compiler uses it's own verison of libstdc++ but doesn't
// set __GNUC__
//
#if __SUNPRO_CC >= 0x5140
#define BOOST_LIBSTDCXX_VERSION 50100
#else
#define BOOST_LIBSTDCXX_VERSION 40800
#endif
#endif
#if !defined(BOOST_LIBSTDCXX_VERSION)
# define BOOST_LIBSTDCXX_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
// std::auto_ptr isn't provided with _GLIBCXX_DEPRECATED=0 (GCC 4.5 and earlier)
// or _GLIBCXX_USE_DEPRECATED=0 (GCC 4.6 and later).
#if defined(BOOST_LIBSTDCXX11)
# if BOOST_LIBSTDCXX_VERSION < 40600
# if !_GLIBCXX_DEPRECATED
# define BOOST_NO_AUTO_PTR
# endif
# elif !_GLIBCXX_USE_DEPRECATED
# define BOOST_NO_AUTO_PTR
# endif
#endif
// C++0x headers in GCC 4.3.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40300) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_HDR_ARRAY
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
#endif
// C++0x headers in GCC 4.4.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40400) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_SMART_PTR
#else
# define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
# define BOOST_HAS_TR1_COMPLEX_OVERLOADS
#endif
// C++0x features in GCC 4.5.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40500) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_RANDOM
#endif
// C++0x features in GCC 4.6.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40600) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_ADDRESSOF
#endif
// C++0x features in GCC 4.7.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40700) || !defined(BOOST_LIBSTDCXX11)
// Note that although <chrono> existed prior to 4.7, "steady_clock" is spelled "monotonic_clock"
// so 4.7.0 is the first truely conforming one.
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_ALLOCATOR
#endif
// C++0x features in GCC 4.8.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40800) || !defined(BOOST_LIBSTDCXX11)
// Note that although <atomic> existed prior to gcc 4.8 it was largely unimplemented for many types:
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_HDR_THREAD
#endif
// C++0x features in GCC 4.9.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
// Although <regex> is present and compilable against, the actual implementation is not functional
// even for the simplest patterns such as "\d" or "[0-9]". This is the case at least in gcc up to 4.8, inclusively.
# define BOOST_NO_CXX11_HDR_REGEX
#endif
#if (BOOST_LIBSTDCXX_VERSION < 40900) || (__cplusplus <= 201103)
# define BOOST_NO_CXX14_STD_EXCHANGE
#endif
#if defined(__clang_major__) && ((__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 7)))
// As of clang-3.6, libstdc++ header <atomic> throws up errors with clang:
# define BOOST_NO_CXX11_HDR_ATOMIC
#endif
//
// C++0x features in GCC 5.1 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 50100) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_STD_ALIGN
#endif
//
// C++17 features in GCC 6.1 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 60100) || (__cplusplus <= 201402L)
# define BOOST_NO_CXX17_STD_INVOKE
#endif
#if (BOOST_LIBSTDCXX_VERSION < 70100) || (__cplusplus <= 201402L)
# define BOOST_NO_CXX17_STD_APPLY
#endif
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus <= 201103
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#elif __cplusplus < 201402 || (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
//
// Headers not present on Solaris with the Oracle compiler:
#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
#define BOOST_NO_CXX11_HDR_FUTURE
#define BOOST_NO_CXX11_HDR_FORWARD_LIST
#define BOOST_NO_CXX11_HDR_ATOMIC
// shared_ptr is present, but is not convertible to bool
// which causes all kinds of problems especially in Boost.Thread
// but probably elsewhere as well.
#define BOOST_NO_CXX11_SMART_PTR
#endif
#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1))
// Headers not always available:
# ifndef BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# endif
# ifndef BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_MUTEX
# endif
# ifndef BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_THREAD
# endif
# ifndef BOOST_NO_CXX14_HDR_SHARED_MUTEX
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
# endif
#endif
#if (!defined(_GTHREAD_USE_MUTEX_TIMEDLOCK) || (_GTHREAD_USE_MUTEX_TIMEDLOCK == 0)) && !defined(BOOST_NO_CXX11_HDR_MUTEX)
// Timed mutexes are not always available:
# define BOOST_NO_CXX11_HDR_MUTEX
#endif
// --- end ---

View File

@ -0,0 +1,146 @@
// (C) Copyright John maddock 1999.
// (C) David Abrahams 2002. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// use this header as a workaround for missing <limits>
// See http://www.boost.org/libs/compatibility/index.html for documentation.
#ifndef BOOST_LIMITS
#define BOOST_LIMITS
#include "config.hpp"
#ifdef BOOST_NO_LIMITS
# error "There is no std::numeric_limits suppport available."
#else
# include <limits>
#endif
#if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \
|| (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS))
// Add missing specializations for numeric_limits:
#ifdef BOOST_HAS_MS_INT64
# define BOOST_LLT __int64
# define BOOST_ULLT unsigned __int64
#else
# define BOOST_LLT ::boost::long_long_type
# define BOOST_ULLT ::boost::ulong_long_type
#endif
#include <climits> // for CHAR_BIT
namespace std
{
template<>
class numeric_limits<BOOST_LLT>
{
public:
BOOST_STATIC_CONSTANT(bool, is_specialized = true);
#ifdef BOOST_HAS_MS_INT64
static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x8000000000000000i64; }
static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x7FFFFFFFFFFFFFFFi64; }
#elif defined(LLONG_MAX)
static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MIN; }
static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MAX; }
#elif defined(LONGLONG_MAX)
static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MIN; }
static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MAX; }
#else
static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); }
static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~(min)(); }
#endif
BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
BOOST_STATIC_CONSTANT(bool, is_signed = true);
BOOST_STATIC_CONSTANT(bool, is_integer = true);
BOOST_STATIC_CONSTANT(bool, is_exact = true);
BOOST_STATIC_CONSTANT(int, radix = 2);
static BOOST_LLT epsilon() throw() { return 0; };
static BOOST_LLT round_error() throw() { return 0; };
BOOST_STATIC_CONSTANT(int, min_exponent = 0);
BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
BOOST_STATIC_CONSTANT(int, max_exponent = 0);
BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
BOOST_STATIC_CONSTANT(bool, has_infinity = false);
BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
BOOST_STATIC_CONSTANT(bool, has_denorm = false);
BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
static BOOST_LLT infinity() throw() { return 0; };
static BOOST_LLT quiet_NaN() throw() { return 0; };
static BOOST_LLT signaling_NaN() throw() { return 0; };
static BOOST_LLT denorm_min() throw() { return 0; };
BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
BOOST_STATIC_CONSTANT(bool, is_bounded = true);
BOOST_STATIC_CONSTANT(bool, is_modulo = true);
BOOST_STATIC_CONSTANT(bool, traps = false);
BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
};
template<>
class numeric_limits<BOOST_ULLT>
{
public:
BOOST_STATIC_CONSTANT(bool, is_specialized = true);
#ifdef BOOST_HAS_MS_INT64
static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0ui64; }
static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0xFFFFFFFFFFFFFFFFui64; }
#elif defined(ULLONG_MAX) && defined(ULLONG_MIN)
static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MIN; }
static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MAX; }
#elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN)
static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MIN; }
static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MAX; }
#else
static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0uLL; }
static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~0uLL; }
#endif
BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT);
BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000);
BOOST_STATIC_CONSTANT(bool, is_signed = false);
BOOST_STATIC_CONSTANT(bool, is_integer = true);
BOOST_STATIC_CONSTANT(bool, is_exact = true);
BOOST_STATIC_CONSTANT(int, radix = 2);
static BOOST_ULLT epsilon() throw() { return 0; };
static BOOST_ULLT round_error() throw() { return 0; };
BOOST_STATIC_CONSTANT(int, min_exponent = 0);
BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
BOOST_STATIC_CONSTANT(int, max_exponent = 0);
BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
BOOST_STATIC_CONSTANT(bool, has_infinity = false);
BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
BOOST_STATIC_CONSTANT(bool, has_denorm = false);
BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
static BOOST_ULLT infinity() throw() { return 0; };
static BOOST_ULLT quiet_NaN() throw() { return 0; };
static BOOST_ULLT signaling_NaN() throw() { return 0; };
static BOOST_ULLT denorm_min() throw() { return 0; };
BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
BOOST_STATIC_CONSTANT(bool, is_bounded = true);
BOOST_STATIC_CONSTANT(bool, is_modulo = true);
BOOST_STATIC_CONSTANT(bool, traps = false);
BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
};
}
#endif
#endif

View File

@ -0,0 +1,105 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Jens Maurer 2001 - 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 for most recent version.
// linux specific config options:
#define BOOST_PLATFORM "linux"
// make sure we have __GLIBC_PREREQ if available at all
#ifdef __cplusplus
#include <cstdlib>
#else
#include <stdlib.h>
#endif
//
// <stdint.h> added to glibc 2.1.1
// We can only test for 2.1 though:
//
#if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)))
// <stdint.h> defines int64_t unconditionally, but <sys/types.h> defines
// int64_t only if __GNUC__. Thus, assume a fully usable <stdint.h>
// only when using GCC.
# if defined __GNUC__
# define BOOST_HAS_STDINT_H
# endif
#endif
#if defined(__LIBCOMO__)
//
// como on linux doesn't have std:: c functions:
// NOTE: versions of libcomo prior to beta28 have octal version numbering,
// e.g. version 25 is 21 (dec)
//
# if __LIBCOMO_VERSION__ <= 20
# define BOOST_NO_STDC_NAMESPACE
# endif
# if __LIBCOMO_VERSION__ <= 21
# define BOOST_NO_SWPRINTF
# endif
#endif
//
// If glibc is past version 2 then we definitely have
// gettimeofday, earlier versions may or may not have it:
//
#if defined(__GLIBC__) && (__GLIBC__ >= 2)
# define BOOST_HAS_GETTIMEOFDAY
#endif
#ifdef __USE_POSIX199309
# define BOOST_HAS_NANOSLEEP
#endif
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
// __GLIBC_PREREQ is available since 2.1.2
// swprintf is available since glibc 2.2.0
# if !__GLIBC_PREREQ(2,2) || (!defined(__USE_ISOC99) && !defined(__USE_UNIX98))
# define BOOST_NO_SWPRINTF
# endif
#else
# define BOOST_NO_SWPRINTF
#endif
// boilerplate code:
#define BOOST_HAS_UNISTD_H
#include "posix_features.hpp"
#if defined(__USE_GNU) && !defined(__ANDROID__) && !defined(ANDROID)
#define BOOST_HAS_PTHREAD_YIELD
#endif
#ifndef __GNUC__
//
// if the compiler is not gcc we still need to be able to parse
// the GNU system headers, some of which (mainly <stdint.h>)
// use GNU specific extensions:
//
# ifndef __extension__
# define __extension__
# endif
# ifndef __const__
# define __const__ const
# endif
# ifndef __volatile__
# define __volatile__ volatile
# endif
# ifndef __signed__
# define __signed__ signed
# endif
# ifndef __typeof__
# define __typeof__ typeof
# endif
# ifndef __inline__
# define __inline__ inline
# endif
#endif

View File

@ -0,0 +1,87 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Darin Adler 2001 - 2002.
// (C) Copyright Bill Kempf 2002.
// 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 for most recent version.
// Mac OS specific config options:
#define BOOST_PLATFORM "Mac OS"
#if __MACH__ && !defined(_MSL_USING_MSL_C)
// Using the Mac OS X system BSD-style C library.
# ifndef BOOST_HAS_UNISTD_H
# define BOOST_HAS_UNISTD_H
# endif
//
// Begin by including our boilerplate code for POSIX
// feature detection, this is safe even when using
// the MSL as Metrowerks supply their own <unistd.h>
// to replace the platform-native BSD one. G++ users
// should also always be able to do this on MaxOS X.
//
# include "posix_features.hpp"
# ifndef BOOST_HAS_STDINT_H
# define BOOST_HAS_STDINT_H
# endif
//
// BSD runtime has pthreads, sigaction, sched_yield and gettimeofday,
// of these only pthreads are advertised in <unistd.h>, so set the
// other options explicitly:
//
# define BOOST_HAS_SCHED_YIELD
# define BOOST_HAS_GETTIMEOFDAY
# define BOOST_HAS_SIGACTION
# if (__GNUC__ < 3) && !defined( __APPLE_CC__)
// GCC strange "ignore std" mode works better if you pretend everything
// is in the std namespace, for the most part.
# define BOOST_NO_STDC_NAMESPACE
# endif
# if (__GNUC__ >= 4)
// Both gcc and intel require these.
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# define BOOST_HAS_NANOSLEEP
# endif
#else
// Using the MSL C library.
// We will eventually support threads in non-Carbon builds, but we do
// not support this yet.
# if ( defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON ) || ( defined(TARGET_CARBON) && TARGET_CARBON )
# if !defined(BOOST_HAS_PTHREADS)
// MPTasks support is deprecated/removed from Boost:
//# define BOOST_HAS_MPTASKS
# elif ( __dest_os == __mac_os_x )
// We are doing a Carbon/Mach-O/MSL build which has pthreads, but only the
// gettimeofday and no posix.
# define BOOST_HAS_GETTIMEOFDAY
# endif
#ifdef BOOST_HAS_PTHREADS
# define BOOST_HAS_THREADS
#endif
// The remote call manager depends on this.
# define BOOST_BIND_ENABLE_PASCAL
# endif
#endif

View File

@ -0,0 +1,76 @@
// (C) Copyright Jens Maurer 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// Modena C++ standard library (comes with KAI C++)
#if !defined(MSIPL_COMPILE_H)
# include "utility.hpp"
# if !defined(__MSIPL_COMPILE_H)
# error "This is not the Modena C++ library!"
# endif
#endif
#ifndef MSIPL_NL_TYPES
#define BOOST_NO_STD_MESSAGES
#endif
#ifndef MSIPL_WCHART
#define BOOST_NO_STD_WSTRING
#endif
// C++0x headers not yet implemented
//
# define BOOST_NO_CXX11_HDR_ARRAY
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RANDOM
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_REGEX
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_SMART_PTR
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_STD_ALIGN
# define BOOST_NO_CXX11_ADDRESSOF
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus < 201402
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#else
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
// C++14 features
# define BOOST_NO_CXX14_STD_EXCHANGE
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
#define BOOST_STDLIB "Modena C++ standard library"

View File

@ -0,0 +1,95 @@
// (C) Copyright John Maddock 2001.
// (C) Copyright Darin Adler 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// Metrowerks standard library:
#ifndef __MSL_CPP__
# include "utility.hpp"
# ifndef __MSL_CPP__
# error This is not the MSL standard library!
# endif
#endif
#if __MSL_CPP__ >= 0x6000 // Pro 6
# define BOOST_HAS_HASH
# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks
#endif
#define BOOST_HAS_SLIST
#if __MSL_CPP__ < 0x6209
# define BOOST_NO_STD_MESSAGES
#endif
// check C lib version for <stdint.h>
#include <cstddef>
#if defined(__MSL__) && (__MSL__ >= 0x5000)
# define BOOST_HAS_STDINT_H
# if !defined(__PALMOS_TRAPS__)
# define BOOST_HAS_UNISTD_H
# endif
// boilerplate code:
# include <boost/config/posix_features.hpp>
#endif
#if defined(_MWMT) || _MSL_THREADSAFE
# define BOOST_HAS_THREADS
#endif
#ifdef _MSL_NO_EXPLICIT_FUNC_TEMPLATE_ARG
# define BOOST_NO_STD_USE_FACET
# define BOOST_HAS_TWO_ARG_USE_FACET
#endif
// C++0x headers not yet implemented
//
# define BOOST_NO_CXX11_HDR_ARRAY
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RANDOM
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_REGEX
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_SMART_PTR
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_STD_ALIGN
# define BOOST_NO_CXX11_ADDRESSOF
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus < 201402
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#else
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
// C++14 features
# define BOOST_NO_CXX14_STD_EXCHANGE
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
#define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__)

View File

@ -0,0 +1,95 @@
// (C) Copyright John Maddock 2001 - 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 for most recent version.
// All POSIX feature tests go in this file,
// Note that we test _POSIX_C_SOURCE and _XOPEN_SOURCE as well
// _POSIX_VERSION and _XOPEN_VERSION: on some systems POSIX API's
// may be present but none-functional unless _POSIX_C_SOURCE and
// _XOPEN_SOURCE have been defined to the right value (it's up
// to the user to do this *before* including any header, although
// in most cases the compiler will do this for you).
# if defined(BOOST_HAS_UNISTD_H)
# include <unistd.h>
// XOpen has <nl_types.h>, but is this the correct version check?
# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3)
# define BOOST_HAS_NL_TYPES_H
# endif
// POSIX version 6 requires <stdint.h>
# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100)
# define BOOST_HAS_STDINT_H
# endif
// POSIX version 2 requires <dirent.h>
# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L)
# define BOOST_HAS_DIRENT_H
# endif
// POSIX version 3 requires <signal.h> to have sigaction:
# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L)
# define BOOST_HAS_SIGACTION
# endif
// POSIX defines _POSIX_THREADS > 0 for pthread support,
// however some platforms define _POSIX_THREADS without
// a value, hence the (_POSIX_THREADS+0 >= 0) check.
// Strictly speaking this may catch platforms with a
// non-functioning stub <pthreads.h>, but such occurrences should
// occur very rarely if at all.
# if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_MPTASKS)
# define BOOST_HAS_PTHREADS
# endif
// BOOST_HAS_NANOSLEEP:
// This is predicated on _POSIX_TIMERS or _XOPEN_REALTIME:
# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) \
|| (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
# define BOOST_HAS_NANOSLEEP
# endif
// BOOST_HAS_CLOCK_GETTIME:
// This is predicated on _POSIX_TIMERS (also on _XOPEN_REALTIME
// but at least one platform - linux - defines that flag without
// defining clock_gettime):
# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0))
# define BOOST_HAS_CLOCK_GETTIME
# endif
// BOOST_HAS_SCHED_YIELD:
// This is predicated on _POSIX_PRIORITY_SCHEDULING or
// on _POSIX_THREAD_PRIORITY_SCHEDULING or on _XOPEN_REALTIME.
# if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING+0 > 0)\
|| (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\
|| (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0))
# define BOOST_HAS_SCHED_YIELD
# endif
// BOOST_HAS_GETTIMEOFDAY:
// BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE:
// These are predicated on _XOPEN_VERSION, and appears to be first released
// in issue 4, version 2 (_XOPEN_VERSION > 500).
// Likewise for the functions log1p and expm1.
# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500)
# define BOOST_HAS_GETTIMEOFDAY
# if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500)
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# endif
# ifndef BOOST_HAS_LOG1P
# define BOOST_HAS_LOG1P
# endif
# ifndef BOOST_HAS_EXPM1
# define BOOST_HAS_EXPM1
# endif
# endif
# endif

View File

@ -0,0 +1,31 @@
// (C) Copyright Jim Douglas 2005.
// 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 for most recent version.
// QNX specific config options:
#define BOOST_PLATFORM "QNX"
#define BOOST_HAS_UNISTD_H
#include "posix_features.hpp"
// QNX claims XOpen version 5 compatibility, but doesn't have an nl_types.h
// or log1p and expm1:
#undef BOOST_HAS_NL_TYPES_H
#undef BOOST_HAS_LOG1P
#undef BOOST_HAS_EXPM1
#define BOOST_HAS_PTHREADS
#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
#define BOOST_HAS_GETTIMEOFDAY
#define BOOST_HAS_CLOCK_GETTIME
#define BOOST_HAS_NANOSLEEP

View File

@ -0,0 +1,205 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Jens Maurer 2001.
// (C) Copyright David Abrahams 2003.
// (C) Copyright Boris Gubenko 2007.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// Rogue Wave std lib:
#define BOOST_RW_STDLIB 1
#if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER)
# include "utility.hpp"
# if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER)
# error This is not the Rogue Wave standard library
# endif
#endif
//
// figure out a consistent version number:
//
#ifndef _RWSTD_VER
# define BOOST_RWSTD_VER 0x010000
#elif _RWSTD_VER < 0x010000
# define BOOST_RWSTD_VER (_RWSTD_VER << 8)
#else
# define BOOST_RWSTD_VER _RWSTD_VER
#endif
#ifndef _RWSTD_VER
# define BOOST_STDLIB "Rogue Wave standard library version (Unknown version)"
#elif _RWSTD_VER < 0x04010200
# define BOOST_STDLIB "Rogue Wave standard library version " BOOST_STRINGIZE(_RWSTD_VER)
#else
# ifdef _RWSTD_VER_STR
# define BOOST_STDLIB "Apache STDCXX standard library version " _RWSTD_VER_STR
# else
# define BOOST_STDLIB "Apache STDCXX standard library version " BOOST_STRINGIZE(_RWSTD_VER)
# endif
#endif
//
// Prior to version 2.2.0 the primary template for std::numeric_limits
// does not have compile time constants, even though specializations of that
// template do:
//
#if BOOST_RWSTD_VER < 0x020200
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
#endif
// Sun CC 5.5 patch 113817-07 adds long long specialization, but does not change the
// library version number (http://sunsolve6.sun.com/search/document.do?assetkey=1-21-113817):
#if BOOST_RWSTD_VER <= 0x020101 && (!defined(__SUNPRO_CC) || (__SUNPRO_CC < 0x550))
# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
# endif
//
// Borland version of numeric_limits lacks __int64 specialisation:
//
#ifdef __BORLANDC__
# define BOOST_NO_MS_INT64_NUMERIC_LIMITS
#endif
//
// No std::iterator if it can't figure out default template args:
//
#if defined(_RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || defined(RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || (BOOST_RWSTD_VER < 0x020000)
# define BOOST_NO_STD_ITERATOR
#endif
//
// No iterator traits without partial specialization:
//
#if defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) || defined(RWSTD_NO_CLASS_PARTIAL_SPEC)
# define BOOST_NO_STD_ITERATOR_TRAITS
#endif
//
// Prior to version 2.0, std::auto_ptr was buggy, and there were no
// new-style iostreams, and no conformant std::allocator:
//
#if (BOOST_RWSTD_VER < 0x020000)
# define BOOST_NO_AUTO_PTR
# define BOOST_NO_STRINGSTREAM
# define BOOST_NO_STD_ALLOCATOR
# define BOOST_NO_STD_LOCALE
#endif
//
// No template iterator constructors without member template support:
//
#if defined(RWSTD_NO_MEMBER_TEMPLATES) || defined(_RWSTD_NO_MEMBER_TEMPLATES)
# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
#endif
//
// RW defines _RWSTD_ALLOCATOR if the allocator is conformant and in use
// (the or _HPACC_ part is a hack - the library seems to define _RWSTD_ALLOCATOR
// on HP aCC systems even though the allocator is in fact broken):
//
#if !defined(_RWSTD_ALLOCATOR) || (defined(__HP_aCC) && __HP_aCC <= 33100)
# define BOOST_NO_STD_ALLOCATOR
#endif
//
// If we have a std::locale, we still may not have std::use_facet:
//
#if defined(_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE) && !defined(BOOST_NO_STD_LOCALE)
# define BOOST_NO_STD_USE_FACET
# define BOOST_HAS_TWO_ARG_USE_FACET
#endif
//
// There's no std::distance prior to version 2, or without
// partial specialization support:
//
#if (BOOST_RWSTD_VER < 0x020000) || defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
#define BOOST_NO_STD_DISTANCE
#endif
//
// Some versions of the rogue wave library don't have assignable
// OutputIterators:
//
#if BOOST_RWSTD_VER < 0x020100
# define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN
#endif
//
// Disable BOOST_HAS_LONG_LONG when the library has no support for it.
//
#if !defined(_RWSTD_LONG_LONG) && defined(BOOST_HAS_LONG_LONG)
# undef BOOST_HAS_LONG_LONG
#endif
//
// check that on HP-UX, the proper RW library is used
//
#if defined(__HP_aCC) && !defined(_HP_NAMESPACE_STD)
# error "Boost requires Standard RW library. Please compile and link with -AA"
#endif
//
// Define macros specific to RW V2.2 on HP-UX
//
#if defined(__HP_aCC) && (BOOST_RWSTD_VER == 0x02020100)
# ifndef __HP_TC1_MAKE_PAIR
# define __HP_TC1_MAKE_PAIR
# endif
# ifndef _HP_INSTANTIATE_STD2_VL
# define _HP_INSTANTIATE_STD2_VL
# endif
#endif
#if _RWSTD_VER < 0x05000000
# define BOOST_NO_CXX11_HDR_ARRAY
#endif
// type_traits header is incomplete:
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
//
// C++0x headers not yet implemented
//
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RANDOM
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_REGEX
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_SMART_PTR
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_STD_ALIGN
# define BOOST_NO_CXX11_ADDRESSOF
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus < 201402
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#else
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
// C++14 features
# define BOOST_NO_CXX14_STD_EXCHANGE
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE

View File

@ -0,0 +1,148 @@
// Boost compiler configuration selection header file
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Martin Wille 2003.
// (C) Copyright Guillaume Melquiond 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)
// See http://www.boost.org/ for most recent version.
// locate which compiler we are using and define
// BOOST_COMPILER_CONFIG as needed:
#if defined __CUDACC__
// NVIDIA CUDA C++ compiler for GPU
# include "boost/config/compiler/nvcc.hpp"
#endif
#if defined(__GCCXML__)
// GCC-XML emulates other compilers, it has to appear first here!
# define BOOST_COMPILER_CONFIG "gcc_xml.hpp"
#elif defined(_CRAYC)
// EDG based Cray compiler:
# define BOOST_COMPILER_CONFIG "boost/config/compiler/cray.hpp"
#elif defined __COMO__
// Comeau C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp"
#elif defined(__PATHSCALE__) && (__PATHCC__ >= 4)
// PathScale EKOPath compiler (has to come before clang and gcc)
# define BOOST_COMPILER_CONFIG "boost/config/compiler/pathscale.hpp"
#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
// Intel
# define BOOST_COMPILER_CONFIG "boost/config/compiler/intel.hpp"
#elif defined __clang__ && !defined(__CUDACC__) && !defined(__ibmxl__)
// when using clang and cuda at same time, you want to appear as gcc
// Clang C++ emulates GCC, so it has to appear early.
# define BOOST_COMPILER_CONFIG "boost/config/compiler/clang.hpp"
#elif defined __DMC__
// Digital Mars C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/digitalmars.hpp"
# elif defined(__GNUC__) && !defined(__ibmxl__)
// GNU C++:
# define BOOST_COMPILER_CONFIG "gcc.hpp"
#elif defined __KCC
// Kai C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/kai.hpp"
#elif defined __sgi
// SGI MIPSpro C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/sgi_mipspro.hpp"
#elif defined __DECCXX
// Compaq Tru64 Unix cxx
# define BOOST_COMPILER_CONFIG "boost/config/compiler/compaq_cxx.hpp"
#elif defined __ghs
// Greenhills C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/greenhills.hpp"
#elif defined __CODEGEARC__
// CodeGear - must be checked for before Borland
# define BOOST_COMPILER_CONFIG "boost/config/compiler/codegear.hpp"
#elif defined __BORLANDC__
// Borland
# define BOOST_COMPILER_CONFIG "boost/config/compiler/borland.hpp"
#elif defined __MWERKS__
// Metrowerks CodeWarrior
# define BOOST_COMPILER_CONFIG "boost/config/compiler/metrowerks.hpp"
#elif defined __SUNPRO_CC
// Sun Workshop Compiler C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/sunpro_cc.hpp"
#elif defined __HP_aCC
// HP aCC
# define BOOST_COMPILER_CONFIG "boost/config/compiler/hp_acc.hpp"
#elif defined(__MRC__) || defined(__SC__)
// MPW MrCpp or SCpp
# define BOOST_COMPILER_CONFIG "boost/config/compiler/mpw.hpp"
#elif defined(__ibmxl__)
// IBM XL C/C++ for Linux (Little Endian)
# define BOOST_COMPILER_CONFIG "boost/config/compiler/xlcpp.hpp"
#elif defined(__IBMCPP__)
// IBM Visual Age or IBM XL C/C++ for Linux (Big Endian)
# define BOOST_COMPILER_CONFIG "boost/config/compiler/vacpp.hpp"
#elif defined(__PGI)
// Portland Group Inc.
# define BOOST_COMPILER_CONFIG "boost/config/compiler/pgi.hpp"
#elif defined _MSC_VER
// Microsoft Visual C++
//
// Must remain the last #elif since some other vendors (Metrowerks, for
// example) also #define _MSC_VER
# define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp"
#elif defined (BOOST_ASSERT_CONFIG)
// this must come last - generate an error if we don't
// recognise the compiler:
# error "Unknown compiler - please configure (http://www.boost.org/libs/config/config.htm#configuring) and report the results to the main boost mailing list (http://www.boost.org/more/mailing_lists.htm#main)"
#endif
#if 0
//
// This section allows dependency scanners to find all the headers we *might* include:
//
#include "gcc_xml.hpp"
#include <boost/config/compiler/cray.hpp>
#include <boost/config/compiler/comeau.hpp>
#include <boost/config/compiler/pathscale.hpp>
#include <boost/config/compiler/intel.hpp>
#include <boost/config/compiler/clang.hpp>
#include <boost/config/compiler/digitalmars.hpp>
#include "gcc.hpp"
#include <boost/config/compiler/kai.hpp>
#include <boost/config/compiler/sgi_mipspro.hpp>
#include <boost/config/compiler/compaq_cxx.hpp>
#include <boost/config/compiler/greenhills.hpp>
#include <boost/config/compiler/codegear.hpp>
#include <boost/config/compiler/borland.hpp>
#include <boost/config/compiler/metrowerks.hpp>
#include <boost/config/compiler/sunpro_cc.hpp>
#include <boost/config/compiler/hp_acc.hpp>
#include <boost/config/compiler/mpw.hpp>
#include <boost/config/compiler/vacpp.hpp>
#include <boost/config/compiler/pgi.hpp>
#include <boost/config/compiler/visualc.hpp>
#endif

View File

@ -0,0 +1,137 @@
// Boost compiler configuration selection header file
// (C) Copyright John Maddock 2001 - 2002.
// (C) Copyright Jens Maurer 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// locate which platform we are on and define BOOST_PLATFORM_CONFIG as needed.
// Note that we define the headers to include using "header_name" not
// <header_name> in order to prevent macro expansion within the header
// name (for example "linux" is a macro on linux systems).
#if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC)
// linux, also other platforms (Hurd etc) that use GLIBC, should these really have their own config headers though?
# define BOOST_PLATFORM_CONFIG "linux.hpp"
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
// BSD:
# define BOOST_PLATFORM_CONFIG "bsd.hpp"
#elif defined(sun) || defined(__sun)
// solaris:
# define BOOST_PLATFORM_CONFIG "solaris.hpp"
#elif defined(__sgi)
// SGI Irix:
# define BOOST_PLATFORM_CONFIG "irix.hpp"
#elif defined(__hpux)
// hp unix:
# define BOOST_PLATFORM_CONFIG "hpux.hpp"
#elif defined(__CYGWIN__)
// cygwin is not win32:
# define BOOST_PLATFORM_CONFIG "cygwin.hpp"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
// win32:
# define BOOST_PLATFORM_CONFIG "win32.hpp"
#elif defined(__HAIKU__)
// Haiku
# define BOOST_PLATFORM_CONFIG "haiku.hpp"
#elif defined(__BEOS__)
// BeOS
# define BOOST_PLATFORM_CONFIG "beos.hpp"
#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
// MacOS
# define BOOST_PLATFORM_CONFIG "macos.hpp"
#elif defined(__IBMCPP__) || defined(_AIX)
// IBM
# define BOOST_PLATFORM_CONFIG "aix.hpp"
#elif defined(__amigaos__)
// AmigaOS
# define BOOST_PLATFORM_CONFIG "amigaos.hpp"
#elif defined(__QNXNTO__)
// QNX:
# define BOOST_PLATFORM_CONFIG "qnxnto.hpp"
#elif defined(__VXWORKS__)
// vxWorks:
# define BOOST_PLATFORM_CONFIG "vxworks.hpp"
#elif defined(__SYMBIAN32__)
// Symbian:
# define BOOST_PLATFORM_CONFIG "symbian.hpp"
#elif defined(_CRAYC)
// Cray:
# define BOOST_PLATFORM_CONFIG "cray.hpp"
#elif defined(__VMS)
// VMS:
# define BOOST_PLATFORM_CONFIG "vms.hpp"
#elif defined(__CloudABI__)
// Nuxi CloudABI:
# define BOOST_PLATFORM_CONFIG "cloudabi.hpp"
#else
# if defined(unix) \
|| defined(__unix) \
|| defined(_XOPEN_SOURCE) \
|| defined(_POSIX_SOURCE)
// generic unix platform:
# ifndef BOOST_HAS_UNISTD_H
# define BOOST_HAS_UNISTD_H
# endif
# include "posix_features.hpp"
# endif
# if defined (BOOST_ASSERT_CONFIG)
// this must come last - generate an error if we don't
// recognise the platform:
# error "Unknown platform - please configure and report the results to boost.org"
# endif
#endif
#if 0
//
// This section allows dependency scanners to find all the files we *might* include:
//
# include "linux.hpp"
# include "bsd.hpp"
# include "solaris.hpp"
# include "irix.hpp"
# include "hpux.hpp"
# include "cygwin.hpp"
# include "win32.hpp"
# include "beos.hpp"
# include "macos.hpp"
# include "aix.hpp"
# include "amigaos.hpp"
# include "qnxnto.hpp"
# include "vxworks.hpp"
# include "symbian.hpp"
# include "cray.hpp"
# include "vms.hpp"
# include "posix_features.hpp"
#endif

View File

@ -0,0 +1,105 @@
// Boost compiler configuration selection header file
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Jens Maurer 2001 - 2002.
// 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 for most recent version.
// locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed:
// First include <cstddef> to determine if some version of STLport is in use as the std lib
// (do not rely on this header being included since users can short-circuit this header
// if they know whose std lib they are using.)
#ifdef __cplusplus
# include <cstddef>
#else
# include <stddef.h>
#endif
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
// STLPort library; this _must_ come first, otherwise since
// STLport typically sits on top of some other library, we
// can end up detecting that first rather than STLport:
# define BOOST_STDLIB_CONFIG "stlport.hpp"
#else
// If our std lib was not some version of STLport, and has not otherwise
// been detected, then include <utility> as it is about
// the smallest of the std lib headers that includes real C++ stuff.
// Some std libs do not include their C++-related macros in <cstddef>
// so this additional include makes sure we get those definitions.
// Note: do not rely on this header being included since users can short-circuit this
// #include if they know whose std lib they are using.
#if !defined(__LIBCOMO__) && !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER)\
&& !defined(_LIBCPP_VERSION) && !defined(__GLIBCPP__) && !defined(__GLIBCXX__)\
&& !defined(__STL_CONFIG_H) && !defined(__MSL_CPP__) && !defined(__IBMCPP__)\
&& !defined(MSIPL_COMPILE_H) && !defined(_YVALS) && !defined(_CPPLIB_VER)
#include <utility>
#endif
#if defined(__LIBCOMO__)
// Comeau STL:
#define BOOST_STDLIB_CONFIG "libcomo.hpp"
#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
// Rogue Wave library:
# define BOOST_STDLIB_CONFIG "roguewave.hpp"
#elif defined(_LIBCPP_VERSION)
// libc++
# define BOOST_STDLIB_CONFIG "libcpp.hpp"
#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
// GNU libstdc++ 3
# define BOOST_STDLIB_CONFIG "libstdcpp3.hpp"
#elif defined(__STL_CONFIG_H)
// generic SGI STL
# define BOOST_STDLIB_CONFIG "sgi.hpp"
#elif defined(__MSL_CPP__)
// MSL standard lib:
# define BOOST_STDLIB_CONFIG "msl.hpp"
#elif defined(__IBMCPP__)
// take the default VACPP std lib
# define BOOST_STDLIB_CONFIG "vacpp.hpp"
#elif defined(MSIPL_COMPILE_H)
// Modena C++ standard library
# define BOOST_STDLIB_CONFIG "modena.hpp"
#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
// Dinkumware Library (this has to appear after any possible replacement libraries):
# define BOOST_STDLIB_CONFIG "dinkumware.hpp"
#elif defined (BOOST_ASSERT_CONFIG)
// this must come last - generate an error if we don't
// recognise the library:
# error "Unknown standard library - please configure and report the results to boost.org"
#endif
#endif
#if 0
//
// This section allows dependency scanners to find all the files we *might* include:
//
# include "stlport.hpp"
# include "libcomo.hpp"
# include "roguewave.hpp"
# include "libcpp.hpp"
# include "libstdcpp3.hpp"
# include "sgi.hpp"
# include "msl.hpp"
# include "vacpp.hpp"
# include "modena.hpp"
# include "dinkumware.hpp"
#endif

View File

@ -0,0 +1,165 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Darin Adler 2001.
// (C) Copyright Jens Maurer 2001 - 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 for most recent version.
// generic SGI STL:
#if !defined(__STL_CONFIG_H)
# include "utility.hpp"
# if !defined(__STL_CONFIG_H)
# error "This is not the SGI STL!"
# endif
#endif
//
// No std::iterator traits without partial specialisation:
//
#if !defined(__STL_CLASS_PARTIAL_SPECIALIZATION)
# define BOOST_NO_STD_ITERATOR_TRAITS
#endif
//
// No std::stringstream with gcc < 3
//
#if defined(__GNUC__) && (__GNUC__ < 3) && \
((__GNUC_MINOR__ < 95) || (__GNUC_MINOR__ == 96)) && \
!defined(__STL_USE_NEW_IOSTREAMS) || \
defined(__APPLE_CC__)
// Note that we only set this for GNU C++ prior to 2.95 since the
// latest patches for that release do contain a minimal <sstream>
// If you are running a 2.95 release prior to 2.95.3 then this will need
// setting, but there is no way to detect that automatically (other
// than by running the configure script).
// Also, the unofficial GNU C++ 2.96 included in RedHat 7.1 doesn't
// have <sstream>.
# define BOOST_NO_STRINGSTREAM
#endif
// Apple doesn't seem to reliably defined a *unix* macro
#if !defined(CYGWIN) && ( defined(__unix__) \
|| defined(__unix) \
|| defined(unix) \
|| defined(__APPLE__) \
|| defined(__APPLE) \
|| defined(APPLE))
# include <unistd.h>
#endif
//
// Assume no std::locale without own iostreams (this may be an
// incorrect assumption in some cases):
//
#if !defined(__SGI_STL_OWN_IOSTREAMS) && !defined(__STL_USE_NEW_IOSTREAMS)
# define BOOST_NO_STD_LOCALE
#endif
//
// Original native SGI streams have non-standard std::messages facet:
//
#if defined(__sgi) && (_COMPILER_VERSION <= 650) && !defined(__SGI_STL_OWN_IOSTREAMS)
# define BOOST_NO_STD_LOCALE
#endif
//
// SGI's new iostreams have missing "const" in messages<>::open
//
#if defined(__sgi) && (_COMPILER_VERSION <= 740) && defined(__STL_USE_NEW_IOSTREAMS)
# define BOOST_NO_STD_MESSAGES
#endif
//
// No template iterator constructors, or std::allocator
// without member templates:
//
#if !defined(__STL_MEMBER_TEMPLATES)
# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
# define BOOST_NO_STD_ALLOCATOR
#endif
//
// We always have SGI style hash_set, hash_map, and slist:
//
#define BOOST_HAS_HASH
#define BOOST_HAS_SLIST
//
// If this is GNU libstdc++2, then no <limits> and no std::wstring:
//
#if (defined(__GNUC__) && (__GNUC__ < 3))
# include <string>
# if defined(__BASTRING__)
# define BOOST_NO_LIMITS
// Note: <boost/limits.hpp> will provide compile-time constants
# undef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# define BOOST_NO_STD_WSTRING
# endif
#endif
//
// There is no standard iterator unless we have namespace support:
//
#if !defined(__STL_USE_NAMESPACES)
# define BOOST_NO_STD_ITERATOR
#endif
//
// Intrinsic type_traits support.
// The SGI STL has it's own __type_traits class, which
// has intrinsic compiler support with SGI's compilers.
// Whatever map SGI style type traits to boost equivalents:
//
#define BOOST_HAS_SGI_TYPE_TRAITS
// C++0x headers not yet implemented
//
# define BOOST_NO_CXX11_HDR_ARRAY
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RANDOM
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_REGEX
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_SMART_PTR
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_STD_ALIGN
# define BOOST_NO_CXX11_ADDRESSOF
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus < 201402
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#else
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
// C++14 features
# define BOOST_NO_CXX14_STD_EXCHANGE
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
#define BOOST_STDLIB "SGI standard library"

View File

@ -0,0 +1,31 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Jens Maurer 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 for most recent version.
// sun specific config options:
#define BOOST_PLATFORM "Sun Solaris"
#define BOOST_HAS_GETTIMEOFDAY
// boilerplate code:
#define BOOST_HAS_UNISTD_H
#include "posix_features.hpp"
//
// pthreads don't actually work with gcc unless _PTHREADS is defined:
//
#if defined(__GNUC__) && defined(_POSIX_THREADS) && !defined(_PTHREADS)
# undef BOOST_HAS_PTHREADS
#endif
#define BOOST_HAS_STDINT_H
#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
#define BOOST_HAS_LOG1P
#define BOOST_HAS_EXPM1

View File

@ -0,0 +1,180 @@
// (C) Copyright John Maddock 2000.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/static_assert for documentation.
/*
Revision history:
02 August 2000
Initial version.
*/
#ifndef BOOST_STATIC_ASSERT_HPP
#define BOOST_STATIC_ASSERT_HPP
#include "config.hpp"
#include "workaround.hpp"
#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__)
//
// This is horrible, but it seems to be the only we can shut up the
// "anonymous variadic macros were introduced in C99 [-Wvariadic-macros]"
// warning that get spewed out otherwise in non-C++11 mode.
//
#pragma GCC system_header
#endif
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
# define BOOST_STATIC_ASSERT_MSG( ... ) static_assert(__VA_ARGS__)
# else
# define BOOST_STATIC_ASSERT_MSG( B, Msg ) static_assert( B, Msg )
# endif
#else
# define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B )
#endif
#ifdef __BORLANDC__
//
// workaround for buggy integral-constant expression support:
#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS
#endif
#if defined(__GNUC__) && (__GNUC__ == 3) && ((__GNUC_MINOR__ == 3) || (__GNUC_MINOR__ == 4))
// gcc 3.3 and 3.4 don't produce good error messages with the default version:
# define BOOST_SA_GCC_WORKAROUND
#endif
//
// If the compiler issues warnings about old C style casts,
// then enable this:
//
#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4)))
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
# define BOOST_STATIC_ASSERT_BOOL_CAST( ... ) ((__VA_ARGS__) == 0 ? false : true)
# else
# define BOOST_STATIC_ASSERT_BOOL_CAST( x ) ((x) == 0 ? false : true)
# endif
#else
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
# define BOOST_STATIC_ASSERT_BOOL_CAST( ... ) (bool)(__VA_ARGS__)
# else
# define BOOST_STATIC_ASSERT_BOOL_CAST(x) (bool)(x)
# endif
#endif
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
# define BOOST_STATIC_ASSERT( ... ) static_assert(__VA_ARGS__, #__VA_ARGS__)
# else
# define BOOST_STATIC_ASSERT( B ) static_assert(B, #B)
# endif
#else
namespace boost{
// HP aCC cannot deal with missing names for template value parameters
template <bool x> struct STATIC_ASSERTION_FAILURE;
template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
// HP aCC cannot deal with missing names for template value parameters
template<int x> struct static_assert_test{};
}
//
// Implicit instantiation requires that all member declarations be
// instantiated, but that the definitions are *not* instantiated.
//
// It's not particularly clear how this applies to enum's or typedefs;
// both are described as declarations [7.1.3] and [7.2] in the standard,
// however some compilers use "delayed evaluation" of one or more of
// these when implicitly instantiating templates. We use typedef declarations
// by default, but try defining BOOST_USE_ENUM_STATIC_ASSERT if the enum
// version gets better results from your compiler...
//
// Implementation:
// Both of these versions rely on sizeof(incomplete_type) generating an error
// message containing the name of the incomplete type. We use
// "STATIC_ASSERTION_FAILURE" as the type name here to generate
// an eye catching error message. The result of the sizeof expression is either
// used as an enum initialiser, or as a template argument depending which version
// is in use...
// Note that the argument to the assert is explicitly cast to bool using old-
// style casts: too many compilers currently have problems with static_cast
// when used inside integral constant expressions.
//
#if !defined(BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS)
#if defined(BOOST_MSVC) && defined(BOOST_NO_CXX11_VARIADIC_MACROS)
#define BOOST_STATIC_ASSERT( B ) \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST ( B ) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __COUNTER__)
#elif defined(BOOST_MSVC)
#define BOOST_STATIC_ASSERT(...) \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST (__VA_ARGS__) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __COUNTER__)
#elif (defined(BOOST_INTEL_CXX_VERSION) || defined(BOOST_SA_GCC_WORKAROUND)) && defined(BOOST_NO_CXX11_VARIADIC_MACROS)
// agurt 15/sep/02: a special care is needed to force Intel C++ issue an error
// instead of warning in case of failure
# define BOOST_STATIC_ASSERT( B ) \
typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \
[ ::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >::value ]
#elif (defined(BOOST_INTEL_CXX_VERSION) || defined(BOOST_SA_GCC_WORKAROUND)) && !defined(BOOST_NO_CXX11_VARIADIC_MACROS)
// agurt 15/sep/02: a special care is needed to force Intel C++ issue an error
// instead of warning in case of failure
# define BOOST_STATIC_ASSERT(...) \
typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \
[ ::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( __VA_ARGS__ ) >::value ]
#elif defined(__sgi)
// special version for SGI MIPSpro compiler
#define BOOST_STATIC_ASSERT( B ) \
BOOST_STATIC_CONSTANT(bool, \
BOOST_JOIN(boost_static_assert_test_, __LINE__) = ( B )); \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< \
BOOST_JOIN(boost_static_assert_test_, __LINE__) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
#elif BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
// special version for CodeWarrior <= 8.x
#define BOOST_STATIC_ASSERT( B ) \
BOOST_STATIC_CONSTANT(int, \
BOOST_JOIN(boost_static_assert_test_, __LINE__) = \
sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >) )
#else
// generic version
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
# define BOOST_STATIC_ASSERT( ... ) \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( __VA_ARGS__ ) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_ATTRIBUTE_UNUSED
# else
# define BOOST_STATIC_ASSERT( B ) \
typedef ::boost::static_assert_test<\
sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_ATTRIBUTE_UNUSED
# endif
#endif
#else
// alternative enum based implementation:
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
# define BOOST_STATIC_ASSERT( ... ) \
enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \
= sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( __VA_ARGS__ ) >) }
# else
# define BOOST_STATIC_ASSERT(B) \
enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \
= sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) }
# endif
#endif
#endif // defined(BOOST_NO_CXX11_STATIC_ASSERT)
#endif // BOOST_STATIC_ASSERT_HPP

View File

@ -0,0 +1,255 @@
// (C) Copyright John Maddock 2001 - 2002.
// (C) Copyright Darin Adler 2001.
// (C) Copyright Jens Maurer 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// STLPort standard library config:
#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
# include <cstddef>
# if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
# error "This is not STLPort!"
# endif
#endif
// Apple doesn't seem to reliably defined a *unix* macro
#if !defined(CYGWIN) && ( defined(__unix__) \
|| defined(__unix) \
|| defined(unix) \
|| defined(__APPLE__) \
|| defined(__APPLE) \
|| defined(APPLE))
# include <unistd.h>
#endif
//
// __STL_STATIC_CONST_INIT_BUG implies BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
// for versions prior to 4.1(beta)
//
#if (defined(__STL_STATIC_CONST_INIT_BUG) || defined(_STLP_STATIC_CONST_INIT_BUG)) && (__SGI_STL_PORT <= 0x400)
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
#endif
//
// If STLport thinks that there is no partial specialisation, then there is no
// std::iterator traits:
//
#if !(defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined(__STL_CLASS_PARTIAL_SPECIALIZATION))
# define BOOST_NO_STD_ITERATOR_TRAITS
#endif
//
// No new style iostreams on GCC without STLport's iostreams enabled:
//
#if (defined(__GNUC__) && (__GNUC__ < 3)) && !(defined(__SGI_STL_OWN_IOSTREAMS) || defined(_STLP_OWN_IOSTREAMS))
# define BOOST_NO_STRINGSTREAM
#endif
//
// No new iostreams implies no std::locale, and no std::stringstream:
//
#if defined(__STL_NO_IOSTREAMS) || defined(__STL_NO_NEW_IOSTREAMS) || defined(_STLP_NO_IOSTREAMS) || defined(_STLP_NO_NEW_IOSTREAMS)
# define BOOST_NO_STD_LOCALE
# define BOOST_NO_STRINGSTREAM
#endif
//
// If the streams are not native, and we have a "using ::x" compiler bug
// then the io stream facets are not available in namespace std::
//
#ifdef _STLPORT_VERSION
# if !(_STLPORT_VERSION >= 0x500) && !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__)
# define BOOST_NO_STD_LOCALE
# endif
#else
# if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__)
# define BOOST_NO_STD_LOCALE
# endif
#endif
#if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520)
# define BOOST_HAS_TR1_UNORDERED_SET
# define BOOST_HAS_TR1_UNORDERED_MAP
#endif
//
// Without member template support enabled, their are no template
// iterate constructors, and no std::allocator:
//
#if !(defined(__STL_MEMBER_TEMPLATES) || defined(_STLP_MEMBER_TEMPLATES))
# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
# define BOOST_NO_STD_ALLOCATOR
#endif
//
// however we always have at least a partial allocator:
//
#define BOOST_HAS_PARTIAL_STD_ALLOCATOR
#if !defined(_STLP_MEMBER_TEMPLATE_CLASSES) || defined(_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
# define BOOST_NO_STD_ALLOCATOR
#endif
#if defined(_STLP_NO_MEMBER_TEMPLATE_KEYWORD) && defined(BOOST_MSVC) && (BOOST_MSVC <= 1300)
# define BOOST_NO_STD_ALLOCATOR
#endif
//
// If STLport thinks there is no wchar_t at all, then we have to disable
// the support for the relevant specilazations of std:: templates.
//
#if !defined(_STLP_HAS_WCHAR_T) && !defined(_STLP_WCHAR_T_IS_USHORT)
# ifndef BOOST_NO_STD_WSTRING
# define BOOST_NO_STD_WSTRING
# endif
# ifndef BOOST_NO_STD_WSTREAMBUF
# define BOOST_NO_STD_WSTREAMBUF
# endif
#endif
//
// We always have SGI style hash_set, hash_map, and slist:
//
#ifndef _STLP_NO_EXTENSIONS
#define BOOST_HAS_HASH
#define BOOST_HAS_SLIST
#endif
//
// STLport does a good job of importing names into namespace std::,
// but doesn't always get them all, define BOOST_NO_STDC_NAMESPACE, since our
// workaround does not conflict with STLports:
//
//
// Harold Howe says:
// Borland switched to STLport in BCB6. Defining BOOST_NO_STDC_NAMESPACE with
// BCB6 does cause problems. If we detect C++ Builder, then don't define
// BOOST_NO_STDC_NAMESPACE
//
#if !defined(__BORLANDC__) && !defined(__DMC__)
//
// If STLport is using it's own namespace, and the real names are in
// the global namespace, then we duplicate STLport's using declarations
// (by defining BOOST_NO_STDC_NAMESPACE), we do this because STLport doesn't
// necessarily import all the names we need into namespace std::
//
# if (defined(__STL_IMPORT_VENDOR_CSTD) \
|| defined(__STL_USE_OWN_NAMESPACE) \
|| defined(_STLP_IMPORT_VENDOR_CSTD) \
|| defined(_STLP_USE_OWN_NAMESPACE)) \
&& (defined(__STL_VENDOR_GLOBAL_CSTD) || defined (_STLP_VENDOR_GLOBAL_CSTD))
# define BOOST_NO_STDC_NAMESPACE
# define BOOST_NO_EXCEPTION_STD_NAMESPACE
# endif
#elif defined(__BORLANDC__) && __BORLANDC__ < 0x560
// STLport doesn't import std::abs correctly:
#include <stdlib.h>
namespace std { using ::abs; }
// and strcmp/strcpy don't get imported either ('cos they are macros)
#include <string.h>
#ifdef strcpy
# undef strcpy
#endif
#ifdef strcmp
# undef strcmp
#endif
#ifdef _STLP_VENDOR_CSTD
namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; }
#endif
#endif
//
// std::use_facet may be non-standard, uses a class instead:
//
#if defined(__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS) || defined(_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
# define BOOST_NO_STD_USE_FACET
# define BOOST_HAS_STLP_USE_FACET
#endif
//
// If STLport thinks there are no wide functions, <cwchar> etc. is not working; but
// only if BOOST_NO_STDC_NAMESPACE is not defined (if it is then we do the import
// into std:: ourselves).
//
#if defined(_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined(BOOST_NO_STDC_NAMESPACE)
# define BOOST_NO_CWCHAR
# define BOOST_NO_CWCTYPE
#endif
//
// If STLport for some reason was configured so that it thinks that wchar_t
// is not an intrinsic type, then we have to disable the support for it as
// well (we would be missing required specializations otherwise).
//
#if !defined( _STLP_HAS_WCHAR_T) || defined(_STLP_WCHAR_T_IS_USHORT)
# undef BOOST_NO_INTRINSIC_WCHAR_T
# define BOOST_NO_INTRINSIC_WCHAR_T
#endif
//
// Borland ships a version of STLport with C++ Builder 6 that lacks
// hashtables and the like:
//
#if defined(__BORLANDC__) && (__BORLANDC__ == 0x560)
# undef BOOST_HAS_HASH
#endif
//
// gcc-2.95.3/STLPort does not like the using declarations we use to get ADL with std::min/max
//
#if defined(__GNUC__) && (__GNUC__ < 3)
# include <algorithm> // for std::min and std::max
# define BOOST_USING_STD_MIN() ((void)0)
# define BOOST_USING_STD_MAX() ((void)0)
namespace boost { using std::min; using std::max; }
#endif
// C++0x headers not yet implemented
//
# define BOOST_NO_CXX11_HDR_ARRAY
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RANDOM
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_REGEX
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_SMART_PTR
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_STD_ALIGN
# define BOOST_NO_CXX11_ADDRESSOF
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus < 201402
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#else
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
// C++14 features
# define BOOST_NO_CXX14_STD_EXCHANGE
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
#define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,97 @@
// (C) Copyright Yuriy Krasnoschek 2009.
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Jens Maurer 2001 - 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 for most recent version.
// symbian specific config options:
#define BOOST_PLATFORM "Symbian"
#define BOOST_SYMBIAN 1
#if defined(__S60_3X__)
// Open C / C++ plugin was introdused in this SDK, earlier versions don't have CRT / STL
# define BOOST_S60_3rd_EDITION_FP2_OR_LATER_SDK
// make sure we have __GLIBC_PREREQ if available at all
#ifdef __cplusplus
#include <cstdlib>
#else
#include <stdlib.h>
#endif// boilerplate code:
# define BOOST_HAS_UNISTD_H
# include "posix_features.hpp"
// S60 SDK defines _POSIX_VERSION as POSIX.1
# ifndef BOOST_HAS_STDINT_H
# define BOOST_HAS_STDINT_H
# endif
# ifndef BOOST_HAS_GETTIMEOFDAY
# define BOOST_HAS_GETTIMEOFDAY
# endif
# ifndef BOOST_HAS_DIRENT_H
# define BOOST_HAS_DIRENT_H
# endif
# ifndef BOOST_HAS_SIGACTION
# define BOOST_HAS_SIGACTION
# endif
# ifndef BOOST_HAS_PTHREADS
# define BOOST_HAS_PTHREADS
# endif
# ifndef BOOST_HAS_NANOSLEEP
# define BOOST_HAS_NANOSLEEP
# endif
# ifndef BOOST_HAS_SCHED_YIELD
# define BOOST_HAS_SCHED_YIELD
# endif
# ifndef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# endif
# ifndef BOOST_HAS_LOG1P
# define BOOST_HAS_LOG1P
# endif
# ifndef BOOST_HAS_EXPM1
# define BOOST_HAS_EXPM1
# endif
# ifndef BOOST_POSIX_API
# define BOOST_POSIX_API
# endif
// endianess support
# include <sys/endian.h>
// Symbian SDK provides _BYTE_ORDER instead of __BYTE_ORDER
# ifndef __LITTLE_ENDIAN
# ifdef _LITTLE_ENDIAN
# define __LITTLE_ENDIAN _LITTLE_ENDIAN
# else
# define __LITTLE_ENDIAN 1234
# endif
# endif
# ifndef __BIG_ENDIAN
# ifdef _BIG_ENDIAN
# define __BIG_ENDIAN _BIG_ENDIAN
# else
# define __BIG_ENDIAN 4321
# endif
# endif
# ifndef __BYTE_ORDER
# define __BYTE_ORDER __LITTLE_ENDIAN // Symbian is LE
# endif
// Known limitations
# define BOOST_ASIO_DISABLE_SERIAL_PORT
# define BOOST_DATE_TIME_NO_LOCALE
# define BOOST_NO_STD_WSTRING
# define BOOST_EXCEPTION_DISABLE
# define BOOST_NO_EXCEPTIONS
#else // TODO: More platform support e.g. UIQ
# error "Unsuppoted Symbian SDK"
#endif
#if defined(__WINSCW__) && !defined(BOOST_DISABLE_WIN32)
# define BOOST_DISABLE_WIN32 // winscw defines WIN32 macro
#endif

View File

@ -0,0 +1,133 @@
// boost/config/user.hpp ---------------------------------------------------//
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Do not check in modified versions of this file,
// This file may be customized by the end user, but not by boost.
//
// Use this file to define a site and compiler specific
// configuration policy:
//
// define this to locate a compiler config file:
// #define BOOST_COMPILER_CONFIG <myheader>
// define this to locate a stdlib config file:
// #define BOOST_STDLIB_CONFIG <myheader>
// define this to locate a platform config file:
// #define BOOST_PLATFORM_CONFIG <myheader>
// define this to disable compiler config,
// use if your compiler config has nothing to set:
// #define BOOST_NO_COMPILER_CONFIG
// define this to disable stdlib config,
// use if your stdlib config has nothing to set:
// #define BOOST_NO_STDLIB_CONFIG
// define this to disable platform config,
// use if your platform config has nothing to set:
// #define BOOST_NO_PLATFORM_CONFIG
// define this to disable all config options,
// excluding the user config. Use if your
// setup is fully ISO compliant, and has no
// useful extensions, or for autoconf generated
// setups:
// #define BOOST_NO_CONFIG
// define this to make the config "optimistic"
// about unknown compiler versions. Normally
// unknown compiler versions are assumed to have
// all the defects of the last known version, however
// setting this flag, causes the config to assume
// that unknown compiler versions are fully conformant
// with the standard:
// #define BOOST_STRICT_CONFIG
// define this to cause the config to halt compilation
// with an #error if it encounters anything unknown --
// either an unknown compiler version or an unknown
// compiler/platform/library:
// #define BOOST_ASSERT_CONFIG
// define if you want to disable threading support, even
// when available:
// #define BOOST_DISABLE_THREADS
// define when you want to disable Win32 specific features
// even when available:
// #define BOOST_DISABLE_WIN32
// BOOST_DISABLE_ABI_HEADERS: Stops boost headers from including any
// prefix/suffix headers that normally control things like struct
// packing and alignment.
// #define BOOST_DISABLE_ABI_HEADERS
// BOOST_ABI_PREFIX: A prefix header to include in place of whatever
// boost.config would normally select, any replacement should set up
// struct packing and alignment options as required.
// #define BOOST_ABI_PREFIX my-header-name
// BOOST_ABI_SUFFIX: A suffix header to include in place of whatever
// boost.config would normally select, any replacement should undo
// the effects of the prefix header.
// #define BOOST_ABI_SUFFIX my-header-name
// BOOST_ALL_DYN_LINK: Forces all libraries that have separate source,
// to be linked as dll's rather than static libraries on Microsoft Windows
// (this macro is used to turn on __declspec(dllimport) modifiers, so that
// the compiler knows which symbols to look for in a dll rather than in a
// static library). Note that there may be some libraries that can only
// be linked in one way (statically or dynamically), in these cases this
// macro has no effect.
// #define BOOST_ALL_DYN_LINK
// BOOST_WHATEVER_DYN_LINK: Forces library "whatever" to be linked as a dll
// rather than a static library on Microsoft Windows: replace the WHATEVER
// part of the macro name with the name of the library that you want to
// dynamically link to, for example use BOOST_DATE_TIME_DYN_LINK or
// BOOST_REGEX_DYN_LINK etc (this macro is used to turn on __declspec(dllimport)
// modifiers, so that the compiler knows which symbols to look for in a dll
// rather than in a static library).
// Note that there may be some libraries that can only
// be linked in one way (statically or dynamically),
// in these cases this macro is unsupported.
// #define BOOST_WHATEVER_DYN_LINK
// BOOST_ALL_NO_LIB: Tells the config system not to automatically select
// which libraries to link against.
// Normally if a compiler supports #pragma lib, then the correct library
// build variant will be automatically selected and linked against,
// simply by the act of including one of that library's headers.
// This macro turns that feature off.
// #define BOOST_ALL_NO_LIB
// BOOST_WHATEVER_NO_LIB: Tells the config system not to automatically
// select which library to link against for library "whatever",
// replace WHATEVER in the macro name with the name of the library;
// for example BOOST_DATE_TIME_NO_LIB or BOOST_REGEX_NO_LIB.
// Normally if a compiler supports #pragma lib, then the correct library
// build variant will be automatically selected and linked against, simply
// by the act of including one of that library's headers. This macro turns
// that feature off.
// #define BOOST_WHATEVER_NO_LIB
// BOOST_LIB_BUILDID: Set to the same value as the value passed to Boost.Build's
// --buildid command line option. For example if you built using:
//
// bjam address-model=64 --buildid=amd64
//
// then compile your code with:
//
// -DBOOST_LIB_BUILDID = amd64
//
// to ensure the correct libraries are selected at link time.
// #define BOOST_LIB_BUILDID amd64

View File

@ -0,0 +1,28 @@
// (C) Copyright John Maddock 2005.
// 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)
//
// The aim of this header is just to include <utility> but to do
// so in a way that does not result in recursive inclusion of
// the Boost TR1 components if boost/tr1/tr1/utility is in the
// include search path. We have to do this to avoid circular
// dependencies:
//
#ifndef BOOST_CONFIG_UTILITY
# define BOOST_CONFIG_UTILITY
# ifndef BOOST_TR1_NO_RECURSION
# define BOOST_TR1_NO_RECURSION
# define BOOST_CONFIG_NO_UTILITY_RECURSION
# endif
# include <utility>
# ifdef BOOST_CONFIG_NO_UTILITY_RECURSION
# undef BOOST_TR1_NO_RECURSION
# undef BOOST_CONFIG_NO_UTILITY_RECURSION
# endif
#endif

View File

@ -0,0 +1,71 @@
// (C) Copyright John Maddock 2001 - 2002.
// 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 for most recent version.
#if __IBMCPP__ <= 501
# define BOOST_NO_STD_ALLOCATOR
#endif
#define BOOST_HAS_MACRO_USE_FACET
#define BOOST_NO_STD_MESSAGES
// Apple doesn't seem to reliably defined a *unix* macro
#if !defined(CYGWIN) && ( defined(__unix__) \
|| defined(__unix) \
|| defined(unix) \
|| defined(__APPLE__) \
|| defined(__APPLE) \
|| defined(APPLE))
# include <unistd.h>
#endif
// C++0x headers not yet implemented
//
# define BOOST_NO_CXX11_HDR_ARRAY
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RANDOM
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_REGEX
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_SMART_PTR
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_STD_ALIGN
# define BOOST_NO_CXX11_ADDRESSOF
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus < 201402
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#else
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
// C++14 features
# define BOOST_NO_CXX14_STD_EXCHANGE
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
#define BOOST_STDLIB "Visual Age default standard library"

View File

@ -0,0 +1,25 @@
// (C) Copyright Artyom Beilis 2010.
// 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_CONFIG_PLATFORM_VMS_HPP
#define BOOST_CONFIG_PLATFORM_VMS_HPP
#define BOOST_PLATFORM "OpenVMS"
#undef BOOST_HAS_STDINT_H
#define BOOST_HAS_UNISTD_H
#define BOOST_HAS_NL_TYPES_H
#define BOOST_HAS_GETTIMEOFDAY
#define BOOST_HAS_DIRENT_H
#define BOOST_HAS_PTHREADS
#define BOOST_HAS_NANOSLEEP
#define BOOST_HAS_CLOCK_GETTIME
#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
#define BOOST_HAS_LOG1P
#define BOOST_HAS_EXPM1
#define BOOST_HAS_THREADS
#undef BOOST_HAS_SCHED_YIELD
#endif

View File

@ -0,0 +1,369 @@
// (C) Copyright Dustin Spicuzza 2009.
// Adapted to vxWorks 6.9 by Peter Brockamp 2012.
// 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 for most recent version.
// Since WRS does not yet properly support boost under vxWorks
// and this file was badly outdated, but I was keen on using it,
// I patched boost myself to make things work. This has been tested
// and adapted by me for vxWorks 6.9 *only*, as I'm lacking access
// to earlier 6.X versions! The only thing I know for sure is that
// very old versions of vxWorks (namely everything below 6.x) are
// absolutely unable to use boost. This is mainly due to the completely
// outdated libraries and ancient compiler (GCC 2.96 or worse). Do
// not even think of getting this to work, a miserable failure will
// be guaranteed!
// Equally, this file has been tested for RTPs (Real Time Processes)
// only, not for DKMs (Downloadable Kernel Modules). These two types
// of executables differ largely in the available functionality of
// the C-library, STL, and so on. A DKM uses a library similar to those
// of vxWorks 5.X - with all its limitations and incompatibilities
// with respect to ANSI C++ and STL. So probably there might be problems
// with the usage of boost from DKMs. WRS or any voluteers are free to
// prove the opposite!
// ====================================================================
//
// Some important information regarding the usage of POSIX semaphores:
// -------------------------------------------------------------------
//
// VxWorks as a real time operating system handles threads somewhat
// different from what "normal" OSes do, regarding their scheduling!
// This could lead to a scenario called "priority inversion" when using
// semaphores, see http://en.wikipedia.org/wiki/Priority_inversion.
//
// Now, VxWorks POSIX-semaphores for DKM's default to the usage of
// priority inverting semaphores, which is fine. On the other hand,
// for RTP's it defaults to using non priority inverting semaphores,
// which could easily pose a serious problem for a real time process,
// i.e. deadlocks! To overcome this two possibilities do exist:
//
// a) Patch every piece of boost that uses semaphores to instanciate
// the proper type of semaphores. This is non-intrusive with respect
// to the OS and could relatively easy been done by giving all
// semaphores attributes deviating from the default (for in-depth
// information see the POSIX functions pthread_mutexattr_init()
// and pthread_mutexattr_setprotocol()). However this breaks all
// too easily, as with every new version some boost library could
// all in a sudden start using semaphores, resurrecting the very
// same, hard to locate problem over and over again!
//
// b) We could change the default properties for POSIX-semaphores
// that VxWorks uses for RTP's and this is being suggested here,
// as it will more or less seamlessly integrate with boost. I got
// the following information from WRS how to do this, compare
// Wind River TSR# 1209768:
//
// Instructions for changing the default properties of POSIX-
// semaphores for RTP's in VxWorks 6.9:
// - Edit the file /vxworks-6.9/target/usr/src/posix/pthreadLib.c
// in the root of your Workbench-installation.
// - Around line 917 there should be the definition of the default
// mutex attributes:
//
// LOCAL pthread_mutexattr_t defaultMutexAttr =
// {
// PTHREAD_INITIALIZED_OBJ, PTHREAD_PRIO_NONE, 0,
// PTHREAD_MUTEX_DEFAULT
// };
//
// Here, replace PTHREAD_PRIO_NONE by PTHREAD_PRIO_INHERIT.
// - Around line 1236 there should be a definition for the function
// pthread_mutexattr_init(). A couple of lines below you should
// find a block of code like this:
//
// pAttr->mutexAttrStatus = PTHREAD_INITIALIZED_OBJ;
// pAttr->mutexAttrProtocol = PTHREAD_PRIO_NONE;
// pAttr->mutexAttrPrioceiling = 0;
// pAttr->mutexAttrType = PTHREAD_MUTEX_DEFAULT;
//
// Here again, replace PTHREAD_PRIO_NONE by PTHREAD_PRIO_INHERIT.
// - Finally, rebuild your VSB. This will create a new VxWorks kernel
// with the changed properties. That's it! Now, using boost should
// no longer cause any problems with task deadlocks!
//
// And here's another useful piece of information concerning VxWorks'
// POSIX-functionality in general:
// VxWorks is not a genuine POSIX-OS in itself, rather it is using a
// kind of compatibility layer (sort of a wrapper) to emulate the
// POSIX-functionality by using its own resources and functions.
// At the time a task (thread) calls it's first POSIX-function during
// runtime it is being transformed by the OS into a POSIX-thread.
// This transformation does include a call to malloc() to allocate the
// memory required for the housekeeping of POSIX-threads. In a high
// priority RTP this malloc() call may be highly undesirable, as its
// timing is more or less unpredictable (depending on what your actual
// heap looks like). You can circumvent this problem by calling the
// function thread_self() at a well defined point in the code of the
// task, e.g. shortly after the task spawns up. Thereby you are able
// to define the time when the task-transformation will take place and
// you could shift it to an uncritical point where a malloc() call is
// tolerable. So, if this could pose a problem for your code, remember
// to call thread_self() from the affected task at an early stage.
//
// ====================================================================
// Block out all versions before vxWorks 6.x, as these don't work:
// Include header with the vxWorks version information and query them
#include <version.h>
#if !defined(_WRS_VXWORKS_MAJOR) || (_WRS_VXWORKS_MAJOR < 6)
# error "The vxWorks version you're using is so badly outdated,\
it doesn't work at all with boost, sorry, no chance!"
#endif
// Handle versions above 5.X but below 6.9
#if (_WRS_VXWORKS_MAJOR == 6) && (_WRS_VXWORKS_MINOR < 9)
// TODO: Starting from what version does vxWorks work with boost?
// We can't reasonably insert a #warning "" as a user hint here,
// as this will show up with every file including some boost header,
// badly bugging the user... So for the time being we just leave it.
#endif
// vxWorks specific config options:
// --------------------------------
#define BOOST_PLATFORM "vxWorks"
// Special behaviour for DKMs:
#ifdef _WRS_KERNEL
// DKMs do not have the <cwchar>-header,
// but apparently they do have an intrinsic wchar_t meanwhile!
# define BOOST_NO_CWCHAR
// Lots of wide-functions and -headers are unavailable for DKMs as well:
# define BOOST_NO_CWCTYPE
# define BOOST_NO_SWPRINTF
# define BOOST_NO_STD_WSTRING
# define BOOST_NO_STD_WSTREAMBUF
#endif
// Generally available headers:
#define BOOST_HAS_UNISTD_H
#define BOOST_HAS_STDINT_H
#define BOOST_HAS_DIRENT_H
#define BOOST_HAS_SLIST
// vxWorks does not have installed an iconv-library by default,
// so unfortunately no Unicode support from scratch is available!
// Thus, instead it is suggested to switch to ICU, as this seems
// to be the most complete and portable option...
#define BOOST_LOCALE_WITH_ICU
// Generally available functionality:
#define BOOST_HAS_THREADS
#define BOOST_HAS_NANOSLEEP
#define BOOST_HAS_GETTIMEOFDAY
#define BOOST_HAS_CLOCK_GETTIME
#define BOOST_HAS_MACRO_USE_FACET
// Generally unavailable functionality, delivered by boost's test function:
//#define BOOST_NO_DEDUCED_TYPENAME // Commented this out, boost's test gives an errorneous result!
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
#define BOOST_NO_CXX11_VARIADIC_MACROS
// Generally available threading API's:
#define BOOST_HAS_PTHREADS
#define BOOST_HAS_SCHED_YIELD
#define BOOST_HAS_SIGACTION
// Functionality available for RTPs only:
#ifdef __RTP__
# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# define BOOST_HAS_LOG1P
# define BOOST_HAS_EXPM1
#endif
// Functionality available for DKMs only:
#ifdef _WRS_KERNEL
// Luckily, at the moment there seems to be none!
#endif
// These #defines allow posix_features to work, since vxWorks doesn't
// #define them itself for DKMs (for RTPs on the contrary it does):
#ifdef _WRS_KERNEL
# ifndef _POSIX_TIMERS
# define _POSIX_TIMERS 1
# endif
# ifndef _POSIX_THREADS
# define _POSIX_THREADS 1
# endif
#endif
// vxWorks doesn't work with asio serial ports:
#define BOOST_ASIO_DISABLE_SERIAL_PORT
// TODO: The problem here seems to bee that vxWorks uses its own, very specific
// ways to handle serial ports, incompatible with POSIX or anything...
// Maybe a specific implementation would be possible, but until the
// straight need arises... This implementation would presumably consist
// of some vxWorks specific ioctl-calls, etc. Any voluteers?
// vxWorks-around: <time.h> #defines CLOCKS_PER_SEC as sysClkRateGet() but
// miserably fails to #include the required <sysLib.h> to make
// sysClkRateGet() available! So we manually include it here.
#ifdef __RTP__
# include <time.h>
# include <sysLib.h>
#endif
// vxWorks-around: In <stdint.h> the macros INT32_C(), UINT32_C(), INT64_C() and
// UINT64_C() are defined errorneously, yielding not a signed/
// unsigned long/long long type, but a signed/unsigned int/long
// type. Eventually this leads to compile errors in ratio_fwd.hpp,
// when trying to define several constants which do not fit into a
// long type! We correct them here by redefining.
#include <cstdint>
// Some macro-magic to do the job
#define VX_JOIN(X, Y) VX_DO_JOIN(X, Y)
#define VX_DO_JOIN(X, Y) VX_DO_JOIN2(X, Y)
#define VX_DO_JOIN2(X, Y) X##Y
// Correctly setup the macros
#undef INT32_C
#undef UINT32_C
#undef INT64_C
#undef UINT64_C
#define INT32_C(x) VX_JOIN(x, L)
#define UINT32_C(x) VX_JOIN(x, UL)
#define INT64_C(x) VX_JOIN(x, LL)
#define UINT64_C(x) VX_JOIN(x, ULL)
// #include Libraries required for the following function adaption
#include <ioLib.h>
#include <tickLib.h>
#include <sys/time.h>
// Use C-linkage for the following helper functions
extern "C" {
// vxWorks-around: The required functions getrlimit() and getrlimit() are missing.
// But we have the similar functions getprlimit() and setprlimit(),
// which may serve the purpose.
// Problem: The vxWorks-documentation regarding these functions
// doesn't deserve its name! It isn't documented what the first two
// parameters idtype and id mean, so we must fall back to an educated
// guess - null, argh... :-/
// TODO: getprlimit() and setprlimit() do exist for RTPs only, for whatever reason.
// Thus for DKMs there would have to be another implementation.
#ifdef __RTP__
inline int getrlimit(int resource, struct rlimit *rlp){
return getprlimit(0, 0, resource, rlp);
}
inline int setrlimit(int resource, const struct rlimit *rlp){
return setprlimit(0, 0, resource, const_cast<struct rlimit*>(rlp));
}
#endif
// vxWorks has ftruncate() only, so we do simulate truncate():
inline int truncate(const char *p, off_t l){
int fd = open(p, O_WRONLY);
if (fd == -1){
errno = EACCES;
return -1;
}
if (ftruncate(fd, l) == -1){
close(fd);
errno = EACCES;
return -1;
}
return close(fd);
}
// Fake symlink handling by dummy functions:
inline int symlink(const char*, const char*){
// vxWorks has no symlinks -> always return an error!
errno = EACCES;
return -1;
}
inline ssize_t readlink(const char*, char*, size_t){
// vxWorks has no symlinks -> always return an error!
errno = EACCES;
return -1;
}
// vxWorks claims to implement gettimeofday in sys/time.h
// but nevertheless does not provide it! See
// https://support.windriver.com/olsPortal/faces/maintenance/techtipDetail_noHeader.jspx?docId=16442&contentId=WR_TECHTIP_006256
// We implement a surrogate version here via clock_gettime:
inline int gettimeofday(struct timeval *tv, void * /*tzv*/) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
tv->tv_sec = ts.tv_sec;
tv->tv_usec = ts.tv_nsec / 1000;
return 0;
}
// vxWorks does provide neither struct tms nor function times()!
// We implement an empty dummy-function, simply setting the user
// and system time to the half of thew actual system ticks-value
// and the child user and system time to 0.
// Rather ugly but at least it suppresses compiler errors...
// Unfortunately, this of course *does* have an severe impact on
// dependant libraries, actually this is chrono only! Here it will
// not be possible to correctly use user and system times! But
// as vxWorks is lacking the ability to calculate user and system
// process times there seems to be no other possible solution.
struct tms{
clock_t tms_utime; // User CPU time
clock_t tms_stime; // System CPU time
clock_t tms_cutime; // User CPU time of terminated child processes
clock_t tms_cstime; // System CPU time of terminated child processes
};
inline clock_t times(struct tms *t){
struct timespec ts;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
clock_t ticks(static_cast<clock_t>(static_cast<double>(ts.tv_sec) * CLOCKS_PER_SEC +
static_cast<double>(ts.tv_nsec) * CLOCKS_PER_SEC / 1000000.0));
t->tms_utime = ticks/2U;
t->tms_stime = ticks/2U;
t->tms_cutime = 0; // vxWorks is lacking the concept of a child process!
t->tms_cstime = 0; // -> Set the wait times for childs to 0
return ticks;
}
} // extern "C"
// Put the selfmade functions into the std-namespace, just in case
namespace std {
# ifdef __RTP__
using ::getrlimit;
using ::setrlimit;
# endif
using ::truncate;
using ::symlink;
using ::readlink;
using ::times;
using ::gettimeofday;
}
// Some more macro-magic:
// vxWorks-around: Some functions are not present or broken in vxWorks
// but may be patched to life via helper macros...
// Include signal.h which might contain a typo to be corrected here
#include <signal.h>
#define getpagesize() sysconf(_SC_PAGESIZE) // getpagesize is deprecated anyway!
#ifndef S_ISSOCK
# define S_ISSOCK(mode) ((mode & S_IFMT) == S_IFSOCK) // Is file a socket?
#endif
#define lstat(p, b) stat(p, b) // lstat() == stat(), as vxWorks has no symlinks!
#ifndef FPE_FLTINV
# define FPE_FLTINV (FPE_FLTSUB+1) // vxWorks has no FPE_FLTINV, so define one as a dummy
#endif
#if !defined(BUS_ADRALN) && defined(BUS_ADRALNR)
# define BUS_ADRALN BUS_ADRALNR // Correct a supposed typo in vxWorks' <signal.h>
#endif
//typedef int locale_t; // locale_t is a POSIX-extension, currently unpresent in vxWorks!
// #include boilerplate code:
#include "posix_features.hpp"
// vxWorks lies about XSI conformance, there is no nl_types.h:
#undef BOOST_HAS_NL_TYPES_H

View File

@ -0,0 +1,90 @@
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Bill Kempf 2001.
// (C) Copyright Aleksey Gurtovoy 2003.
// (C) Copyright Rene Rivera 2005.
// 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 for most recent version.
// Win32 specific config options:
#define BOOST_PLATFORM "Win32"
// Get the information about the MinGW runtime, i.e. __MINGW32_*VERSION.
#if defined(__MINGW32__)
# include <_mingw.h>
#endif
#if defined(__GNUC__) && !defined(BOOST_NO_SWPRINTF)
# define BOOST_NO_SWPRINTF
#endif
// Default defines for BOOST_SYMBOL_EXPORT and BOOST_SYMBOL_IMPORT
// If a compiler doesn't support __declspec(dllexport)/__declspec(dllimport),
// its boost/config/compiler/ file must define BOOST_SYMBOL_EXPORT and
// BOOST_SYMBOL_IMPORT
#ifndef BOOST_SYMBOL_EXPORT
# define BOOST_HAS_DECLSPEC
# define BOOST_SYMBOL_EXPORT __declspec(dllexport)
# define BOOST_SYMBOL_IMPORT __declspec(dllimport)
#endif
#if defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 2) || ((__MINGW32_MAJOR_VERSION == 2) && (__MINGW32_MINOR_VERSION >= 0)))
# define BOOST_HAS_STDINT_H
# ifndef __STDC_LIMIT_MACROS
# define __STDC_LIMIT_MACROS
# endif
# define BOOST_HAS_DIRENT_H
# define BOOST_HAS_UNISTD_H
#endif
#if defined(__MINGW32__) && (__GNUC__ >= 4)
// Mingw has these functions but there are persistent problems
// with calls to these crashing, so disable for now:
//# define BOOST_HAS_EXPM1
//# define BOOST_HAS_LOG1P
# define BOOST_HAS_GETTIMEOFDAY
#endif
//
// Win32 will normally be using native Win32 threads,
// but there is a pthread library avaliable as an option,
// we used to disable this when BOOST_DISABLE_WIN32 was
// defined but no longer - this should allow some
// files to be compiled in strict mode - while maintaining
// a consistent setting of BOOST_HAS_THREADS across
// all translation units (needed for shared_ptr etc).
//
#ifndef BOOST_HAS_PTHREADS
# define BOOST_HAS_WINTHREADS
#endif
//
// WinCE configuration:
//
#if defined(_WIN32_WCE) || defined(UNDER_CE)
# define BOOST_NO_ANSI_APIS
// Windows CE does not have a conforming signature for swprintf
# define BOOST_NO_SWPRINTF
#else
# define BOOST_HAS_GETSYSTEMTIMEASFILETIME
# define BOOST_HAS_THREADEX
# define BOOST_HAS_GETSYSTEMTIMEASFILETIME
#endif
//
// Windows Runtime
//
#if defined(WINAPI_FAMILY) && \
(WINAPI_FAMILY == WINAPI_FAMILY_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
# define BOOST_NO_ANSI_APIS
#endif
#ifndef BOOST_DISABLE_WIN32
// WEK: Added
#define BOOST_HAS_FTIME
#define BOOST_WINDOWS 1
#endif

View File

@ -0,0 +1,267 @@
// Copyright David Abrahams 2002.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef WORKAROUND_DWA2002126_HPP
# define WORKAROUND_DWA2002126_HPP
// Compiler/library version workaround macro
//
// Usage:
//
// #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
// // workaround for eVC4 and VC6
// ... // workaround code here
// #endif
//
// When BOOST_STRICT_CONFIG is defined, expands to 0. Otherwise, the
// first argument must be undefined or expand to a numeric
// value. The above expands to:
//
// (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300
//
// When used for workarounds that apply to the latest known version
// and all earlier versions of a compiler, the following convention
// should be observed:
//
// #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301))
//
// The version number in this case corresponds to the last version in
// which the workaround was known to have been required. When
// BOOST_DETECT_OUTDATED_WORKAROUNDS is not the defined, the macro
// BOOST_TESTED_AT(x) expands to "!= 0", which effectively activates
// the workaround for any version of the compiler. When
// BOOST_DETECT_OUTDATED_WORKAROUNDS is defined, a compiler warning or
// error will be issued if the compiler version exceeds the argument
// to BOOST_TESTED_AT(). This can be used to locate workarounds which
// may be obsoleted by newer versions.
# ifndef BOOST_STRICT_CONFIG
#include "config.hpp"
#ifndef __BORLANDC__
#define __BORLANDC___WORKAROUND_GUARD 1
#else
#define __BORLANDC___WORKAROUND_GUARD 0
#endif
#ifndef __CODEGEARC__
#define __CODEGEARC___WORKAROUND_GUARD 1
#else
#define __CODEGEARC___WORKAROUND_GUARD 0
#endif
#ifndef _MSC_VER
#define _MSC_VER_WORKAROUND_GUARD 1
#else
#define _MSC_VER_WORKAROUND_GUARD 0
#endif
#ifndef _MSC_FULL_VER
#define _MSC_FULL_VER_WORKAROUND_GUARD 1
#else
#define _MSC_FULL_VER_WORKAROUND_GUARD 0
#endif
#ifndef BOOST_MSVC
#define BOOST_MSVC_WORKAROUND_GUARD 1
#else
#define BOOST_MSVC_WORKAROUND_GUARD 0
#endif
#ifndef BOOST_MSVC_FULL_VER
#define BOOST_MSVC_FULL_VER_WORKAROUND_GUARD 1
#else
#define BOOST_MSVC_FULL_VER_WORKAROUND_GUARD 0
#endif
#ifndef __GNUC__
#define __GNUC___WORKAROUND_GUARD 1
#else
#define __GNUC___WORKAROUND_GUARD 0
#endif
#ifndef __GNUC_MINOR__
#define __GNUC_MINOR___WORKAROUND_GUARD 1
#else
#define __GNUC_MINOR___WORKAROUND_GUARD 0
#endif
#ifndef __GNUC_PATCHLEVEL__
#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 1
#else
#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0
#endif
#ifndef __IBMCPP__
#define __IBMCPP___WORKAROUND_GUARD 1
#else
#define __IBMCPP___WORKAROUND_GUARD 0
#endif
#ifndef __SUNPRO_CC
#define __SUNPRO_CC_WORKAROUND_GUARD 1
#else
#define __SUNPRO_CC_WORKAROUND_GUARD 0
#endif
#ifndef __DECCXX_VER
#define __DECCXX_VER_WORKAROUND_GUARD 1
#else
#define __DECCXX_VER_WORKAROUND_GUARD 0
#endif
#ifndef __MWERKS__
#define __MWERKS___WORKAROUND_GUARD 1
#else
#define __MWERKS___WORKAROUND_GUARD 0
#endif
#ifndef __EDG__
#define __EDG___WORKAROUND_GUARD 1
#else
#define __EDG___WORKAROUND_GUARD 0
#endif
#ifndef __EDG_VERSION__
#define __EDG_VERSION___WORKAROUND_GUARD 1
#else
#define __EDG_VERSION___WORKAROUND_GUARD 0
#endif
#ifndef __HP_aCC
#define __HP_aCC_WORKAROUND_GUARD 1
#else
#define __HP_aCC_WORKAROUND_GUARD 0
#endif
#ifndef __hpxstd98
#define __hpxstd98_WORKAROUND_GUARD 1
#else
#define __hpxstd98_WORKAROUND_GUARD 0
#endif
#ifndef _CRAYC
#define _CRAYC_WORKAROUND_GUARD 1
#else
#define _CRAYC_WORKAROUND_GUARD 0
#endif
#ifndef __DMC__
#define __DMC___WORKAROUND_GUARD 1
#else
#define __DMC___WORKAROUND_GUARD 0
#endif
#ifndef MPW_CPLUS
#define MPW_CPLUS_WORKAROUND_GUARD 1
#else
#define MPW_CPLUS_WORKAROUND_GUARD 0
#endif
#ifndef __COMO__
#define __COMO___WORKAROUND_GUARD 1
#else
#define __COMO___WORKAROUND_GUARD 0
#endif
#ifndef __COMO_VERSION__
#define __COMO_VERSION___WORKAROUND_GUARD 1
#else
#define __COMO_VERSION___WORKAROUND_GUARD 0
#endif
#ifndef __INTEL_COMPILER
#define __INTEL_COMPILER_WORKAROUND_GUARD 1
#else
#define __INTEL_COMPILER_WORKAROUND_GUARD 0
#endif
#ifndef __ICL
#define __ICL_WORKAROUND_GUARD 1
#else
#define __ICL_WORKAROUND_GUARD 0
#endif
#ifndef _COMPILER_VERSION
#define _COMPILER_VERSION_WORKAROUND_GUARD 1
#else
#define _COMPILER_VERSION_WORKAROUND_GUARD 0
#endif
#ifndef _RWSTD_VER
#define _RWSTD_VER_WORKAROUND_GUARD 1
#else
#define _RWSTD_VER_WORKAROUND_GUARD 0
#endif
#ifndef BOOST_RWSTD_VER
#define BOOST_RWSTD_VER_WORKAROUND_GUARD 1
#else
#define BOOST_RWSTD_VER_WORKAROUND_GUARD 0
#endif
#ifndef __GLIBCPP__
#define __GLIBCPP___WORKAROUND_GUARD 1
#else
#define __GLIBCPP___WORKAROUND_GUARD 0
#endif
#ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1
#else
#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 0
#endif
#ifndef __SGI_STL_PORT
#define __SGI_STL_PORT_WORKAROUND_GUARD 1
#else
#define __SGI_STL_PORT_WORKAROUND_GUARD 0
#endif
#ifndef _STLPORT_VERSION
#define _STLPORT_VERSION_WORKAROUND_GUARD 1
#else
#define _STLPORT_VERSION_WORKAROUND_GUARD 0
#endif
#ifndef __LIBCOMO_VERSION__
#define __LIBCOMO_VERSION___WORKAROUND_GUARD 1
#else
#define __LIBCOMO_VERSION___WORKAROUND_GUARD 0
#endif
#ifndef _CPPLIB_VER
#define _CPPLIB_VER_WORKAROUND_GUARD 1
#else
#define _CPPLIB_VER_WORKAROUND_GUARD 0
#endif
#ifndef BOOST_INTEL_CXX_VERSION
#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1
#else
#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 0
#endif
#ifndef BOOST_INTEL_WIN
#define BOOST_INTEL_WIN_WORKAROUND_GUARD 1
#else
#define BOOST_INTEL_WIN_WORKAROUND_GUARD 0
#endif
#ifndef BOOST_DINKUMWARE_STDLIB
#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 1
#else
#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 0
#endif
#ifndef BOOST_INTEL
#define BOOST_INTEL_WORKAROUND_GUARD 1
#else
#define BOOST_INTEL_WORKAROUND_GUARD 0
#endif
// Always define to zero, if it's used it'll be defined my MPL:
#define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0
# define BOOST_WORKAROUND(symbol, test) \
((symbol ## _WORKAROUND_GUARD + 0 == 0) && \
(symbol != 0) && (1 % (( (symbol test) ) + 1)))
// ^ ^ ^ ^
// The extra level of parenthesis nesting above, along with the
// BOOST_OPEN_PAREN indirection below, is required to satisfy the
// broken preprocessor in MWCW 8.3 and earlier.
//
// The basic mechanism works as follows:
// (symbol test) + 1 => if (symbol test) then 2 else 1
// 1 % ((symbol test) + 1) => if (symbol test) then 1 else 0
//
// The complication with % is for cooperation with BOOST_TESTED_AT().
// When "test" is BOOST_TESTED_AT(x) and
// BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined,
//
// symbol test => if (symbol <= x) then 1 else -1
// (symbol test) + 1 => if (symbol <= x) then 2 else 0
// 1 % ((symbol test) + 1) => if (symbol <= x) then 1 else divide-by-zero
//
# ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS
# define BOOST_OPEN_PAREN (
# define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1
# else
# define BOOST_TESTED_AT(value) != ((value)-(value))
# endif
# else
# define BOOST_WORKAROUND(symbol, test) 0
# endif
#endif // WORKAROUND_DWA2002126_HPP

View File

@ -0,0 +1,78 @@
#define PTHREADEDMPEG 1
#define SOUNDCARD_HEADERFILE <sys/soundcard.h> //zaradi ogg
/* Define if you have the strdup function. */
#define HAVE_STRDUP 1
/* Define if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define if you have the <bool.h> header file. */
//#define HAVE_BOOL_H // zaradi ogg
/* Define if you have the <curses.h> header file. */
#define HAVE_CURSES_H 1
/* Define if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1
/* Define if you have the <machine/soundcard.h> header file. */
/* #undef HAVE_MACHINE_SOUNDCARD_H */
/* Define if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define if you have the <ncurses.h> header file. */
#define HAVE_NCURSES_H 1
/* Define if you have the <ncurses/curses.h> header file. */
#define HAVE_NCURSES_CURSES_H 1
/* Define if you have the <ncurses/ncurses.h> header file. */
#define HAVE_NCURSES_NCURSES_H 1
/* Define if you have the <pth.h> header file. */
/* #undef HAVE_PTH_H */
/* Define if you have the <pthread.h> header file. */
#define HAVE_PTHREAD_H 1
/* Define if you have the <pthread/mit/pthread.h> header file. */
/* #undef HAVE_PTHREAD_MIT_PTHREAD_H */
/* Define if you have the <soundcard.h> header file. */
/* #undef HAVE_SOUNDCARD_H */
/* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define if you have the <sys/soundcard.h> header file. */
#define HAVE_SYS_SOUNDCARD_H 1
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the m library (-lm). */
#define HAVE_LIBM 1
/* Define if you have the ossaudio library (-lossaudio). */
/* #undef HAVE_LIBOSSAUDIO */
/* Define if you have the pthread library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* Name of package */
//#define PACKAGE "mp3blaster"
/* Version number of package */
//#define VERSION "3.2.0"
/* Copyright (C) Bram Avontuur (bram@avontuur.org) */

View File

@ -0,0 +1,94 @@
/* MPEG Sound library
(C) 1997 by Woo-jae Jung */
// Binput.cc
// Inputstream from file
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/stat.h>
#include <unistd.h>
#include "mpegsound.h"
/************************/
/* Input bitstrem class */
/************************/
Soundinputstreamfromfile::~Soundinputstreamfromfile()
{
if (fp)fclose(fp);
}
bool Soundinputstreamfromfile::open(char *filename)
{
struct stat buf;
if (filename==NULL)
{
fp=stdin;
size=0;
return true;
}
else if
((fp=fopen(filename,"rb"))==NULL)
{
seterrorcode(SOUND_ERROR_FILEOPENFAIL);
return false;
}
stat(filename,&buf);
size=buf.st_size;
return true;
}
int Soundinputstreamfromfile::getbytedirect(void)
{
int c;
if ((c=getc(fp))<0)
seterrorcode(SOUND_ERROR_FILEREADFAIL);
return c;
}
bool Soundinputstreamfromfile::_readbuffer(char *buffer,int size)
{
if (fread(buffer,size,1,fp)!=1)
{
seterrorcode(SOUND_ERROR_FILEREADFAIL);
return false;
}
return true;
}
bool Soundinputstreamfromfile::eof(void)
{
return feof(fp);
}
int Soundinputstreamfromfile::getblock(char *buffer,int size)
{
return fread(buffer,1,size,fp);
}
int Soundinputstreamfromfile::getsize(void)
{
return size;
}
void Soundinputstreamfromfile::setposition(int pos)
{
if (fp==stdin)return;
fseek(fp,pos,SEEK_SET);
}
int Soundinputstreamfromfile::getposition(void)
{
if (fp==stdin)return 0;
return ftell(fp);
}

View File

@ -0,0 +1,248 @@
/* MSHV GenMessage
* Copyright 2015 Hrisimir Hristov, LZ2HV
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "mpegsound.h"
#include <math.h>
//static const double OUT_SAMPLE_RATE =11025.0;//no inposible hv rawfilter need to be off
//static const double OUT_SAMPLE_RATE =22050.0;
static const double OUT_SAMPLE_RATE_44100 =44100.0;
//static const double OUT_SAMPLE_RATE =12000.0;
static const double OUT_SAMPLE_RATE_48000 =48000.0;//no inposible hv
//static const double OUT_SAMPLE_RATE_48000 =12000.0;//no inposible hv
//static const double OUT_SAMPLE_RATE =96000.0;//no inposible hv
//#include <QtGui>
static const double ORG_SAMPLE_RATE_11025 = 11025.0;
static const double ORG_SAMPLE_RATE_12000 = 12000.0;
static double vol_win = 1.0;
GenMessage::GenMessage(Soundplayer *player)
: buffer_gmsgc {0}, //8192
buffer_gmsgs {0}, //8192
itone_s {0}, //4092
iwave {0} //2976000
{
ftci = false;
f_rawf = false;
f_gens = false;
TGenMsk=NULL;
TGen65=NULL;
TGenFt8=NULL;
TGenFt4=NULL;
TGenQ65=NULL;
THvRawFilter=NULL;
mute_raw = true;
forcetomonoflag = false;
samplesize=0;
speed=0;
stereo=0;
size=0;
pcmsize=0;
__errorcode=SOUND_ERROR_OK;
initialized=false;
//buffer_gmsg=NULL;
buffersize_gmsg=0;
//for (int i= 0; i < 2976000; ++i)
//iwave[i]=0;
iwave_size=0;
iwave_count=0;
//itone_s=NULL;
twopi=8.0*atan(1.0);
//////////////////////////////////////////////////////
s_mode = 2;//HV important set to default mode fsk441
GEN_SAMPLE_RATE = OUT_SAMPLE_RATE_44100;//HV important set to default mode fsk441 sample rate
koef_srate = GEN_SAMPLE_RATE/ORG_SAMPLE_RATE_11025;//HV important set to default mode fsk441 sample rate
//////////////////////////////////////////////////////
BITS_PER_SAMPLE =16;
//App_path = path;
this->player=player;
}
GenMessage::~GenMessage()
{
if ((s_mode == 0 || s_mode == 12) && f_gens)//msk144
delete TGenMsk;
else if ((s_mode == 7 || s_mode == 8 || s_mode == 9) && f_gens)//jt65abc
delete TGen65;
else if (s_mode == 11 && f_gens)//ft8
delete TGenFt8;
else if (s_mode == 13 && f_gens)//ft4
delete TGenFt4;
else if ((s_mode == 14 || s_mode == 15 || s_mode == 16|| s_mode == 17) && f_gens)//ft4
delete TGenQ65;
if (f_gens) f_gens = false;
if (f_rawf)
{
delete THvRawFilter;
f_rawf = false;
}
//qDebug()<<"Delete GenMessage"<<s_mode<<f_gens;
}
int GenMessage::setvolume_all(int volume)
{
vol_win = (4.615583-log(101-volume))/4.615583; // to4nost 0.0001002;
return 0;
}
bool GenMessage::initialize(char *msg,int mod_ident,double tx_freq,int period_t)//,int &ntxslot QString mygridl
{
mute_raw = true;//hv za da ne proswirva v na4aloto
s_mode = mod_ident;
/*if (s_mode==0 || s_mode == 7 || s_mode == 8 || s_mode == 9 || s_mode == 11 || s_mode == 12 || s_mode == 13 ||
s_mode == 14 || s_mode == 15 || s_mode == 16|| s_mode == 17)//msk144 jt65 ft8 ft4 q65
{
if (s_mode == 0 || s_mode == 12)
TGenMsk = new GenMsk(false);//f_dec_gen = dec=true gen=false
else if (s_mode == 7 || s_mode == 8 || s_mode == 9)//jt65abc
TGen65 = new Gen65();
else if (s_mode == 11)//ft8
TGenFt8 = new GenFt8(false);//f_dec_gen = dec=true gen=false
else if (s_mode == 13)//ft4
TGenFt4 = new GenFt4(false);//f_dec_gen = dec=true gen=false
else if (s_mode == 14 || s_mode == 15 || s_mode == 16|| s_mode == 17)//q65
TGenQ65 = new GenQ65(false);
f_gens = true;
GEN_SAMPLE_RATE = OUT_SAMPLE_RATE_48000;
koef_srate = GEN_SAMPLE_RATE/ORG_SAMPLE_RATE_12000;
}
else //if (s_mode>0 && s_mode<7)
{
GEN_SAMPLE_RATE = OUT_SAMPLE_RATE_44100;
koef_srate = GEN_SAMPLE_RATE/ORG_SAMPLE_RATE_11025;
}*/
if (s_mode>0 && s_mode<7) //2.65
{
GEN_SAMPLE_RATE = OUT_SAMPLE_RATE_44100;
koef_srate = GEN_SAMPLE_RATE/ORG_SAMPLE_RATE_11025;
}
else
{
if (s_mode == 0 || s_mode == 12) TGenMsk = new GenMsk(false);
else if (s_mode == 7 || s_mode == 8 || s_mode == 9) TGen65 = new Gen65();//jt65abc
else if (s_mode == 11) TGenFt8 = new GenFt8(false);//ft8
else if (s_mode == 13) TGenFt4 = new GenFt4(false);//ft4
else if (s_mode == 14 || s_mode == 15 || s_mode == 16|| s_mode == 17) TGenQ65 = new GenQ65(false);//q65
if (s_mode != 10) f_gens = true; //pi4
GEN_SAMPLE_RATE = OUT_SAMPLE_RATE_48000;
koef_srate = GEN_SAMPLE_RATE/ORG_SAMPLE_RATE_12000;
}
THvRawFilter = new HvRawFilter(45,100.0,8000.0,true);//47ok 48no true -> LSH+HSH /* Low shelf filter and High shelf filter*/ for TX gine_all 45 zaradi windows
//THvRawFilter = new HvRawFilter(45,100.0,2000.0,true);//false -> LPF+HPF
f_rawf = true; //qDebug()<<"Delete initialize"<<s_mode<<f_gens;
ftci=player->gettci();
buffersize_gmsg=player->getblocksize();
//iwave_size=hvmsgen(s_msg,s_mod_ident,tx_freq,s_period_t);
iwave_size=hvmsgen(msg,mod_ident,tx_freq,period_t);
//qDebug()<<"iwave_size="<<sizeof(short)<<((int)GEN_SAMPLE_RATE * 60)*sizeof(short);
//qDebug()<<"GenMessage initialize="<<iwave_size<<buffersize_gmsg<<ftci;
return true;
}
void GenMessage::mute_hv(bool mute)//hv
{
mute_raw = mute;
}
bool GenMessage::getblock_raws(short *buf,int size_p)//stereo out for Windows and Linux
{
for (int i = 0; i < size_p; i+=2)
{
short raw_dsp = iwave[iwave_count];
if (mute_raw)
{
raw_dsp = raw_dsp*0.00001;
}
else
{
double data_l = THvRawFilter->band_l(raw_dsp);
raw_dsp = (short)data_l;
raw_dsp = raw_dsp*vol_win;
}
//to short for tci HV
buf[i] = raw_dsp;
buf[i+1] = raw_dsp;
iwave_count++;
if (iwave_count>=iwave_size)
iwave_count = 0;
}
return true;
}
bool GenMessage::getblock_rawc(char *buf,int size_p)//stereo out for Windows and Linux
{
for (int i = 0; i < size_p; i+=4)
{
short raw_dsp = iwave[iwave_count];
if (mute_raw)
{
raw_dsp = raw_dsp*0.00001;
}
else
{
double data_l = THvRawFilter->band_l(raw_dsp);
raw_dsp = (short)data_l;
raw_dsp = raw_dsp*vol_win;
}
//little-endian-form, to char HV
buf[i] = (raw_dsp & 0xff);
buf[i+1] = ((raw_dsp >> 8) & 0xff);
buf[i+2] = (raw_dsp & 0xff);
buf[i+3] = ((raw_dsp >> 8) & 0xff);
iwave_count++;
if (iwave_count>=iwave_size)
iwave_count = 0;
}
return true;
}
bool GenMessage::run(void)
{
if (initialized)
{
if (ftci)//tci
{
bool f=getblock_raws(buffer_gmsgs,buffersize_gmsg);
if (!f) return false;
if (player->putblock(buffer_gmsgs,buffersize_gmsg)==false) return false;
}
else
{
bool f=getblock_rawc(buffer_gmsgc,buffersize_gmsg);
if (!f) return false;
if (player->putblock(buffer_gmsgc,buffersize_gmsg)==false) return false;
}
}
else
{
if (!testwave())return false;
THvRawFilter->set_rate((double)speed);
if (player->setsoundtype(stereo,samplesize,speed)==false) return false;
initialized=true;
}
return true;
}
bool GenMessage::testwave()
{
stereo=1;//0 mono 1 stere
samplesize=(int)BITS_PER_SAMPLE;
speed=(int)GEN_SAMPLE_RATE;
size =(int)10000;// triabwa da e goliamo
pcmsize=1;
if (stereo==1)pcmsize*=2;
if (samplesize==16)pcmsize*=2;
return true;
}
/*
void GenMessage::setcurrentpoint(int p)
{
if (p*pcmsize>size)currentpoint=size;
else currentpoint=p*pcmsize;
}
*/

View File

@ -0,0 +1,619 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV Generator
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2017
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "mpegsound.h"
#include <math.h>
//using namespace std;
#define _FSK441_DH_
#define _JTMS_DH_
#define _ISCAT_DH_
#include "../../config_msg_all.h"
//#include <QtGui>
int GenMessage::abc441(char*msg,int count_msg)
{
int count;// = 3*count_msg;
// samo golemi bukwi HV
for (int i = 0; i < count_msg; i++)
{
int j;
j = (int)msg[i];
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (j<0 || j>91)
j=32;
int n;
n = lookup_FSK441_TXRX[j];
itone_s[3*(i+1)-3]=n/16 + 1;
itone_s[3*(i+1)-2]=fmod(n/4,4) + 1;
itone_s[3*(i+1)-1]=fmod(n,4) + 1;
//qDebug()<<j<<n;
}
//qDebug()<<"itone1_441"<<3*(count_msg+1)-1;
count=3*count_msg;
return count;
}
/*
void GenMessage::makepings(int count)
{
int iping0=-999;
double dt=1.0/GEN_SAMPLE_RATE;
double w=1.0;
double t0=1.0;
double amp=1.0;
double t;
double fac;
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
for (int i = 0; i < count; i++)
{
int iping=i/(3*GEN_SAMPLE_RATE);
if (iping!=iping0)
{
double ip=fmod(iping,3);
w=0.015*(4-ip);
double ig=(iping-1)/3;
amp=sqrt((3.0-ig)/3.0);
t0=dt*(iping+0.5)*(3*GEN_SAMPLE_RATE);
iping0=iping;
}
t=(i*dt-t0)/w;
if (t<0.0 && t<10.0)
fac=0.0;
else
fac=2.718*t*exp(-t);
iwave[i]=(short)(fac*amp*iwave[i]);
}
}
*/
int GenMessage::genms(char*msg28,double samfac,int isrch)
{
int k = 0;
// hv v1.01 29 to 59
char msg[59+1] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' '};
/// // 2 2 2 2 4 2 4 6
//data np/5,7,9,11,13,17,19,23,29/ !Permissible message lengths
int np[13] ={5,7,9,11,13,17,19,23,29,31,33,35,37};// hv v.1.01 {5,7,9,11,13,17,19,23,29} to {5,7,9,11,13,17,19,23,29,31,33,35,37,39}
int sent[203*2];
//! 1 2 3 4 5 6
//! 0123456789012345678901234567890123456789012345678901234567890123
// data cc/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ./?- _ @'/
double dt,phi,f,f0,dfgen,dphi,foffset;
int NMAX=30*GEN_SAMPLE_RATE;
//qDebug()<<"strlen(msg)";
for (int z = 0; z < 58; z++)// hv v1.01 28 to 58
{
msg[z] = msg28[z];//Extend to 29 characters
}
int i =0;
for (i = 58; i >= 0; i--)// hv v1.01 28 to 58
{
if (msg[i]!=' ')
break;
}
int iz=i+2; //hv ok +1 interval nakraia !Add one for space at EOM
int msglen=iz;
//qDebug()<<msg<<msglen;
if (isrch!=0) goto c3;//hv ????
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
for (i = 0; i < 13; i++)//hv v.1.01 9 to 23
{
if (np[i]>=iz) goto c2;
}
i=7;//f90 = 8 c++ = 7
c2:
msglen=np[i];//???hv
//qDebug()<<msglen<<i<<iz;
//! Convert message to a bit sequence, 7 bits per character (6 + even parity)
c3: // sent=0;
k=0;
for (int j = 0; j < msglen; j++)
{
if (msg[j]==' ')
{
i=57;//v negovata 58 no go vra6ta -1 posle
goto c5;
}
else
{
for (i = 0; i < 64; i++)
{
if (msg[j]==cc_JTMS_TX[i])
{
//qDebug()<<msg[j];
goto c5;
}
}
}
c5:
//qDebug()<<i;
/*
AND IAND IAND(N,M) & n&m .
OR IOR IOR(N,M) | n|m .
Exclusive OR IEOR IEOR(N,M) ^ n^m .
1's Complement INOT INOT(N) ~ ~n .
Left Shift ISHFT ISHFT(N,M) (M > 0) << n<<m n shifted left by m bits
Right Shift ISHFT ISHFT(N,M) (M < 0) >> n>>m n shifted right by m bits
*/
int m=0;
for (int n = 5; n >= 0; n--)
{
sent[k]=1 & (i >> n);//sent(k)=iand(1,ishft(i-1,-n))
m=m+sent[k];
//qDebug()<<sent[k]<<i<<n<<k;
k++;
}
sent[k]=m & 1; //sent(k)=iand(m,1) //!Insert parity bit
//qDebug()<<sent[k]<<"parity"<<k;
k++;
}
int nsym=k;
//qDebug()<<k;
//! Set up necessary constants
int nsps=8*koef_srate; //111 to4no 4islo
dt=1.0/(samfac*GEN_SAMPLE_RATE);
f0=(double)GEN_SAMPLE_RATE/nsps; //qDebug()<<f0; // 1575.0 Hz
dfgen=0.5*f0; //qDebug()<<dfgen; // 787.5 Hz
foffset=1500.0 - f0;
k=0;
phi=0.0;
int nrpt=(double)NMAX/(nsym*nsps); //qDebug()<<"1"<<nrpt;
//nrpt=(double)NMAX/((double)nsym*(8.0*koef_11025));//qDebug()<<"2"<<nrpt;
if (isrch!=0) nrpt=1;
for (int irpt = 0; irpt < nrpt; irpt++)
{
for (int j = 0; j < nsym; j++)
{
if (sent[j]==1)
f=f0 + 0.5*dfgen + foffset;
else
f=f0 - 0.5*dfgen + foffset;
dphi=twopi*f*dt;
for (i = 0; i < nsps; i++)
{
phi=phi+dphi;
if (isrch==0)
{
iwave[k]=(short)(32600.0*sin(phi));//realy is 128 do not make distortions
}
//else
//cwave[k]=cmplx(cos(phi),sin(phi))
//cwave[k]=cos(phi)+sin(phi)*I;
k++;
}
}
}
/*int mode4 = 1;
dt=1.0/(samfac*GEN_SAMPLE_RATE);
double nsps=8*4;//(double)512.0*koef_11025/mode4;//111
double df=1855.53-1155.47;//(double)GEN_SAMPLE_RATE/nsps;
f0=1155.47;//47*df;
k =0;
double pha=0.0;
double dpha = 0.0;
for (int m = 0; m < nsym; m++)
{ //!Generate iwave
f=f0 + sent[m]*df;
dpha=twopi*f*dt;
for (int i = 0; i < nsps; i++)
{
//k=k+1
pha=pha+dpha;
iwave[k]=(short)(120.0*sin(pha));//realy is 128 do not make distortions
k++;
}
}*/
if (isrch==0)
{
//iwave(k+1:)=0
iwave[k+0]=0;
iwave[k+1]=0;
iwave[k+2]=0;
iwave[k+3]=0;
iwave[k+4]=0;
}
//qDebug()<<k;
return k;
}
///////////// JT6M /////////////////////////////////////
int GenMessage::gentone(double *x,int n,int k,double samfac)
{
//real*4 x(512)
double dt,f;
int kk = 0;
dt=1.0/(samfac*GEN_SAMPLE_RATE);
f=(double)(n+51)*GEN_SAMPLE_RATE/(512.0*koef_srate);//111
//qDebug()<<samfac;
//do i=1,512
for (int i = 0; i < 512*koef_srate; i++)
x[i+k]=sin(twopi*i*dt*f);
kk=k+512*koef_srate;
return kk;
}
int GenMessage::gen6m(char *msg,double samfac)
{
//! Encodes a message into a wavefile for transmitting JT6M signals.
//const int NMAX=44544*koef_srate; //hv v1.01 //!NMAX=28*512*3/2: hv v1.01 !NMAX=58*512*3/2: number of waveform samples
double x[178180]; //178176 //!Data for wavefile
int imsg[58+1]; //hv v1.01
int nwave = 0;
int nmsg=0;
int i;
for (i = 58; i >= 0; i--)
{
if (msg[i]!=' ')
break;
}
nmsg=i+2;
int odd = (int)fmod(nmsg,2);
// na ne4eten broi ima dva intervala fakt
if (odd==1)
{
nmsg=nmsg+1; //!Make it even 4eten
}
//qDebug()<<"len 4eten"<<nmsg;
//qDebug()<<"msg="<<msg<<nmsg;
nwave=(double)nmsg*512*koef_srate*3/2;
for (int m = 0; m < nmsg; m++) //!Get character code numbers
{
int ic=m;
int n=(int)msg[ic];
//! Calculate i in range 0-42:
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
if (n>=(int)('0') && n<=(int)('9')) i=n-(int)('0');
if (msg[ic]=='.') i=10;
if (msg[ic]==',') i=11;
if (msg[ic]==' ') i=12;
if (msg[ic]=='/') i=13;
if (msg[ic]=='#') i=14;
if (msg[ic]=='?') i=15;
if (msg[ic]=='$') i=16;
if (n>=(int)('a') && n<=(int)('z')) i=n-(int)('a')+17;
if (n>=(int)('A') && n<=(int)('Z')) i=n-(int)('A')+17;
imsg[m]=i;
//qDebug()<<"msg="<<msg[ic]<<"=end";
}
int k=0;
//do i=1,nmsg,2
for (i = 0; i < nmsg; i+=2)
{
k = gentone(x,-1,k,samfac); //!Generate a sync tone
k = gentone(x,imsg[i],k,samfac); //!First character
k = gentone(x,imsg[i+1],k,samfac); //!Second character
}
//do i=1,nwave
for (i = 0; i < nwave; i++)
iwave[i]=(short)(32600.0*x[i]);//realy is 128 do not make distortions
return nwave;
}
///////////// JT6M /////////////////////////////////////
int GenMessage::geniscat(char *msg,int nmsg,int mode4,double samfac)
{
//! Generate an ISCAT waveform.
int nwave = 0;
int NMAX=30*GEN_SAMPLE_RATE;
//int NSZ=1291;
//char msgsent[29]; //!Message to be transmitted
int imsg[61];//hv v1.01 31 to 61
//char c[43];
double dt,f0,df,pha;
int icos[4] = {0,1,3,2}; //!Costas array
/*int nsync = 3;
int nlen = 2;
int ndat = 18;*/
//data nsync/4/,nlen/2/,ndat/18/
//data c/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ /.?@-'/
double nsps=(double)512.0*koef_srate/mode4;//111
df=(double)GEN_SAMPLE_RATE/nsps;
dt=1.0/(samfac*GEN_SAMPLE_RATE);
f0=47.0*df;
if (mode4==2) f0=13*df;
int nsym=NMAX/nsps;
int nblk=nsync_tx+nlen_tx+ndat_tx;
int msglen=nmsg+1;
int k=0;
//int kk=0;
imsg[0]=40; //!Always start with BOM char: '@'
for (int i = 0; i < nmsg; i++)
{ //!Define the tone sequence
//imsg(i+1)=36
imsg[i+1]=36; //!Illegal char set to blank
for (int j = 0; j< 42; j++)
{
if (msg[i]==c_ISCAT_TX[j])
//imsg(i+1)=j-1;
imsg[i+1]=j;
}
}
for (int i = 0; i < nsym; i++)
{//do i=1,nsym //!Total symbols in 30 s
//j=mod(i-1,nblk)+1
int j=fmod(i,nblk);//pri nsync =3 -> nblk+1 na dolu gi pazi >= i <=
//c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE.
//if(j.le.nsync) then
if (j+1<=nsync_tx)
itone_s[i]=icos[j]; //!Insert 4x4 Costas array
//else if(j.gt.nsync .and. j.le.nsync+nlen) then
else if (j+1>nsync_tx && j+1<=nsync_tx+nlen_tx)
{
itone_s[i]=msglen; //!Insert message-length indicator
//if(j.ge.nsync+2) then
if (j+1>=nsync_tx+2)
{
//n=msglen + 5*(j-nsync-1)
int n=msglen + 5*(j+1-nsync_tx-1);// 0 mai e 1
if (n>41)
n=n-42;
itone_s[i]=n;
}
}
else
{
//k=k+1;
//kk=mod(k-1,msglen)+1
int kk=fmod(k,msglen); //qDebug()<<"iskat"<<kk<<i;
itone_s[i]=imsg[kk];
k++;
}
}
k=0;
pha=0.0;
for (int m = 0; m < nsym; m++)
{ //!Generate iwave
double f=f0 + itone_s[m]*df;
double dpha=twopi*f*dt;
for (int i = 0; i < nsps; i++)
{
//k=k+1
pha=pha+dpha;
iwave[k]=(short)(32600.0*sin(pha));//realy is 128 do not make distortions
k++;
}
}
nwave=k;
//qDebug()<<"nwave="<<nwave;
//qDebug()<<"itone2_iskat"<<nsym;
return nwave;
}
QString GenMessage::format_msg(char *message_in, int cmsg)
{
QString out = "";
int beg,end;
for (beg = 0; beg < cmsg; ++beg)
{
if (message_in[beg]!=' ') break;
}
for (end = cmsg-1; end >= 0; --end)
{
if (message_in[end]!=' ') break;
}
for (int z = beg; z < end+1; ++z) out.append(message_in[z]);
return out;
}
int GenMessage::hvmsgen(char*msg_org,int mod_ident,double tx_freq,int period_t)//,int &ntxslot QString mygridloc,
{
int nwave = 0;
int k = 0;
int nspd = 0;
double df;
double pha = 0.0;
int nrpt;
double freq = 0.0;
int LTone;
double dpha = 0.0;
//tuk e corekciata ako ne ti e dobre tx sempliraneto fivehztx
double samfacout = 1.0;//1.0024;//samfacout fsample_out/11025.d0
double fsample_out;// = 11025.0*samfacout;
double dt;//=1.0/fsample_out;
int ndits;
int NMSGMAX = 36; // v1.01 28 to 58 300char for fox
//ft8-fox msg LZ2HVV RR73; SP2HWY <123456789asd> -11# 40*5=200
const int max_len = 220;
char msg[max_len+10];
for (int z = 0; z < max_len; ++z) msg[z]=' ';
fsample_out=GEN_SAMPLE_RATE*samfacout;
if (fabs(samfacout-1.0)>0.02) fsample_out=1.0;
// fsample_out=fsample_out/4;
int nmsg = strlen(msg_org);
if(nmsg > max_len) nmsg = max_len;
for (int z = 0; z < nmsg; ++z) msg[z] = msg_org[z];
//Find message length
int x;
nmsg=0;
for (x = NMSGMAX; x >= 0; x--)
{
if (msg[x]!=' ') break;
}
nmsg=x+1;// hv +1 za da ima interval nakraia
if (msg[0]=='@')
{
if (msg[1]=='A') freq=882.0;
if (msg[1]=='B') freq=1323.0;
if (msg[1]=='C') freq=1764.0;
if (msg[1]=='D') freq=2205.0;
//if (msg[1]=='T') freq=1000.0;
if (freq==0.0)
{
QString s;
for (int i = 1; i < nmsg; i++) s.append(msg[i]);
if (s=="TUNE")
{
freq = 1000.0;
goto tune;
}
if (s.toInt()>=100 && s.toInt()<=3500) freq = s.toInt();//3000
}
tune:
nwave=1*fsample_out;//be6e nwave=60*fsample_out; 60sec
dpha=twopi*freq/fsample_out;
for (int i = 0; i < nwave; i++) iwave[i]=(short)(32600.0*sin(i*dpha));//realy is 128 do not make distortions
goto end;
}
if (mod_ident==11)
{//FT8
QString tstr = format_msg(msg,max_len);//2.65
nwave = TGenFt8->genft8(tstr,iwave,GEN_SAMPLE_RATE,tx_freq); //,i3b
goto end;
}
else if (mod_ident==13)
{//FT4
QString tstr = format_msg(msg,max_len);//2.65
nwave = TGenFt4->genft4(tstr,iwave,GEN_SAMPLE_RATE,tx_freq);//,i3b
goto end;
}
else if (mod_ident==14 || mod_ident==15 || mod_ident==16 || mod_ident==17)
{//Q65
int mq65 = 1;
if (mod_ident==15) mq65 = 2;
else if (mod_ident==16) mq65 = 4;
else if (mod_ident==17) mq65 = 8;
QString tstr = format_msg(msg,max_len);//2.65
nwave = TGenQ65->genq65(tstr,iwave,GEN_SAMPLE_RATE,tx_freq,mq65,period_t);//,i3b
goto end;
}
else if (mod_ident==4)
{//ISCAT-A
int mode4 = 1;
nwave = geniscat(msg,nmsg,mode4,samfacout);
goto end;
}
else if (mod_ident==5)
{//ISCAT-B
int mode4 = 2;
nwave = geniscat(msg,nmsg,mode4,samfacout);
goto end;
}
else if (mod_ident==0)
{//MSK144
int i4tone[234];// v procedurata se nulira TGenMsk->genmsk
nwave = TGenMsk->genmsk(msg,samfacout,i4tone,true,iwave,GEN_SAMPLE_RATE,koef_srate,0,mod_ident,false);
goto end;
}
else if (mod_ident==12)
{//MSK144ms
int i4tone[234];// v procedurata se nulira TGenMsk->genmsk
nwave = TGenMsk->genmsk(msg,samfacout,i4tone,true,iwave,GEN_SAMPLE_RATE,koef_srate,0,mod_ident,true);
goto end;
}
else if (mod_ident==1)
{//JTMS
nwave = genms(msg,samfacout,0);
goto end;
}
else if (mod_ident==6)
{//JT6M
nwave = gen6m(msg,samfacout);
goto end;
}
else if (mod_ident==7)
{//JT65A
//int mode65 = 1; //A=1, B=2, C=4
//int nfast=1; //A=1, B=1, C=1, B2=2, C2=2
//if((mode(5:5)=='B' || mode(5:5)=='C') && mode(6:6)=='2') nfast=2
//if(mode65==2 || mode65==4) nfast=2;
//double ntxdf = 0.0;
nwave = TGen65->gen65(msg,1,1,samfacout,GEN_SAMPLE_RATE,iwave);//ntxdf,koef_srate,
goto end;
}
else if (mod_ident==8)
{//JT65B
//double ntxdf = 0.0;
nwave = TGen65->gen65(msg,2,1,samfacout,GEN_SAMPLE_RATE,iwave);//ntxdf,koef_srate,
goto end;
}
else if (mod_ident==9)
{//JT65C
//double ntxdf = 0.0;
nwave = TGen65->gen65(msg,4,1,samfacout,GEN_SAMPLE_RATE,iwave);//ntxdf,koef_srate,
goto end;
}
//else if (mod_ident==2 || mod_ident==3)
//{
//FSK
dt=1.0/fsample_out;
if (nmsg<=NMSGMAX) nmsg=nmsg+1; //Add trailing blank if nmsg < 28
ndits = abc441(msg,nmsg);
nspd = NSPD_FOM_MODE(mod_ident)*koef_srate;
LTone = LTONE_FOM_MODE(mod_ident);
k=0;
df=(double)GEN_SAMPLE_RATE/nspd;
pha = 0.0;
nrpt=30.0*GEN_SAMPLE_RATE/(double)(nspd*ndits);
for (int irpt = 0; irpt < nrpt; irpt++)
{
for (int m = 0; m < ndits; m++)
{
freq=(LTone-1+itone_s[m])*df;//-100.0
dpha=twopi*freq*dt;
for (int i = 0; i < nspd; i++)
{
pha=pha+dpha;
//if (pha > twopi) pha -= twopi;
iwave[k]=(short)(32600.0*sin(pha));//32600.0 32767.0 realy is 128 do not make distortions
//if(iwave[k]>32600.0 || iwave[k]<-32600.0) qDebug()<<iwave[k];
k++;
}
}
}//qDebug()<<"itone3_441"<<ndits;
nwave=k;
//}
end:
return nwave;
}

View File

@ -0,0 +1,128 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV Decoder/Generator
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2022
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "genpom.h"
double gfsk_pulse_(double b,double t)
{
double out = 0.0;
double pi=4.*atan(1.0);
double c=pi*sqrt(2.0/log(2.0));
out=0.5*(erf(c*b*(t+0.5))-erf(c*b*(t-0.5)));
return out;
}
void gen_pulse_gfsk_(double *pulse,double k,double bt,int nsps)
{
for (int i= 0; i < 3*nsps; ++i)
{
//double tt=((double)i-k*(double)nsps)/(double)nsps;
double tt=((double)i-k)/(double)nsps;//for ft2
pulse[i]=gfsk_pulse_(bt,tt);
}
}
#include <QString>
#include "HvGenFt8/bpdecode_ft8_174_91.h"
//#include <QtGui>
void GenPomFt::initGenPomFt()
{
first_ft_enc_174_91 = true;
}
#include "boost/boost_14.hpp"
short crc14_ft(unsigned char const * data, int length)
{
return boost::augmented_crc<14, TRUNCATED_POLYNOMIAL14>(data, length);
}
short GenPomFt::crc14(unsigned char const * data, int length)
{
return crc14_ft(data,length);
}
void GenPomFt::encode174_91(bool *message77,bool *codeword)
{
const int N=174;
const int K=91;
const int M=N-K;
unsigned char i1MsgBytes[15];
bool pchecks[95];
if (first_ft_enc_174_91)
{
for (int i = 0; i < 95; ++i)
{
for (int j = 0; j < 85; ++j)
genft_174_91[i][j]=0;
}
for (int i = 0; i < 83; ++i)
{
for (int j = 0; j < 23; ++j)//23 bb a8 30 e2 3b 6b 6f 50 98 2e
{
bool ok;
QString temp = g_ft8_174_91[i].mid(j,1);
int istr = temp.toInt(&ok, 16); //read(g(i)(j:j),"(Z1)") istr
for (int jj = 0; jj < 4; ++jj)
{
int icol=(j)*4+jj;
if ( icol <= 90 ) genft_174_91[icol][i]=(1 & (istr >> (3-jj)));
}
}
}
first_ft_enc_174_91=false;
}
//! Add 14-bit CRC to form 91-bit message+CRC14
//write(tmpchar,'(77i1)') message77
//tmpchar(78:80)='000'
//i1MsgBytes=0
//read(tmpchar,'(10b8)') i1MsgBytes(1:10)
for (int i = 0; i < 15; ++i) i1MsgBytes[i]=0;
int c_77 = 0;
for (int i = 0; i < 10; ++i)
{
int k = 0;
for (int j = 0; j < 8; ++j)
{
k <<= 1;
k |= message77[c_77];//- 0
c_77++;
}
i1MsgBytes[i] = k;
}
int ncrc14=crc14(i1MsgBytes,12);//int ncrc14 = crc14 (c_loc (i1MsgBytes), 12)
//write(tmpchar(78:91),'(b14)') ncrc14
//read(tmpchar,'(91i1)') message
int izz = 14-1;
int pos = 77;
for (int i = 0; i < 14; ++i)
{
message77[pos]=(1 & (ncrc14 >> -(i-izz)));
pos++;//=91
}
for (int i = 0; i < 83; ++i)
{
int nsum=0;
for (int j = 0; j < 91; ++j)
{
nsum+=message77[j]*genft_174_91[j][i];//nsum=nsum+message(j)*gen(i,j);
}
pchecks[i]=fmod(nsum,2);
}
// codeword(1:K)=message
// codeword(K+1:N)=pchecks
for (int i = 0; i < K; ++i)//91
codeword[i]=message77[i];
for (int i = 0; i < M; ++i)//174-91=83
codeword[i+91]=pchecks[i];
}

View File

@ -0,0 +1,32 @@
/* The algorithms, source code, look-and-feel of WSJT-X and related
* programs, and protocol specifications for the modes FSK441, FT8, JT4,
* JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017
* by one or more of the following authors: Joseph Taylor, K1JT; Bill
* Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam,
* KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q;
* and other members of the WSJT Development Group.
*
* MSHV Decoder/Generator
* Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2022
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#ifndef GENPOM_H
#define GENPOM_H
#include <math.h>
double gfsk_pulse_(double b,double t);
void gen_pulse_gfsk_(double *pulse,double k,double bt,int nsps);
class GenPomFt
{
public:
void initGenPomFt();
void encode174_91(bool *message77,bool *codeword);
private:
bool first_ft_enc_174_91;
char genft_174_91[100][95];//91 83
short crc14(unsigned char const * data, int length);
};
#endif

View File

@ -0,0 +1,290 @@
#include "mpegsound.h"
#if defined _LINUX_
//#include <QtGui>
#include <pulse/pulseaudio.h>
#include <pulse/simple.h>
pa_simple *s_pulse_tx = NULL;
void Rawplayer::lin_destroy()
{
if (playback_handle) //2.37 protect handle
{
snd_pcm_close(playback_handle);
playback_handle = NULL;
//qDebug()<<"---------------"<<"Destroy ALSA";
}
if (s_pulse_tx)
{
/* Make sure that every single sample was played */
int error = 0;
if (pa_simple_drain(s_pulse_tx, &error) < 0)
{
//fprintf(stderr, __FILE__": pa_simple_drain() failed: %s\n", pa_strerror(error));
//goto finish;
}
pa_simple_free(s_pulse_tx);
s_pulse_tx = NULL;
//qDebug()<<"---------------"<<"Destroy PULSE";
}
}
bool is_pulse_a_out = true;//2.65 by default
bool Rawplayer::lin_initialize(char *device_name)
{
s_pulse_tx = NULL;
//if ((QString)device_name=="pulse") is_pulse_a_out = true;
//else is_pulse_a_out = false;
QString str_device_name = (QString)device_name;
if (str_device_name.mid(0,7)=="pulse: ") is_pulse_a_out = true;
else is_pulse_a_out = false;
rawspeed = 11025;// tova e nai niskoto
rawsamplesize =16;
rawstereo = 1;
rawchannels = 2;
int err = 0;
playback_handle = NULL;
if (!is_pulse_a_out)
{
/*if ((err = snd_pcm_open (&playback_handle, device_name, SND_PCM_STREAM_PLAYBACK,0)) < 0)
{
fprintf (stderr, "cannot open audio device %s (%s)\n", device_name, snd_strerror (err));
return false;
}*/
bool errtagn = true;
if ((err = snd_pcm_open (&playback_handle, device_name, SND_PCM_STREAM_PLAYBACK,0)) < 0)
{
errtagn = false;
}
int c_retry = 0;
while (!errtagn)
{
usleep(100000);
if ((err = snd_pcm_open (&playback_handle, device_name, SND_PCM_STREAM_PLAYBACK,0)) < 0)
errtagn = false;
else
errtagn = true;
c_retry++;
if (c_retry>120) break;
}
if (!errtagn)
{
fprintf (stderr, "cannot open audio device %s (%s)\n", device_name, snd_strerror (err));
return false;
}
//qDebug()<<"---------------"<<"initialize ALSA"<<playback_handle<<errtagn<<device_name;
}
else
{
/*int is_little_endian = 1; // Test machine byte order
if (*(char *)&is_little_endian == 1)
is_little_endian = 1;
else
is_little_endian = 0;
//is_little_endian = 0; // test*/
pa_sample_format_t Format_LE_BE = PA_SAMPLE_S16LE;
//if (!is_little_endian) Format_LE_BE = PA_SAMPLE_S16BE;
pa_sample_spec ss;
ss.format = Format_LE_BE;
ss.rate = (uint32_t)Rawplayer::pa_sa_rate;
ss.channels = 2;
/*int latency = 200000;//in useconds 1000000;
pa_buffer_attr bufattr;
//memset(&bufattr, 0, sizeof(bufattr));
bufattr.fragsize = (uint32_t)-1;//=255
bufattr.maxlength = pa_usec_to_bytes(latency,&ss);
bufattr.minreq = pa_usec_to_bytes(0,&ss);
bufattr.prebuf = (uint32_t)-1;//=255
bufattr.tlength = pa_usec_to_bytes(latency,&ss);*/
int error = 0;
str_device_name.remove("pulse: ");
if (str_device_name == "default")
{
//qDebug()<<"-----------------------"<<"default";
if (!(s_pulse_tx = pa_simple_new(NULL, "MSHV", PA_STREAM_PLAYBACK, NULL, "Transmit", &ss, NULL, NULL, &error)))
{
//fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
return false;
}
}
else
{
//char *ddevv = q-strdup(qPrintable(str_device_name));
static char ddevv[128];//2.50
strncpy(ddevv,str_device_name.toUtf8(),127);
//qDebug()<<"-----------------------"<<ddevv;
if (!(s_pulse_tx = pa_simple_new(NULL, "MSHV", PA_STREAM_PLAYBACK, ddevv, "Transmit", &ss, NULL, NULL, &error)))
{
//fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
return false;
}
} //qDebug()<<"---------------"<<"initialize PULSE"<<(uint32_t)Rawplayer::pa_sa_rate;
}
audiobuffersize = 4096;//vazno ina4e garmi wav
return true;
}
bool Rawplayer::lin_resetsoundtype()
{
if (!is_pulse_a_out)
{
//qDebug()<<"lin_out"<<rawchannels<<rawsamplesize<<rawspeed;
int err = 0;
snd_pcm_hw_params_t *hw_params = NULL;//alsa
snd_pcm_drop(playback_handle);// iztriva bufera immediatly vazno hv
snd_pcm_drain(playback_handle); // vazno hv
//snd_pcm_format_t format;
//snd_pcm_reset(playback_handle);
//snd_pcm_hwsync(playback_handle);
if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0)
{
fprintf (stderr, "cannot allocate hardware parameter structure (%s)\n",snd_strerror (err));
return false;
}
if ((err = snd_pcm_hw_params_any(playback_handle, hw_params)) < 0)
{
fprintf (stderr, "cannot initialize hardware parameter structure (%s)\n",snd_strerror (err));
return false;
}
//SND_PCM_ACCESS_RW_INTERLEAVED SND_PCM_ACCESS_MMAP_INTERLEAVED
if ((err = snd_pcm_hw_params_set_access(playback_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
{
fprintf (stderr, "cannot set access type (%s)\n",snd_strerror (err));
return false;
}
if ((err = snd_pcm_hw_params_set_rate_resample(playback_handle, hw_params, 1)) < 0)
{
fprintf (stderr, "cannot resample (%s)\n",snd_strerror (err));
return false;
}
//SND_PCM_FORMAT_S16_LE
if ((err = snd_pcm_hw_params_set_format (playback_handle, hw_params, SND_PCM_FORMAT_S16_LE)) < 0)
{
fprintf (stderr, "cannot set sample format (%s)\n",snd_strerror (err));
return false;
}
//rawspeed = 48000;//(unsigned*)&rawspeed
if ((err = snd_pcm_hw_params_set_rate(playback_handle, hw_params, rawspeed, 0)) < 0)
//if ((err = snd_pcm_hw_params_set_rate_near (playback_handle, hw_params, (unsigned*)&rawspeed, 0)) < 0)
{
fprintf (stderr, "cannot set sample rate (%s)\n",snd_strerror (err));
return false;
}
//qDebug()<<"Chanels"<<rawchannels;
//rawchannels = 1;
if ((err = snd_pcm_hw_params_set_channels(playback_handle, hw_params, rawchannels)) < 0)
{
fprintf (stderr, "cannot set channel count (%s)\n",snd_strerror (err));
return false;
}
/////////////////////////////// seutp buffers hv /////////////////////////////////////////
unsigned periodss = 12; // x-fi via ich5
snd_pcm_uframes_t buffer_size = 4069; // x-fi via ich5
snd_pcm_uframes_t period_size = 1800; // x-fi via ich5
if ((err = snd_pcm_hw_params_set_periods_near(playback_handle, hw_params, &periodss, 0)) < 0)
{
fprintf (stderr, "cannot set number of periods (%s)\n", snd_strerror (err));
return false;
}
if ((err = snd_pcm_hw_params_set_period_size_near (playback_handle, hw_params, &period_size, 0)) < 0)
{
fprintf (stderr, "cannot set period size (%s)\n", snd_strerror (err));
return false;
}
if ((err = snd_pcm_hw_params_set_buffer_size_near (playback_handle, hw_params, &buffer_size)) < 0)
{
fprintf (stderr, "cannot set buffer size (%s)\n", snd_strerror (err));
return false;
}
if ((err = snd_pcm_hw_params (playback_handle, hw_params)) < 0)
{
fprintf (stderr, "cannot set parameters (%s)\n",snd_strerror (err));
return false;
}
snd_pcm_hw_params_free(hw_params);
snd_pcm_sw_params_t *sw_params;
if ((err = snd_pcm_sw_params_malloc (&sw_params)) < 0)
{
fprintf (stderr, "cannot allocate software parameters structure (%s)\n", snd_strerror (err));
return false;
}
if ((err = snd_pcm_sw_params_current (playback_handle, sw_params)) < 0)
{
fprintf (stderr, "cannot initialize software parameters structure (%s)\n", snd_strerror (err));
return false;
}
if ((err = snd_pcm_sw_params_set_avail_min (playback_handle, sw_params, 1024)) < 0)
{
fprintf (stderr, "cannot set minimum available count (%s)\n", snd_strerror (err));
return false;
}
if ((err = snd_pcm_sw_params_set_start_threshold (playback_handle, sw_params, 0U)) < 0)
{
fprintf (stderr, "cannot set start mode (%s)\n", snd_strerror (err));
return false;
}
if ((err = snd_pcm_sw_params (playback_handle, sw_params)) < 0)
{
fprintf (stderr, "cannot set software parameters (%s)\n", snd_strerror (err));
return false;
}
snd_pcm_sw_params_free(sw_params);
snd_pcm_prepare (playback_handle);
//unsigned int tmp;
//snd_pcm_hw_params_get_rate(hw_params, &tmp, 0);
//qDebug()<<"---------------"<<"resetsoundtype ALSA";
}
return true;
}
bool Rawplayer::lin_putblock(void *buffer,int size)
{
if (!is_pulse_a_out)
{
int err;
int frames = (size / rawchannels / sizeof(int16_t));// frames=1024 size=4096
//short int *buffer1 = dsp((short int *)buffer, ((size/2)));//hv & 0xFF
int16_t *framedata = (int16_t*)buffer;
//int16_t *framedata = new int16_t[frames];
//memcpy(buffer,(int16_t*)framedata,frames);
if ((err = snd_pcm_writei (playback_handle,framedata,frames)) != frames)
{
snd_pcm_prepare (playback_handle);
fprintf (stderr, "write to audio interface failed (%s)\n",
snd_strerror (err));
return false;
}
}
else
{
int error = 0;
if (pa_simple_write(s_pulse_tx, buffer, size, &error) < 0)
{
//fprintf(stderr, __FILE__": pa_simple_write() failed: %s\n", pa_strerror(error));
return false;
}
}
return true;
}
#endif

View File

@ -0,0 +1,619 @@
/* MPEG Sound library
(C) 1997 by Woo-jae Jung */
// Mpegsound.h
// This is typeset for functions in MPEG Sound library.
// Now, it's for only linux-pc-?86
// Updated For MSHV by Hrisimir Hristov, LZ2HV 2015
/************************************/
/* Inlcude default library packages */
/************************************/
#include "../../config.h"
#include "config.h"
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#if defined _LINUX_
#ifdef PTHREADEDMPEG
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#else
#ifdef HAVE_PTHREAD_MIT_PTHREAD_H
#include <pthread/mit/pthread.h>
#endif
#endif
#endif
#endif
#ifndef _L__SOUND__
#define _L__SOUND__
/****************/
/* Sound Errors */
/****************/
// General error
#define SOUND_ERROR_OK 0
#define SOUND_ERROR_FINISH -1
// Device error (for player)
#define SOUND_ERROR_DEVOPENFAIL 1
#define SOUND_ERROR_DEVBUSY 2
#define SOUND_ERROR_DEVBADBUFFERSIZE 3
#define SOUND_ERROR_DEVCTRLERROR 4
// Sound file (for reader)
#define SOUND_ERROR_FILEOPENFAIL 5
#define SOUND_ERROR_FILEREADFAIL 6
// Network
#define SOUND_ERROR_UNKNOWNPROXY 7
#define SOUND_ERROR_UNKNOWNHOST 8
#define SOUND_ERROR_SOCKET 9
#define SOUND_ERROR_CONNECT 10
#define SOUND_ERROR_FDOPEN 11
#define SOUND_ERROR_HTTPFAIL 12
#define SOUND_ERROR_HTTPWRITEFAIL 13
#define SOUND_ERROR_TOOMANYRELOC 14
// Miscellneous (for translater)
#define SOUND_ERROR_MEMORYNOTENOUGH 15
#define SOUND_ERROR_EOF 16
#define SOUND_ERROR_BAD 17
#define SOUND_ERROR_THREADFAIL 18
#define SOUND_ERROR_UNKNOWN 19
//#define SOUND_ERROR_BADHEADER 20 //ogg
/**************************/
/* Define values for MPEG */
/**************************/
#define SCALEBLOCK 12
#define CALCBUFFERSIZE 512
#define MAXSUBBAND 32
#define MAXCHANNEL 2
#define MAXTABLE 2
#define SCALE 32768
#define MAXSCALE (SCALE-1)
#define MINSCALE (-SCALE)
#define RAWDATASIZE (2*2*32*SSLIMIT)
#define LS 0
#define RS 1
#define SSLIMIT 18
#define SBLIMIT 32
#define WINDOWSIZE 4096
// Huffmancode
#define HTN 34
/*******************************************/
/* Define values for Microsoft WAVE format */
/*******************************************/
/*#define RIFF 0x46464952
#define WAVE 0x45564157
#define FMT 0x20746D66
#define DATA 0x61746164
#define PCM_CODE 1
#define WAVE_MONO 1
#define WAVE_STEREO 2
#define FRAMESIZE (2048) //hv zaradi wav formata hv be6e 4096 no zaradi skalata v msec e 2048
#define MODE_MONO 0
#define MODE_STEREO 1
*/
#ifdef WORDS_BIGENDIAN
#define RIFF 0x52494646
#define WAVE 0x57415645
#define FMT 0x666D7420
#define DATA 0x64617461
#define PCM_CODE (1 << 8)
#define WAVE_MONO (1 << 8)
#define WAVE_STEREO (2 << 8)
#define MODE_MONO 0
#define MODE_STEREO 1
#else
#define RIFF 0x46464952
#define WAVE 0x45564157
#define FMT 0x20746D66
#define DATA 0x61746164
#define PCM_CODE 1
#define WAVE_MONO 1
#define WAVE_STEREO 2
#define MODE_MONO 0
#define MODE_STEREO 1
#endif
//#define FRAMESIZE (2048) //hv zaradi wav formata hv be6e 4096 no zaradi skalata v msec e 2048
#include <stdint.h>
typedef uint32_t u_int32_t;
typedef uint16_t u_int16_t;
enum soundtype { NONE, RAW, WAV };
typedef struct _waveheader
{
u_int32_t main_chunk; // 'RIFF'
u_int32_t length; // filelen
u_int32_t chunk_type; // 'WAVE'
u_int32_t sub_chunk; // 'fmt '
u_int32_t sc_len; // length of sub_chunk, =16
u_int16_t format; // should be 1 for PCM-code
u_int16_t modus; // 1 Mono, 2 Stereo
u_int32_t sample_fq; // frequence of sample
u_int32_t byte_p_sec;
u_int16_t byte_p_spl; // samplesize; 1 or 2 bytes
u_int16_t bit_p_spl; // 8, 12 or 16 bit
u_int32_t data_chunk; // 'data'
u_int32_t data_length; // samplecount
}
WAVEHEADER;
/*********************************/
/* Sound input interface classes */
/*********************************/
// Superclass for Inputbitstream // Yet, Temporary
class Soundinputstream
{
public:
Soundinputstream();
virtual ~Soundinputstream();
static Soundinputstream *hopen(char *filename,int *errcode);
int geterrorcode(void)
{
return __errorcode;
};
virtual bool open(char *filename) =0;
virtual int getbytedirect(void) =0;
virtual bool _readbuffer(char *buffer,int size)=0;
virtual bool eof(void) =0;
virtual int getblock(char *buffer,int size) =0;
virtual int getsize(void) =0;
virtual int getposition(void) =0;
virtual void setposition(int pos) =0;
protected:
void seterrorcode(int errorcode)
{
__errorcode=errorcode;
};
private:
int __errorcode;
};
// Inputstream from file
class Soundinputstreamfromfile : public Soundinputstream
{
public:
Soundinputstreamfromfile()
{
fp=NULL;
size=0;
};
~Soundinputstreamfromfile();
bool open(char *filename);
bool _readbuffer(char *buffer,int bytes);
int getbytedirect(void);
bool eof(void);
int getblock(char *buffer,int size);
int getsize(void);
int getposition(void);
void setposition(int pos);
private:
FILE *fp;
int size;
};
class Soundplayer_wr
{
public:
Soundplayer_wr() {__errorcode=SOUND_ERROR_OK;};
virtual ~Soundplayer_wr();
virtual void abort(void);
virtual bool setsoundtype(int stereo,int samplesize,int speed)=0;
virtual void set8bitmode()=0;
virtual bool resetsoundtype(void);
virtual void releasedevice(void) = 0;
virtual bool attachdevice(void) = 0;
virtual bool putblock(void *buffer,int size) =0;
virtual int putblock_nt(void *buffer, int size) =0;
virtual int getblocksize(void);
int geterrorcode(void) {return __errorcode;};
protected:
bool seterrorcode(int errorno) {__errorcode=errorno; return false;};
private:
int __errorcode;
};
class Rawtofile_wr : public Soundplayer_wr
{
public:
~Rawtofile_wr();
static Rawtofile_wr *opendevice(char *filename);
bool setsoundtype(int stereo,int samplesize,int speed);
void set8bitmode() { want8bit = 1; }
bool setfiletype(enum soundtype);
bool putblock(void *buffer,int size);
int putblock_nt(void *buffer,int size);
void releasedevice(void) {};
bool attachdevice(void) { return true; };
private:
Rawtofile_wr();
int init_putblock;
int rawstereo,rawsamplesize,rawspeed,want8bit;
soundtype filetype;
WAVEHEADER hdr;
};
/**********************************/
/* Sound player interface classes */
/**********************************/
// Superclass for player
class Soundplayer
{
public:
Soundplayer()
{
__errorcode=SOUND_ERROR_OK;
};
virtual ~Soundplayer();
virtual bool initialize(char *filename) =0;
virtual void abort(void);
virtual int getprocessed(void);
virtual bool setsoundtype(int stereo,int samplesize,int speed)=0;
virtual bool resetsoundtype(void);
virtual bool putblock(void *buffer,int size) =0;
virtual int getblocksize(void);
int geterrorcode(void)
{
return __errorcode;
};
virtual bool gettci(void)
{
return false;
};
protected:
bool seterrorcode(int errorno)
{
__errorcode=errorno;
return false;
};
private:
int __errorcode;
};
#if defined _WIN32_
#include "../../Hv_Lib_DirectX90c/dsound.h"
#endif
#if defined _LINUX_
// Class for playing raw data
#include <alsa/asoundlib.h>//hv for alsa sound
#endif
//static LPDIRECTSOUNDBUFFER hdsbuf = NULL;
//#include <windows.h>
#include <QObject> // hv
//#include "../../HvEq/eqbiquadhv.h" //hv
//////////////////////////////////////////////////////////////////////////////////////////
class Rawtodata : public QObject, public Soundplayer //hv
{
Q_OBJECT // hv
public:
~Rawtodata();
bool initialize(char*);
int getprocessed(void);
bool setsoundtype(int stereo,int samplesize,int speed);
bool putblock(void *buffer,int size);
int getblocksize(void);
void setquota(int q)
{
quota=q;
};
int getquota(void)
{
return quota;
};
signals://hv
void SentData(short*, int, bool);//1.27 psk rep fopen bool true
private:
int quota;
int audiobuffersize;
//bool forcetomono,forceto8;
int rawstereo,rawsamplesize,rawspeed,rawchannels;//for alsa rawchannels hv
};
////////////////////////////////////////////////////////////////////////////////////////////
//#include "HvRawFilter/hvrawfilter.h" //hv
class Rawplayer : public Soundplayer //hv public QObject,
{
//Q_OBJECT // hv
public:
~Rawplayer();
bool initialize(char *drv_name);
void abort(void);
int getprocessed(void);
bool setsoundtype(int stereo,int samplesize,int speed);
bool resetsoundtype(void);
bool putblock(void *buffer,int size);
int getblocksize(void);
void setquota(int q)
{
quota=q;
};
int getquota(void)
{
return quota;
};
bool gettci(void)
{
return ftci;//2.58 need for GenMessage
};
static char *defaultdevice;
//static bool defaultdrv;//hv
static int buffering;
#if defined _LINUX_
static int pa_sa_rate;
//static int setvolume_lin(int volume);
#endif
//signals:
private:
bool ftci;
int rawbuffersize;
int audiohandle,audiobuffersize;
int rawstereo,rawsamplesize,rawspeed,rawchannels;//for alsa rawchannels hv
//bool forcetomono,forceto8;
int quota;
#if defined _WIN32_
//WaveOut
HWAVEOUT m_hOut;
int s_dwInstance;
int m_dwAudioOutId;
int wo_read_wr_offset;
//DirectSound
LPDIRECTSOUNDBUFFER lpDirectSoundBuffer;
DSBUFFERDESC playbackBuff;
LPDIRECTSOUND lpDirectSound;
int ds_read_wr_offset;
//Windows Sound ALL
bool win_putblock(void *buffer,int size);
bool win_initialize(char *device_name);
bool win_resetsoundtype(int channels,int samplesize,int speed, int buffer);
void win_abort();
void win_destroy();
#endif
#if defined _LINUX_
snd_pcm_t *playback_handle;//hv
void lin_destroy();
bool lin_initialize(char *device_name);
bool lin_resetsoundtype();
bool lin_putblock(void *buffer,int size);
snd_pcm_format_t check_formats(snd_pcm_t *h, snd_pcm_hw_params_t *hware);
#endif
int buffer_size;
int write_position;
int save_channels,save_samplesize,save_speed, save_buffer;
};
/*********************************/
/* Data format converter classes */
/*********************************/
// Class for converting wave format to raw format
#include <QWidget>
//#include <QMessageBox>
class Wavetoraw : public QWidget // for nessage box
{
//Q_OBJECT
public:
Wavetoraw(Soundinputstream *loader,Soundplayer *player/*,QWidget * parent = 0*/);
~Wavetoraw();
bool initialize(int srate);
void setforcetomono(bool flag)
{
forcetomonoflag=flag;
};
bool run(void);
int getfrequency(void) const
{
return speed;
};
bool isstereo(void) const
{
return stereo;
};
int getsamplesize(void) const
{
return samplesize;
};
int geterrorcode(void) const
{
return __errorcode;
};
int gettotallength(void) const
{
return size/pcmsize;
};
int getcurrentpoint(void) const
{
return currentpoint/pcmsize;
};
void setcurrentpoint(int p);
private:
int s_max_period;
int s_srate;
int __errorcode;
void seterrorcode(int errorcode)
{
__errorcode=errorcode;
};
bool forcetomonoflag;
Soundinputstream *loader;
Soundplayer *player;
bool initialized;
char *buffer;
int buffersize;
int samplesize,speed,stereo;
int currentpoint,size;
int pcmsize;
bool testwave(char *buffer);
};
#include <complex.h> // gnu++11
#define complex _Complex
#include "HvGenMsk/genmesage_msk.h"
#include "HvGen65/gen65.h"
#include "HvGenFt8/gen_ft8.h"
#include "HvGenFt4/gen_ft4.h"
#include "HvGenQ65/gen_q65.h"
#include "HvRawFilter/hvrawfilter.h" //hv
#define IWAVE_BUFFER (48000*140) //2.53=2min.20sec 62s*48000=2976000 60s*48000=2880000
class GenMessage //: public QObject
{
//Q_OBJECT
public:
GenMessage(Soundplayer *player);
~GenMessage();
//int getblock2(char *buffer,int size){ return 0; };
bool initialize(char*,int mod_iden,double tx_freq,int);//,int &ntxslot QString mygridl,
void setforcetomono(bool flag)
{
forcetomonoflag=flag;
};
bool run(void);
int getfrequency(void) const
{
return speed;
};
bool isstereo(void) const
{
return stereo;
};
int getsamplesize(void) const
{
return samplesize;
};
int geterrorcode(void) const
{
return __errorcode;
};
GenMsk *TGenMsk;
Gen65 *TGen65;
GenFt8 *TGenFt8;
GenFt4 *TGenFt4;
GenQ65 *TGenQ65;
static int setvolume_all(int volume);
void mute_hv(bool);//hv
//signals:
//void SendUnpackMsg(QString msg);
private:
bool ftci;
bool f_rawf;
bool f_gens;
HvRawFilter *THvRawFilter;//hv
bool mute_raw;//hv
QString s_MyGridLoc; //for " R " in msg 1.31
int s_mode;
double twopi;
int __errorcode;
void seterrorcode(int errorcode)
{
__errorcode=errorcode;
};
bool forcetomonoflag;
//Soundinputstream *loader;
Soundplayer *player;
bool initialized;
char buffer_gmsgc[8192]; //4096
short buffer_gmsgs[8192]; //tci=4096<-max
int buffersize_gmsg;
int samplesize,speed,stereo;
int size; //currentpoint,
int pcmsize;
bool testwave();
double GEN_SAMPLE_RATE;
double koef_srate;
int BITS_PER_SAMPLE;
int abc441(char*,int);
int genms(char*,double,int);
///////////// JT6M /////////////////////////////////////
int gen6m(char*,double);
int gentone(double *x,int n,int k,double samfac);
///////////// JT6M /////////////////////////////////////
///////////// ISCAT /////////////////////////////////////
int geniscat(char *msg,int nmsg,int mode4,double samfac);
///////////// ISCAT /////////////////////////////////////
//double complex cwave[30*48000];// max rate app is 44100 30seconds
short itone_s[4096]; //=4096 max = 1291 iscat
int iwave_count;
short iwave[IWAVE_BUFFER]; //=5952000 2486948 62s*48000=2976000 60s*48000=2880000
int iwave_size;
bool getblock_raws(short*,int);
bool getblock_rawc(char*,int);
QString format_msg(char *message_in, int cmsg);
int hvmsgen(char*,int mod_ident,double tx_freq,int);//,int &ntxslot ,QString
//char *s_msg;
//int s_period_t;
};
#endif

View File

@ -0,0 +1,65 @@
/* MPEG Sound library
(C) 1997 by Jung woo-jae */
// Mpegsound_locals.h
// It is used for compiling library
#ifndef _L__SOUND_LOCALS__
#define _L__SOUND_LOCALS__
// Inline functions
inline int Mpegtoraw::getbyte(void)
{
int r=(unsigned char)buffer[bitindex>>3];
bitindex+=8;
return r;
};
inline int Mpegtoraw::getbits9(int bits)
{
register unsigned short a;
#ifndef WORDS_BIGENDIAN
{
int offset=bitindex>>3;
a=(((unsigned char)buffer[offset])<<8) | ((unsigned char)buffer[offset+1]);
}
#else
a=*((unsigned short *)(buffer+((bitindex>>3))));
#endif
a<<=(bitindex&7);
bitindex+=bits;
return (int)((unsigned int)(a>>(16-bits)));
};
inline int Mpegtoraw::getbits8(void)
{
register unsigned short a;
#ifndef WORDS_BIGENDIAN
{
int offset=bitindex>>3;
a=(((unsigned char)buffer[offset])<<8) | ((unsigned char)buffer[offset+1]);
}
#else
a=*((unsigned short *)(buffer+((bitindex>>3))));
#endif
a<<=(bitindex&7);
bitindex+=8;
return (int)((unsigned int)(a>>8));
};
inline int Mpegtoraw::getbit(void)
{
register int r=(buffer[bitindex>>3]>>(7-(bitindex&7)))&1;
bitindex++;
return r;
};
#endif

View File

@ -0,0 +1,265 @@
#include "../../config.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <fcntl.h>
#include <unistd.h>
#include <math.h> //zaradi log hv
#include "mpegsound.h"
/* IOCTL */
#ifdef SOUND_VERSION
#define IOCTL(a,b,c) ioctl(a,b,&c)
#else
#define IOCTL(a,b,c) (c = ioctl(a,b,c) )
#endif
#include <QRegExp>//hv
//#include <QtGui>
#if defined _LINUX_
char *Rawplayer::defaultdevice=(char*)"pulse: default";//2.65 "pulse: default" OSS="/dev/dsp"
int Rawplayer::buffering = 1000;
int Rawplayer::pa_sa_rate = 44100;
#endif
#if defined _WIN32_ //Primary Sound Driver or "0"
char *Rawplayer::defaultdevice=(char*)"Primary Sound Driver";
int Rawplayer::buffering = 1000;//1.42 600 to 1000 default
#endif
//bool Rawplayer::defaultdrv=false; //hv
//static char *saved_device;
static int buff_hv;
/*
#if defined _LINUX_
static int saved_volume_mixer;//hv zaradi smqnata na dsp
#endif
*/
// Volume
/*
int Rawplayer::setvolume_all(int volume)
{
vol_win = (4.615583-log(101-volume))/4.615583; // to4nost 0.0001002;
//qDebug()<<vol_win<<volume;
return 0;
}
*/
/*
#if defined _LINUX_
int Rawplayer::setvolume_lin(int volume)
{
int r = -1;
saved_volume_mixer = volume;
QString cardName_hv;
QString dev = saved_device;//Rawplayer::defaultdevice;
QRegExp rx("hw:(\\d+)");
if (rx.indexIn(dev) != -1)
cardName_hv = rx.cap(1);
cardName_hv = "hw:"+cardName_hv;
//qDebug()<<cardName_hv;
int err;
long mixerMin, mixerMax,setVol;
double mixerRange,volPercent;
char *mName = (char*)"PCM";//cardName = "hw:1";//"PCM"
snd_mixer_t *mHandle;
snd_mixer_elem_t *mElem;
snd_mixer_selem_id_t *sId;
snd_mixer_selem_id_alloca(&sId);
snd_mixer_selem_id_set_name(sId, mName);
if ((err = snd_mixer_open(&mHandle, 0)) < 0)
{
static int once = 0;
if (!once)
{
fprintf (stderr,"[softdevice-audio]: cannot open mixer: %s (%s)",
mName,snd_strerror(err));
once = 1;
}
return -1;
}
snd_mixer_attach(mHandle, cardName_hv.toLatin1()); //cardName_hv.toLatin1() -> cardName hv
snd_mixer_selem_register(mHandle, NULL, NULL);
snd_mixer_load(mHandle);
mElem = snd_mixer_find_selem(mHandle,sId);
if (mElem)
{
snd_mixer_selem_get_playback_volume_range(mElem,&mixerMin,&mixerMax);
mixerRange = mixerMax - mixerMin;
volPercent = (double) saved_volume_mixer / 100.0;//255.0
setVol = (int) (((double)mixerMin+(mixerRange*volPercent))+0.5);
snd_mixer_selem_set_playback_volume(mElem,SND_MIXER_SCHN_FRONT_LEFT,setVol);
snd_mixer_selem_set_playback_volume(mElem,SND_MIXER_SCHN_FRONT_RIGHT,setVol);
if (snd_mixer_selem_has_playback_switch(mElem))
{
snd_mixer_selem_set_playback_switch_all(mElem, (saved_volume_mixer) ? 1 : 0);
}
}
//qDebug()<<mElem;
snd_mixer_close(mHandle);
return (r&0xFF);
}
#endif
*/
/*
short int *Rawplayer::win_vol_ctrl(short int *data, const int size)
{
for (int i = 0; i < size; i+=2)
{
data[i] = data[i]*vol_win;
data[i+1] = data[i+1]*vol_win;
}
return data;
}
*/
/*******************/
/* Rawplayer class */
/*******************/
// Rawplayer class
#include "../../HvRigControl/HvRigCat/network/network.h"
Rawplayer::~Rawplayer()
{
//qDebug()<<"Destroy";
if (ftci)
{
_SetTciBuffReset_();
return;
}
#if defined _WIN32_
win_destroy();
#endif
#if defined _LINUX_
lin_destroy();
#endif
}
bool Rawplayer::initialize(char *device_name)
{
//qDebug()<<"initialize";
audiobuffersize = 4096;//1024;//4096;
//saved_device = Rawplayer::defaultdevice;
buff_hv = Rawplayer::buffering;
QString str_device_name = (QString)device_name;
if (str_device_name=="TCI Client Output")
{
_SetTciBuffReset_();
ftci = true; //audiobuffersize = 8192;
}
else ftci = false;
if (ftci) return true;
#if defined _WIN32_
return win_initialize(device_name);
#endif
#if defined _LINUX_
return lin_initialize(device_name);
#endif
return true;
}
/*
void Rawplayer::set_tx_filter_parm(int gain, double f0, double f1, bool type)
{
THvRawFilter->filter_parm(gain,f0,f1,type);
}
*/
void Rawplayer::abort(void)
{
//qDebug()<<"abort";
if (ftci)
{
_SetTciBuffReset_();//exeption needed HV
return;
}
#if defined _WIN32_
win_abort();
#endif
}
int Rawplayer::getprocessed(void)
{
//qDebug()<<"gerprocessed";
return 1;
}
bool Rawplayer::setsoundtype(int stereo,int samplesize,int speed)
{
// pauza e prez tazi (procedura + resetsoundtype(void)) a stop e samo resetsoundtype(void)
//THvRawFilter->set_rate((double)speed);
rawstereo=stereo;
rawsamplesize=samplesize;
rawspeed=speed;
if (stereo==0) rawchannels = 1;
if (stereo==1) rawchannels = 2;
#if defined _LINUX_
rawchannels = 2;
#endif
//forcetomono=forceto8=false;
//qDebug()<<"uuu"<<rawchannels<<rawspeed<<rawsamplesize;
return resetsoundtype();
}
bool Rawplayer::resetsoundtype(void)
{
//qDebug()<<"reset_sine_cw";
if (ftci) return true;
#if defined _WIN32_
return win_resetsoundtype(rawchannels,rawsamplesize,rawspeed,buff_hv);
#endif
#if defined _LINUX_
return lin_resetsoundtype();
#endif
}
//void * fast_memcpy(void * to, const void * from, size_t len);
//#define fast_memcpy(a,b,c) memcpy(a,b,c)
//#include <QTime>
//QElapsedTimer ttt;
bool Rawplayer::putblock(void *buffer,int size)
{
if (ftci)//tci
{
/*ttt.start();
bool bbb = _SetTxAudioTci_((short*)buffer,size);
qDebug()<<ttt.elapsed();
return bbb;*/
return _SetTxAudioTci_((short*)buffer);
}
else
{
#if defined _WIN32_
return win_putblock(buffer,size);
#endif
#if defined _LINUX_
return lin_putblock(buffer,size);
#endif
}
return 0;
}
int Rawplayer::getblocksize(void)
{
return audiobuffersize;
}
/*short shortraw[16385];//tci=8192<-max
int j = 0;
unsigned char *uch = (unsigned char*)buffer;
for (int i = 0; i < size; i+=4)
{
//little-endian form HV
shortraw[j] = (uch[i+1] << 8);
shortraw[j] |= uch[i];
j++;
shortraw[j] = (uch[i+3] << 8);
shortraw[j] |= uch[i+2];
j++;
//shortraw[j] = kkk;
//j++;
//shortraw[j] = kkk;
//j++;
}
//kkk ++;
return _SetTxAudioTci_(shortraw,size/2);*/

View File

@ -0,0 +1,112 @@
#include "../../config.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <fcntl.h>
#include <unistd.h>
//#include <math.h> //zaradi log hv
#include "mpegsound.h"
/* IOCTL */
#ifdef SOUND_VERSION
#define IOCTL(a,b,c) ioctl(a,b,&c)
#else
#define IOCTL(a,b,c) (c = ioctl(a,b,c) )
#endif
//#include <QRegExp>//hv
//#include <QtGui>
//char *Rawtodata::defaultdevice=(char*)"/dev/dsp";
//bool Rawtodata::defaultdrv=false; //hv
//int Rawtodata::buffering = 88200;//=500ms
//static char *saved_device;
//static bool saved_drv = false;
//static int buff_hv;
//static double vol_win = 0.0001;
/*******************/
/* Rawtodata class */
/*******************/
// Rawtodata class
Rawtodata::~Rawtodata()
{}
bool Rawtodata::initialize(char*)
{
audiobuffersize = 4096;
//audiobuffersize = 1024;
//size_ftt_window =345;//za 11025 i 30s
//count_ftt_window = 0;
// audiobuffersize = 345;
//saved_device = Rawtodata::defaultdevice;
//buff_hv = Rawtodata::buffering;
//qDebug()<<"initialize";
return true;
}
int Rawtodata::getprocessed(void)
{
//qDebug()<<"gerprocessed";
return 1;
}
bool Rawtodata::setsoundtype(int stereo,int samplesize,int speed)
{
// pauza e prez tazi (procedura + resetsoundtype(void)) a stop e samo resetsoundtype(void)
rawstereo=stereo;
rawsamplesize=samplesize;
rawspeed=speed;
if (stereo==0)
rawchannels = 1;
if (stereo==1)
rawchannels = 2;
//forcetomono=forceto8=false;
//return resetsoundtype();
//qDebug()<<stereo<<samplesize<<speed;
return true;
}
/*
bool Rawtodata::resetsoundtype(void)
{
//qDebug()<<"LINressss";
return win_resetsoundtype(saved_device,rawchannels,rawsamplesize,rawspeed,false,buff_hv);
}
*/
bool Rawtodata::putblock(void *buffer,int size)
{
/*short *shortArr=new short[size/2];
char *buf = (char*)buffer;
for (int i = 0; i <size/2 ; i++)
shortArr[i] = ((short)(( buf[i*2] & 0xff )|( buf[i*2 + 1] << 8 )));
SentData(shortArr,size/2,true);
qDebug()<<(int)buf[0];
qDebug()<<(int)buf[1];
qDebug()<<(int)shortArr[0];*/
emit SentData((short*)buffer,size/2,true);//1.27 psk rep fopen
/*short *k = (short*)buffer;
qDebug()<<k[0]<<"0";
qDebug()<<k[1]<<"1";
qDebug()<<k[2]<<"3";
qDebug()<<k[4]<<"4";
qDebug()<<k[5]<<"5";
qDebug()<<k[6]<<"6";*/
return true;
}
int Rawtodata::getblocksize(void)
{
return audiobuffersize;
}

View File

@ -0,0 +1,193 @@
/* MPEG/WAVE Sound library
(C) 1997 by Jung woo-jae */
// Rawtofile.cc
// Output raw data to file.
//#include <QtGui>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <fcntl.h>
#include <unistd.h>
#include "mpegsound.h"
#include <fstream> //ofstream
using namespace std; //ofstream
//#include "mpegsound_locals.h"
//#define WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
typedef union {
long arg;
char byte_represent[4];
} endian_hack_1;
typedef union {
short arg;
char byte_represent[2];
} endian_hack_2;
inline short HOST_TO_LE16(short x)
{
endian_hack_2 in,out;
in.arg=x;
out.arg=0;
out.byte_represent[0]=in.byte_represent[1];
out.byte_represent[1]=in.byte_represent[0];
return (short)out.arg;
}
inline int HOST_TO_LE32(int x)
{
endian_hack_1 in,out;
in.arg=x;
out.arg=0;
out.byte_represent[0]=in.byte_represent[3];
out.byte_represent[1]=in.byte_represent[2];
out.byte_represent[2]=in.byte_represent[1];
out.byte_represent[3]=in.byte_represent[0];
return out.arg;
}
#else
#define HOST_TO_LE16(x) (x)
#define HOST_TO_LE32(x) (x)
#endif
// Rawplayer class
//#define ZZ 0x000a1820
static ofstream out_stream;
Rawtofile_wr::~Rawtofile_wr()
{
//std::ofstream in("testout", std::ios::binary);
if (filetype == WAV)
{
//off_t filelen = lseek(audiohandle, 0, SEEK_CUR);
off_t filelen = out_stream.tellp();
//lseek(audiohandle, 0, SEEK_SET);
out_stream.seekp(out_stream.beg);
hdr.length = HOST_TO_LE32((u_int32_t)(filelen-8));
//qDebug()<<"fileLight"<<hdr.length;/* file length */
hdr.data_length = HOST_TO_LE32((u_int32_t)(filelen - 44));
//qDebug()<<"DataLight"<<hdr.data_length;
//write(audiohandle, (byte*)&hdr, sizeof(hdr));
out_stream.write((const char*)&hdr,sizeof(hdr));
}
//close(audiohandle);
out_stream.close();
}
Rawtofile_wr::Rawtofile_wr()
{
//this->audiohandle = audiohandle;
init_putblock = 1;
//2.12
rawstereo = 0;
rawsamplesize = 0;
rawspeed = 0;
want8bit = 0;
filetype = NONE;
hdr.length = 0;
//2.12
}
Rawtofile_wr *Rawtofile_wr::opendevice(char *filename)
{
out_stream.open(filename, ios::binary);
if (!out_stream.is_open())
return NULL;
return new Rawtofile_wr();
}
bool Rawtofile_wr::setsoundtype(int stereo,int samplesize,int speed)
{
//static bool myinit = false;// hv ne tragva vtori pat
bool myinit = false;
/* changing sample specs when writing to a file is not done! */
if (myinit && (
(rawstereo != stereo) ||
(rawsamplesize != samplesize) ||
(rawspeed != speed)))
{
//debug("Change in sample size/speed/mode.\n");
return false;
}
else
myinit = true;
rawstereo=stereo;
rawsamplesize=samplesize;
rawspeed=speed;
return true;
}
/* set type of file to write. Default: RAW (no header) */
bool Rawtofile_wr::setfiletype(soundtype filetype)
{
if (filetype != RAW && filetype != WAV)
return false;
this->filetype = filetype;
return true;
}
int Rawtofile_wr::putblock_nt(void *buffer, int size)
{
if (init_putblock && filetype != RAW)
{
int wordsize;
wordsize = rawsamplesize;
if (filetype == WAV)
{
//initial datasize = 0...when all data is written, determine filesize
//and rewrite the header.
hdr.main_chunk = RIFF;
hdr.length = HOST_TO_LE32(0 + 36); /* file length */
hdr.chunk_type = WAVE;
hdr.sub_chunk = FMT;
hdr.sc_len = HOST_TO_LE32(wordsize); /* = 16 */
hdr.format = PCM_CODE;
hdr.modus = (rawstereo ? WAVE_STEREO : WAVE_MONO); /* stereo, 1 = mono */
hdr.sample_fq = HOST_TO_LE32(rawspeed); /* sample frequency */
hdr.byte_p_sec = HOST_TO_LE32((rawspeed * (wordsize/8) * (rawstereo?2:1)));
hdr.byte_p_spl = HOST_TO_LE16((rawstereo?2:1) * (wordsize/8));//qDebug()<<"samplesize; 1 or 2 bytes="<<hdr.byte_p_spl;
hdr.bit_p_spl = HOST_TO_LE16(wordsize); /* 8, 12, or 16 bit */
hdr.data_chunk = DATA;
hdr.data_length = 0; /* file length without this header */
//if (write(audiohandle, &hdr, sizeof(hdr)) != sizeof(hdr))
//return false;
out_stream.write((const char*)&hdr, sizeof(hdr));
}
}
init_putblock = 0;
#ifdef WORDS_BIGENDIAN
if (rawsamplesize == 16)
{
/* big endian -> switch bytes in output file */
unsigned short *sh_buffer=(unsigned short *)(buffer);
int modifiedsize=size/2;
/* data is in 16 bits bigendian, target is 16 bits little endian. */
while (modifiedsize--)
{
sh_buffer[modifiedsize]=HOST_TO_LE16(sh_buffer[modifiedsize]);
}
}
#endif
//return write(audiohandle,buffer,size);
out_stream.write((const char*)buffer,size);
return 1;
}
bool Rawtofile_wr::putblock(void *buffer,int size)
{
return putblock_nt(buffer,size)==size;
}

View File

@ -0,0 +1,52 @@
/* MPEG Sound library
(C) 1997 by Woo-jae Jung */
// Soundinputstream.cc
// Abstractclass of inputstreams
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "mpegsound.h"
Soundinputstream::Soundinputstream()
{
__errorcode=SOUND_ERROR_OK;
}
Soundinputstream::~Soundinputstream()
{
// Nothing...
}
/********************/
/* File & Http open */
/********************/
Soundinputstream *Soundinputstream::hopen(char *filename,int *errorcode)
{
Soundinputstream *st;
if(filename==NULL)st=new Soundinputstreamfromfile;
//else if(strstr(filename,"://"))st=new Soundinputstreamfromhttp;
else st=new Soundinputstreamfromfile;
if(st==NULL)
{
*errorcode=SOUND_ERROR_MEMORYNOTENOUGH;
return NULL;
}
if(!st->open(filename))
{
*errorcode=st->geterrorcode();
delete st;
return NULL;
}
return st;
}

View File

@ -0,0 +1,40 @@
/* MPEG Sound library
(C) 1997 by Jung woo-jae */
// Soundplayer.cc
// Superclass of Rawplayer and Rawtofile
// It's used for set player of Mpegtoraw
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mpegsound.h"
/*********************/
/* Soundplayer class */
/*********************/
Soundplayer::~Soundplayer()
{
// Nothing...
}
void Soundplayer::abort(void)
{
// Nothing....
}
int Soundplayer::getprocessed(void)
{
return 0;
}
bool Soundplayer::resetsoundtype(void)
{
return true;
}
int Soundplayer::getblocksize(void)
{
return 1024; // Default value
}

View File

@ -0,0 +1,40 @@
/* MPEG/WAVE Sound library
(C) 1997 by Jung woo-jae */
// Soundplayer.cc
// Superclass of Rawplayer and Rawtofile
// It's used for set player of Mpegtoraw & Wavetoraw
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mpegsound.h"
/*********************/
/* Soundplayer class */
/*********************/
Soundplayer_wr::~Soundplayer_wr()
{
// Nothing...
}
void Soundplayer_wr::abort(void)
{
// Nothing....
}
bool Soundplayer_wr::resetsoundtype(void)
{
return true;
}
int Soundplayer_wr::getblocksize(void)
{
return 1024; // Default value
}
/*
int Soundplayer_win::fix_samplesize(void *buffer, int size)
{
buffer=buffer;
return size;
}
*/

View File

@ -0,0 +1,148 @@
/* MPEG/WAVE Sound library
(C) 1997 by Jung woo-jae */
// Wavetoraw.cc
// Server which strips wave header.
#include <malloc.h>
#include "mpegsound.h"
#include <QMessageBox>
//#define MAX_READ_SIZE 11025*30*2 // only 30s samplerate*Sec*2
//#include <QtGui>
Wavetoraw::Wavetoraw(Soundinputstream *loader,Soundplayer *player/*,QWidget * parent*/)
// : QWidget(parent)
{
__errorcode=SOUND_ERROR_OK;
initialized=false;
buffer=NULL;
this->loader=loader;
this->player=player;
//2.12
s_max_period = 0;
s_srate = 0;
forcetomonoflag = false;
buffersize = 0;
samplesize = 0;
speed = 0;
stereo = 0;
currentpoint = 0;
size = 0;
pcmsize = 1;
//2.12
}
Wavetoraw::~Wavetoraw()
{
if (buffer)free(buffer);
}
// Convert wave format to raw format class
bool Wavetoraw::initialize(int srate)
{
//s_max_period=max_period;
s_srate=srate;
if (!buffer)
{
buffersize=player->getblocksize();
if ((buffer=(char *)malloc(buffersize))==NULL)
{
seterrorcode(SOUND_ERROR_MEMORYNOTENOUGH);
return false;
}
}
return true;
}
bool Wavetoraw::run(void)
{
int c;
if (initialized)
{
c=loader->getblock(buffer,buffersize);
if (c==0)
{
seterrorcode(SOUND_ERROR_FILEREADFAIL);
return false;
}
currentpoint+=c;
if (player->putblock(buffer,buffersize)==false)return false;
if (currentpoint>=size)
//if(currentpoint>=currentpoint*pcmsize)
{
seterrorcode(SOUND_ERROR_FINISH);
return false;
}
}
else
{
c=loader->getblock(buffer,sizeof(WAVEHEADER));
if (c==0)
{
seterrorcode(SOUND_ERROR_FILEREADFAIL);
return false;
}
if (!testwave(buffer))return false;
if (player->setsoundtype(stereo,samplesize,speed)==false)return false;
currentpoint=0;
initialized=true;
}
return true;
}
void Wavetoraw::setcurrentpoint(int p)
{
if (p*pcmsize>size)currentpoint=size;
else currentpoint=p*pcmsize;
loader->setposition(currentpoint+sizeof(WAVEHEADER));
}
bool Wavetoraw::testwave(char *buffer)
{
WAVEHEADER *tmp=(WAVEHEADER *)buffer;
if (tmp->main_chunk==RIFF && tmp->chunk_type==WAVE &&
tmp->sub_chunk==FMT && tmp->data_chunk==DATA)
if (tmp->format==PCM_CODE && tmp->modus<=2)
{
stereo=(tmp->modus==WAVE_STEREO) ? 1 : 0;
samplesize=(int)(tmp->bit_p_spl);
speed=(int)(tmp->sample_fq);
pcmsize=1;
if (stereo==1)pcmsize*=2;
if (samplesize==16)pcmsize*=2;
//qDebug()<<pcmsize<<speed<<samplesize<<size<<tmp->data_length;
//int max_size = speed*s_max_period*2;
int max_size = speed*MAX_OPEN_WAW_TIME*2;//2.53 for q65=2min max old=speed*60*2;
if ((int)tmp->data_length<max_size)
size =(int)(tmp->data_length);
else
size = max_size;
if (s_srate!=0)// 0 no emit this message hv
{
if (s_srate!=speed)
{
QString text = "File sample rate is "+QString("%1").arg(speed)+
" Hz.\nFor this reason this file may not be decoded"+
" correctly.\nPlease, follow these steps:\n 1. Change mode.\n 2. "+
"Open the file again.\n12000 Hz sample rate for mode MSK, FT8, JT65 and PI4 "+
"files.\n11025 Hz sample rate for mode JTMS, FSK441, FSK315, ISCAT and JT6M files.";
QMessageBox::warning(this, " Warning ", text, QMessageBox::Close);
}
}
return true;
}
seterrorcode(SOUND_ERROR_BAD);
return false;
}

View File

@ -0,0 +1,221 @@
/* MSHV part of win sound out
* Copyright 2015 Hrisimir Hristov, LZ2HV
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "mpegsound.h"
#if defined _WIN32_
#include <unistd.h>
//#include <QtGui>
QString ConvertToStr_tout(LPCTSTR name)
{
QString s;
for (unsigned int i=0; i<wcslen(name); ++i)
s.push_back(name[i]);
//s.append(" Микрофон 128 で簡単に作れますが"); //for test coding utf-8
return s.toUtf8();
}
static bool _outfirst_ = false;
static LPGUID _outguid_;
static QString _outname_;//LPCTSTR=lpszDesc LPCTSTR=lpszDrvName=*.dll LPVOID=pContext
BOOL CALLBACK DSEnumProc_t_out(LPGUID lpGUID,LPCTSTR lpszDesc,LPCTSTR,LPVOID)
{
if (!_outfirst_)
{
if (_outname_ == ConvertToStr_tout(lpszDesc))
{
_outfirst_ = true;
_outguid_ = lpGUID; //qDebug()<<"Find Out="<<_outname_<<_outguid_;
}
}
return true;
}
static bool ds_play_flag = false;
void Rawplayer::win_abort()
{
if (ds_play_flag)
{
if (lpDirectSoundBuffer)
IDirectSoundBuffer_Stop(lpDirectSoundBuffer);
ds_play_flag = false;
}
}
void Rawplayer::win_destroy()
{
win_abort();
if (lpDirectSoundBuffer)
{
IDirectSoundBuffer_Release(lpDirectSoundBuffer);
//lpDirectSoundBuffer = NULL;
}
if (lpDirectSound)
{
IDirectSound_Release(lpDirectSound);
//lpDirectSound = NULL;
}
}
bool Rawplayer::win_initialize(char *device_name)
{
//qDebug()<<"win_initialize";
//QTime ttt; ttt.start();
lpDirectSoundBuffer = NULL;//2.37 w10
lpDirectSound = NULL;
HWND hwnd1 = NULL;
hwnd1 = GetForegroundWindow();
if (hwnd1 == NULL)//2.39 100% correct initialize error
{
//qDebug()<<"Error GetForegroundWindow"<<hwnd1;
hwnd1 = GetDesktopWindow();
}
if (hwnd1 == NULL)
{
//qDebug()<<"Final error="<<hwnd1;
return false;
}
DWORD pv; // Can be any 32-bit type.
_outfirst_ = false;
_outguid_ = (LPGUID)0;
_outname_ = (QString)device_name;
if (DS_OK != DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc_t_out, (VOID*)&pv))
{
//qDebug()<<"Failed to Enumerate";
return false;
}
HRESULT hr;
hr =DirectSoundCreate(_outguid_, &lpDirectSound, NULL); // create dsound object
if (hr != DS_OK)
{
//qDebug()<<"Failed to create dsound interface";
return false;
}
hr =IDirectSound_SetCooperativeLevel(lpDirectSound, hwnd1, DSSCL_PRIORITY); // Set coop level
if (hr != DS_OK)
{
//qDebug()<<"Failed to create playback buffer";
return false;
}
//qDebug()<<"create playback buffer"<<hwnd1<<DevHandles_t_out[dev.toInt()]<<hwnd1;
//IDirectSound_Compact(lpDirectSound);
//qDebug()<<ttt.elapsed();
//return false;
return true;
}
bool Rawplayer::win_resetsoundtype(int channels,int samplesize,int speed, int buffer_in)
{
lpDirectSoundBuffer = NULL;
//int buffer = (176400*buffer_in)/1000.0;
//ds bufer VAZNO HV ot ms v golemina
int buffer = (speed * ((double)( channels * samplesize ) / 8.0))*((double)buffer_in/1000.0);
//qDebug()<<channels<<samplesize<<speed<<buffer;
HRESULT hr;
PCMWAVEFORMAT pcmwf;
int SAMPLERATE = speed;
int AUDIOCHANNELS = channels;
int BITSPERSAMPLE = samplesize;
int SAMPLETIME = 4;//2.49 =4sec old=2sec
memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT)); // Set up wave format structure.
pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;
pcmwf.wf.nChannels = AUDIOCHANNELS;
pcmwf.wf.nSamplesPerSec = SAMPLERATE;
pcmwf.wf.nBlockAlign = (AUDIOCHANNELS * BITSPERSAMPLE) / 8; //BITSPERSAMPLE 16
pcmwf.wf.nAvgBytesPerSec = SAMPLERATE * (BITSPERSAMPLE /8) * AUDIOCHANNELS ; //pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign;
pcmwf.wBitsPerSample = BITSPERSAMPLE;
memset(&playbackBuff, 0, sizeof(DSBUFFERDESC)); // Set up DSBUFFERDESC structure. Zero it out.
playbackBuff.dwSize = sizeof(DSBUFFERDESC);
playbackBuff.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS ; //DSBCAPS_CTRLDEFAULT; // Need default controls (pan, volume, frequency).
// taka spira kogato ne e na fokus DSBCAPS_CTRLFREQUENCY| DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME
// | DSBCAPS_GETCURRENTPOSITION2
playbackBuff.dwBufferBytes = SAMPLETIME * pcmwf.wf.nAvgBytesPerSec; // SAMPLETIME-second buffer.
playbackBuff.lpwfxFormat= (LPWAVEFORMATEX)&pcmwf;
//IDirectSoundBuffer_Release(lpDirectSoundBuffer);
ds_read_wr_offset = buffer; // 176400=1000ms 88200=500ms 150000=800ms
write_position = 0;
buffer_size = (int)playbackBuff.dwBufferBytes;
//qDebug()<<"DS"<<ds_read_wr_offset<<buffer_size<<SAMPLERATE;
hr = lpDirectSound->CreateSoundBuffer( &playbackBuff, &lpDirectSoundBuffer, NULL);
if (hr != DS_OK)
{
//DBPRINTF(("NETPLAY: Failed to create playback buffer.\n"));
lpDirectSoundBuffer = NULL; // Failed.
return false;
}
return true;
}
bool Rawplayer::win_putblock(void *buffer,int size)
{
LPVOID lpvPtr1,lpvPtr2=NULL;
DWORD dwBytes1,dwBytes2=0;
HRESULT hr;
//short int *buffer1 = dsp((short int *)buffer, ((size/2)));
//int sample_l = rms_l((short int *)buffer1, (size/2));//hv
//int sample_r = rms_r((short int *)buffer1, (size/2));//hv
//SendSmeter(sample_l, sample_r);//hv
//buffer1 = win_vol_ctrl((short int *)buffer1, ((size/2)));
hr = IDirectSoundBuffer_Lock(lpDirectSoundBuffer,
write_position, //offset
size, //size
&lpvPtr1,&dwBytes1,
&lpvPtr2,&dwBytes2,
0 );//DSBLOCK_FROMWRITECURSOR
memcpy(lpvPtr1,(char*)buffer,dwBytes1);
if (NULL != lpvPtr2 )
memcpy(lpvPtr2,(char*)buffer+dwBytes1,dwBytes2);
write_position += (int)(dwBytes1+dwBytes2);
if (write_position >= buffer_size)
{
// prev_write_position = prev_write_position - buffer_size;
write_position=(int)dwBytes2;
}
hr = IDirectSoundBuffer_Unlock(lpDirectSoundBuffer, lpvPtr1, dwBytes1, lpvPtr2,dwBytes2);
if (SUCCEEDED(hr))
{ // s towa mu dava play samo kogato ima pritok na (buffer) i to samo vednaz
DWORD status;
IDirectSoundBuffer_GetStatus(lpDirectSoundBuffer, &status);
if (!(status & DSBSTATUS_PLAYING))
{
//qDebug()<<"play";
IDirectSoundBuffer_Play(lpDirectSoundBuffer, 0, 0, DSBPLAY_LOOPING);
ds_play_flag = true;
}
}
int play_position = 0;
while (1)
{
IDirectSoundBuffer_GetCurrentPosition(lpDirectSoundBuffer, (DWORD*)&play_position, NULL);
if ( write_position - play_position < 0 )
{
if (write_position + buffer_size - play_position < ds_read_wr_offset )
return true;
}
else
{
if (write_position - play_position < ds_read_wr_offset )
return true;
}
usleep(1000);//v1.27 32-64bit qt4 gcc492 =20 //qt5 gcc530 = 1000
}
return true;
}
#endif

View File

@ -0,0 +1,658 @@
/* MSHV MsPlayerHV
* Copyright 2015 Hrisimir Hristov, LZ2HV
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#include "msplayerhv.h"
#include <QTime>
static const double SAVE_SAMPLE_RATE_11025 = 11025.0;
static const double SAVE_SAMPLE_RATE_12000 = 12000.0;
//#include <QtGui>
MsPlayerHV::MsPlayerHV(QString path)
{
s_mod_ident=2; //2.12
filenamehv=(char*)"none"; //2.12
s_period_time_sec = 30;
SAVE_SAMPLE_RATE = SAVE_SAMPLE_RATE_11025;//HV important set to default mode fsk441 sample rate
App_Path = path;
//s_MyGridLoc = "GRID";
s_tx_freq = 1200.0; //ft8 for the moment 1.43
f_message_or_file = true;
music.RealStop = true;
music.pause = false;
music.quit = false;
//music.setframeflag = false;
musics.stop = false;
musics.restart = false;
musics.errorflag = false;
musics.error_repat = false;
//music.setframenumber = 0;
musics.move = 1;//???? 1 netragva na 32 ako e 0
musics.currentrun = 0;
musics.errorcode = 0;
/*int po = sched_getscheduler(0);
qDebug()<<po<<sched_get_priority_max(po);
qDebug()<<po<<sched_get_priority_min(po);*/
/*
#if defined _LINUX_
Rawplayer::setvolume_lin(70);//pcm channel
#endif
*/
thtx = 0;
startuplock = PTHREAD_MUTEX_INITIALIZER; //ok win and lin -> linux no TX error
//pthread_mutex_init(&startuplock, NULL); //or this
pthread_attr_t thread_attr;
struct sched_param param;
pthread_attr_init(&thread_attr);
pthread_attr_getschedparam(&thread_attr, &param);//2.38
param.sched_priority = param.sched_priority + 1;//2.38
//param.sched_priority = 15;//2.38 stop
pthread_attr_setschedpolicy(&thread_attr, SCHED_OTHER); //2.38 stop <-no needed need Linux test OTHER=0 FIFO=1 RR=2 policy
pthread_attr_setschedparam(&thread_attr, &param);
//pthread_create(&th,NULL,MsPlayerHV::ThreadEntry,(void*)this);
pthread_create(&thtx,&thread_attr,MsPlayerHV::ThreadEntry,(void*)this);
pthread_mutex_unlock(&startuplock); // za da ne tragva s puskanet
/*int apoly,poly;
pthread_getschedparam(thtx,&apoly,&param);
pthread_attr_getschedpolicy(&thread_attr,&poly);
qDebug()<<"th="<<thtx<<param.sched_priority<<poly;*/
pthread_attr_destroy(&thread_attr);
}
MsPlayerHV::~MsPlayerHV()
{}
void MsPlayerHV::SetModeForWavSaves(int mode)
{
/*if (mode==0 || mode==7 || mode==8 || mode==9 || mode==10 || mode==11 || mode==12 || mode==13 ||
mode==14 || mode==15 || mode==16 || mode==17)//jt65abc msk144 pi4 ft8 ft4
{
SAVE_SAMPLE_RATE = SAVE_SAMPLE_RATE_12000;
#if defined _LINUX_
Rawplayer::pa_sa_rate = 48000;
#endif
}
else //if (mode>0 && mode<7)
{
SAVE_SAMPLE_RATE = SAVE_SAMPLE_RATE_11025;
#if defined _LINUX_
Rawplayer::pa_sa_rate = 44100;
#endif
}*/
if (mode>0 && mode<7)//2.65
{
SAVE_SAMPLE_RATE = SAVE_SAMPLE_RATE_11025;
#if defined _LINUX_
Rawplayer::pa_sa_rate = 44100;
#endif
}
else
{
SAVE_SAMPLE_RATE = SAVE_SAMPLE_RATE_12000;
#if defined _LINUX_
Rawplayer::pa_sa_rate = 48000;
#endif
}
}
void MsPlayerHV::SetSoundDevice(QString dev_in_number, int buffer)
{
strncpy(dev_in_p,dev_in_number.toUtf8(),127);//2.50 for pulse audio max is 512 ???
Rawplayer::defaultdevice = dev_in_p;
Rawplayer::buffering = buffer;
//qDebug()<<"MsPlayerHV========"<<Rawplayer::defaultdevice<<dev_in_number;
}
void MsPlayerHV::music_move(int value)
{
pthread_mutex_lock(&musics.movelock); // zada mal4i pri smiana na pesen veroiatno stawa i za pevartane
musics.move+=value; //qDebug()<<"gore.move"<<musics.move;
pthread_mutex_unlock(&musics.movelock);
}
void MsPlayerHV::music_done(void) // da preska4a pesen ako e error
{
music.RealStop=true;// za stop start ot edno i sa6to kop4e
music_move(1);
}
void MsPlayerHV::music_term(void)
{
music.pause=false;
music.quit=true;
}
void MsPlayerHV::seterrorcode(int errcode)
{
musics.errorcode=errcode;
musics.errorflag=true;
musics.error_repat=true;
music_done();
}
void MsPlayerHV::SaveFile(short*raw,int count,QString name)
{
//if(name.contains("/"))
//name.replace("/","_DROP_");
QString str = App_Path+"/RxWavs/"+name+".WAV";
//qDebug()<<str;
Rawtofile_wr *recorder;
recorder = Rawtofile_wr::opendevice(qstrdup(qPrintable(str)));
if (recorder == NULL)
return;
(recorder && ((Rawtofile_wr*)recorder)->setfiletype(WAV));
//qDebug()<<"q-strdup(qPrintable(name))";
if (!recorder->setsoundtype(0,16,SAVE_SAMPLE_RATE))//SAVE_SAMPLE_RATE 6000.0
{
seterrorcode(recorder->geterrorcode());
//qDebug()<<"1111";
return;
}
recorder->set8bitmode();
byte01_ *f = new byte01_[count*2];
int j = 0;
for (int i = 0; i < count; i++)
{
f[j]=(byte01_)(raw[i] & 0xff);
f[j+1]=(byte01_)((raw[i] >> 8) & 0xff);
j+=2;
}
recorder->putblock(f,count*2);
delete [] f;
delete recorder;
}
void MsPlayerHV::OpenFile(char *filename)
{
bool splay_forcetomonoflag;
splay_forcetomonoflag = false;
//int frequency;
Soundinputstream *loader;
int err;
Rawtodata *player;
Wavetoraw *server;
player=new Rawtodata;
if (player==NULL)
{
seterrorcode(SOUND_ERROR_MEMORYNOTENOUGH);
return;
}
if (!player->initialize(filename))
{
//2.12 error garmi
//delete player;//2.13 no delete crash
//qDebug()<<"player";
seterrorcode(player->geterrorcode());
return;
}
if ((loader=Soundinputstream::hopen(filename,&err))==NULL)
{
//qDebug()<<"loader";
seterrorcode(err);
delete loader;
return;
}
if ((server=new Wavetoraw(loader,player))==NULL)
{
//qDebug()<<"server";
seterrorcode(SOUND_ERROR_MEMORYNOTENOUGH);
return;
}
server->initialize((int)SAVE_SAMPLE_RATE);//check for diferent samplerates
server->setforcetomono(splay_forcetomonoflag);
//Setsongname(stripfilename(filename)); izliza na displea i zaradi tova go skasiavat hv
//music.pause=music.quit=music.setframeflag=false; //2.47 no needed in Open File
if (!server->run()) // Initialize Wave player
{
//qDebug()<<"server->run";
seterrorcode(server->geterrorcode());
delete server;
return;
}
emit SentFileClarDisplay();
connect(player, SIGNAL(SentData(short*, int, bool)), this, SIGNAL(SentData(short*, int, bool)));
///////////////////////////////tova ne triabva ve4e hv /////////////////////////////
int q=server->getfrequency()*(server->isstereo()+1);
if (server->getsamplesize()==16)
{
if (!splay_forcetomonoflag)q<<=1;
}
q>>=1;
player->setquota(q);
///////////////////////////////tova ne triabva ve4e hv /////////////////////////////
for (;;)
{
if (!server->run())
{
// music_done();
break;
}
}
//qDebug()<<"reset_wav";
delete server;
delete player;
delete loader;
return;
}
void MsPlayerHV::SetTxFreq(double f)
{
s_tx_freq = f;
}
void MsPlayerHV::xplaymessage(char *message,Rawplayer *player)
{
bool splay_forcetomonoflag;
splay_forcetomonoflag = false;
GenMessage *server;
//qDebug()<<"New Server"<<(QString)message<<ttt.elapsed();
//QTime ttt; ttt.start();
// Server
if ((server = new GenMessage(player))==NULL)//App_Path,
{
seterrorcode(SOUND_ERROR_MEMORYNOTENOUGH);
return;
}
//qDebug()<<"1 initialize="<<(QString)message<<ttt.elapsed();
server->initialize(message,s_mod_ident,s_tx_freq,s_period_time_sec);
//qDebug()<<"2 initialize="<<(QString)message<<ttt.elapsed();
QString new_tx_msg;
if ((s_mod_ident==0 || s_mod_ident==12) && message[0]!='@')//msk144 1.31 for " R " msg is same but not after unpack
new_tx_msg=server->TGenMsk->GetUnpackMsg();
else if ((s_mod_ident==7 || s_mod_ident==8 || s_mod_ident==9) && message[0]!='@')//jt65abc
{
new_tx_msg=server->TGen65->GetUnpackMsg();
}
else if (s_mod_ident==11 && message[0]!='@')//zasega ft8 s tova ->msk144 1.31 for " R " msg is same but not after unpack
{
new_tx_msg=server->TGenFt8->GetUnpackMsg();
}
else if (s_mod_ident==13 && message[0]!='@')//zasega ft4 s tova ->msk144 1.31 for " R " msg is same but not after unpack
new_tx_msg=server->TGenFt4->GetUnpackMsg();
else if ((s_mod_ident==14 || s_mod_ident==15 || s_mod_ident==16 || s_mod_ident==17) && message[0]!='@')//q64
new_tx_msg=server->TGenQ65->GetUnpackMsg();
else
new_tx_msg=(QString)message;
//qDebug()<<"Unpack"<<(QString)message<<ttt.elapsed();
//qDebug()<<"ss_prev_msg="<<ss_prev_msg<<"NewREAL="<<real_tx_msg<<"RealIn="<<(QString)message;
if (!music.RealStop)//s_prev_tx_msg!=new_tx_msg &&
{
//qDebug()<<new_tx_msg;
QString tmp = new_tx_msg;
if (tmp[0]=='@')
{
if (tmp=="@TUNE") tmp="TUNE";
if (tmp[1]=='A') tmp="882 Hz";
if (tmp[1]=='B') tmp="1323 Hz";
if (tmp[1]=='C') tmp="1764 Hz";
if (tmp[1]=='D') tmp="2205 Hz";
if (tmp[0]=='@')
{
tmp.remove("@");
if (tmp.toInt()>=100 && tmp.toInt()<=3500)
tmp= tmp+" Hz";
}
//SendTxMsgLabTxkkk(tmp);
}
//else
//emit SendTxMsgLabTx(tmp);
emit SendTxMsgAllTxt(tmp,s_tx_freq);
if (s_prev_tx_msg!=new_tx_msg)
{
emit SendTxMsgLabTx(tmp);
if (new_tx_msg!="@TUNE")
{
s_prev_disp_msg=tmp; //1.31
s_prev_tx_msg=new_tx_msg; //1.31 za da ne izpra6ta ako massg e sa6toto
}
}
}
server->setforcetomono(splay_forcetomonoflag);
//music.pause=music.quit=music.setframeflag=false; //2.47 stop move UP in xplay()
if (!server->run()) // Initialize Wave player
{
//PlayerStatus(0,0,0,(char*)"none");
seterrorcode(server->geterrorcode());
delete server;
return;
}
///////////////////////////////tova ne triabva ve4e hv /////////////////////////////
int q=server->getfrequency()*(server->isstereo()+1);
if (server->getsamplesize()==16)
{
if (!splay_forcetomonoflag)q<<=1;
}
q>>=1;
player->setquota(q);
///////////////////////////////tova ne triabva ve4e hv /////////////////////////////
int min_delayft = 200;
int delayft = min_delayft;
if (s_mod_ident==7 || s_mod_ident==8 || s_mod_ident==9)//jt65 wheit 1s in begining
usleep(700000);// tested 1.35
else if (s_mod_ident==11)//ft8
{
QTime ctt = QTime::currentTime();
int ss_s = ctt.toString("ss").toInt();
int ms_s = ctt.toString("zzz").toInt();//"z"<--- error QT > QT5 v5.9.x
if (ss_s % 15 == 0)
{
int xlat = 450 - ms_s;//500 real s wsjt2
if (xlat>50)// min 100-50ms delay
{
delayft = xlat;
//qDebug()<<"Start="<<ss_s<<ms_s<<xlat<<delayft8<<"FullLat="<<(ms_s + delayft8);
}
//else
//qDebug()<<"ERROR > 50===="<<ss_s<<ms_s<<delayft8<<"FullLat="<<(delayft8);
}
else
{
delayft = min_delayft;
//qDebug()<<"ERROR % 15===="<<ss_s<<ms_s<<delayft8<<"FullLat="<<(delayft8);
}
int lindelayft = (delayft * 1000);
usleep(lindelayft);//350000 400000 ft8 2.03
}
else if (s_mod_ident==13)//ft4
{
QTime ctt = QTime::currentTime();
int ss_s = ctt.toString("ss").toInt();
int ms_s = ctt.toString("zzz").toInt();//"z"<--- error QT > QT5 v5.9.x
if (ss_s == 7 || ss_s == 22 || ss_s == 37 || ss_s == 52)
{
ss_s=0;
ms_s -= 500;
}
if (ss_s % 15 == 0)
{
int xlat = 350 - ms_s;//350 real s wsjt2 rc7 ???? my be =400ms
if (xlat>50)// min 100-50ms delay
{
delayft = xlat;
//qDebug()<<"Start="<<ss_s<<ms_s<<xlat<<delayft8<<"FullLat="<<(ms_s + delayft8);
}
//else
//qDebug()<<"ERROR > 50===="<<ss_s<<ms_s<<delayft8<<"FullLat="<<(delayft8);
}
else
{
delayft = min_delayft;
//qDebug()<<"ERROR % 15===="<<ss_s<<ms_s<<delayft8<<"FullLat="<<(delayft8);
}
int lindelayft = (delayft * 1000);
usleep(lindelayft);//350000 400000 ft8 2.03
}
else if (s_mod_ident==14 || s_mod_ident==15 || s_mod_ident==16 || s_mod_ident==17)
{
QTime ctt = QTime::currentTime();
int mm_s = ctt.toString("mm").toInt();
int ss_s = ctt.toString("ss").toInt();
int ms_s = ctt.toString("zzz").toInt();
int mmss = (mm_s*60)+ss_s;
if (mmss % s_period_time_sec == 0)
{
int xlat = 950 - ms_s;
if (s_period_time_sec<60) xlat = 450 - ms_s;
if (xlat>50)
{
delayft = xlat;
//qDebug()<<"Start="<<ss_s<<ms_s<<xlat<<delayft8<<"FullLat="<<(ms_s + delayft8);
}
//else
//qDebug()<<"ERROR > 50===="<<ss_s<<ms_s<<delayft8<<"FullLat="<<(delayft8);
}
else
{
delayft = min_delayft;
//qDebug()<<"ERROR % 15===="<<ss_s<<ms_s<<delayft8<<"FullLat="<<(delayft8);
}
int lindelayft = (delayft * 1000);
usleep(lindelayft);
}
else
usleep(250000);//wsjt-x 200ms mshv -> 250000us tx delay offset 250ms
//qDebug()<<"Reall_TX==AUDIO=="<<QTime::currentTime().toString("ss:zzz");
for (;;)
{
if (music.pause)
{
player->abort();
player->resetsoundtype();
while (music.pause)
{
usleep(1000); //1.27 32-64bit qt4 gcc492 =100 //qt5 gcc530 = 1000
//#if defined _WIN64_
//usleep(1000);//v1.14 HV problem pod 1000 ne raboti GCC4.9.2 win64
//#endif
}
}
if (music.RealStop) // slagam go tuk za da ne proswirva pri stop pri malka pauza v na4aloto
{
server->mute_hv(true);//player->mute_hv(true);
//f_real_start = false;
music.pause = true;
//SentFrame(0/FRAMESIZE,server->gettotallength()/FRAMESIZE,FRAMESIZE,frequency);
}
else
{
server->mute_hv(false);//player->mute_hv(false);//tuk zastoto ina4e na vbr_wma Proswirwa w samia krai malko hv
}
if (music.quit)
{
player->getprocessed();
player->abort();
player->resetsoundtype();
break;
}
if (!server->run())
{
music_done();
break;
}
}
delete server;
if (new_tx_msg=="@TUNE")
emit SendTxMsgLabTx(s_prev_disp_msg);
//qDebug()<<"ELETE";
return;
}
void MsPlayerHV::xplayfile(char *filename)
{
char *device=Rawplayer::defaultdevice;
if (f_message_or_file)
{
if (device==NULL) device=Rawplayer::defaultdevice;
if (device[0]!='/') device=Rawplayer::defaultdevice;
Rawplayer *player = new Rawplayer; //qDebug()<<"create player";
if (player==NULL)
{
seterrorcode(SOUND_ERROR_MEMORYNOTENOUGH);
usleep(2000);// 2.48
return;
}
//qDebug()<<"initialize";
if (!player->initialize(device))
{
//qDebug()<<"FALSE player->initialize";//<<errr;
seterrorcode(player->geterrorcode());
//2.12 error garmi
//usleep(1000); // no 100% thread
//delete player;//2.39 old->2.13 stoped no delete crash
usleep(2000);// 2.48
return;
}
//qDebug()<<"EEEEEE==TX="<<QTime::currentTime().toString("mm:ss:zzz");;
//qDebug()<<"initialize";
xplaymessage(filename,player);
usleep(1000); // no 100% thread
delete player;
usleep(1000); //2.39 no 100% thread
//musics.stop=true;//hv 2.39 possyble but no recomended
return;
}
}
void MsPlayerHV::xplay()
{
musics.restart=true;
musics.errorflag=false;
//qDebug()<<"pthread_mutex_init";
pthread_mutex_init(&musics.movelock,NULL);//2.39 inportent crash win lin
for (;;)
{
/*if (music.RealStop)
{
SendTxRx(false);
}
else if ((QString)filenamehv != "%")
{
SendTxRx(true);
}*/
if (musics.restart)
{
musics.stop=false;
musics.restart=false;
musics.currentrun=0;
}
if (musics.errorflag)
musics.errorflag=false;
if (musics.move!=0)
{
pthread_mutex_lock(&musics.movelock);//2.39 inportent crash win lin
musics.currentrun+=musics.move;
if (!musics.stop)
{
musics.stop=true;
}
musics.move=0;
pthread_mutex_unlock(&musics.movelock);//2.39 inportent crash win lin
}
if (musics.stop)
{
usleep(2000); //2.37=2000 2.48=2000
}
else
{
if (filenamehv != NULL) // if(musics.currentrun<splay_listsize)
{
//qDebug()<<"START-------------------------------";
musics.error_repat=false; // vazno hv da e to4no tuk
music.pause=music.quit=false; //2.47 moved here KP4HF no the fly
//QTextCodec *codec = QTextCodec::codecForName(TXT_CODEC_WIN);
//QTextCodec *codec = QTextCodec::codecForName("Windows-1251");
//xplayfile(codec->fromUnicode(filenamehv).data());
xplayfile(filenamehv);//2.37 w10 no Windows-1251 crash
}
else
musics.restart=true;
}
}
}
void *MsPlayerHV::ThreadEntry(void *ar)
{
MsPlayerHV* pt = (MsPlayerHV*)ar;
pthread_mutex_lock(&pt->startuplock);
pt->xplay();
pthread_detach(pt->thtx); //2.48
pthread_exit(NULL);
return NULL;
}
void MsPlayerHV::Stop()
{
//qDebug()<<"MsPlayerHV::Stop()===================== ";
music.RealStop = true;
music_term();
}
void MsPlayerHV::Restart() //promenena
{
music.RealStop = false;
}
void MsPlayerHV::setfile_play(char *filename, bool msg_file, int mod_ident,int preiod_t)
{
int nmsg = strlen(filename); //if (nmsg<1) return;
if (nmsg<1) filename = (char*)" ";// 2.37 protect system
f_message_or_file = msg_file;
filenamehv = filename;
s_mod_ident = mod_ident;
s_period_time_sec = preiod_t;
if (msg_file)// not needed hv
{
//qDebug()<<"setfile_play"<<(QString)filename;
music_term();
musics.restart = true;
Restart(); // zaradi parvoto puskane
}
/*else
{
if (!only_one_start_cw_gen)
{
music_term();
musics.restart = true;
Restart();
only_one_start_cw_gen = true;
}
if (stop_cw_global || emidiatly_start_cw)
{
stop_cw_global = false;
count_txt_1 = 0;
count_read_letter_1=0;
get_decode(filenamehv[count_txt_1],tex_digits_1);
count_txt_1++;
}
else
stop_cw_global = true;
}*/
}
void MsPlayerHV::SetVolume(int volume)
{
GenMessage::setvolume_all(volume);
}

120
src/HvMsPlayer/msplayerhv.h Normal file
View File

@ -0,0 +1,120 @@
/* MSHV
*
* By Hrisimir Hristov - LZ2HV
* (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL)
*/
#ifndef MSPLAYERHV_H
#define MSPLAYERHV_H
//
//#include <QtGui>
#include "../config.h"
#include <QObject>
#include "libsound/mpegsound.h"
#include <unistd.h> // zaradi usleep
//#include <QTextCodec> //zaradi cp1251 za da sviri pod windows
typedef unsigned char byte01_;
//#define SAVE_SAMPLE_RATE 11025
// void Setcurrentmpegstatus(int version,int layer,
// int frequency,int bitrate,
// bool crc,int mode,
// bool forcetomono,int downfreq); // neraz
//bool getquotaflag(void); // neraz
//void Unlockframeslider(void); // neraz
//void Setframestatus(int frame,int maxframe,int pcmperframe,int frequency); //neznam
//void Clearcurrentstatus(void); // neznam
/////////////////////////Ststic Structure//////////////////////////////////
class MsPlayerHV : public QObject
{
Q_OBJECT
public:
MsPlayerHV(QString);
virtual~MsPlayerHV();
void OpenFile(char*);
void SetModeForWavSaves(int);
bool Is_RealStop()// 2.56 old=slots
{
return music.RealStop;
};
void setfile_play(char *,bool,int mod_ident,int);
void Stop();
void SetTxFreq(double);// ft8 for the moment 1.43
signals:
//void SendTxRx(bool);
void SentData(short*, int, bool); //1.27 psk rep fopen
void SentFileClarDisplay();
void SendTxMsgLabTx(QString);
void SendTxMsgAllTxt(QString,double);
public slots:
//void setfile_play(char *,bool,int mod_ident,int); //int tx_dilay
//void Stop();
//void Restart();
void SetVolume(int);
void SetSoundDevice(QString dev, int buffer);
void SaveFile(short*,int,QString);
//void SetTxFreq(double);// ft8 for the moment 1.43
private:
char dev_in_p[128];//2.50
QString s_prev_disp_msg;
QString s_prev_tx_msg;
struct msui
{
bool RealStop;
bool pause;
bool quit;
//bool setframeflag;
//int setframenumber;
};
struct mus
{
bool stop;
bool restart;
int move;
int currentrun;
pthread_mutex_t movelock;
bool errorflag;
int errorcode;
bool error_repat;
};
mus musics;
msui music;
bool f_message_or_file;
int s_mod_ident;
QString App_Path;
double s_tx_freq;// = 1200.0 //ft8 for the moment
double SAVE_SAMPLE_RATE;
char *filenamehv;
int s_period_time_sec;
void Restart();
protected:
void xplay();
void xplayfile(char *filename);
void xplaymessage(char *mess,Rawplayer *player);
void music_term(void);
void music_move(int value);
void music_done(void);
void seterrorcode(int errcode);
pthread_t thtx;
pthread_mutex_t startuplock; // za 64bit qt4 4.4.0 da tragva s puskaneto iska da e tuk
static void *ThreadEntry(void*);
//short ShortSwap(short s);
};
#endif