From ccee9ab53bf15b2713d63f2b18d1ddda7f6a347c Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 30 Jul 2016 18:46:29 +0000 Subject: [PATCH] Open pchk and gen files for msk40 from platform-independent directories. Recompute MSK40 hash codes when mycall or hiscall has changed. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6976 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/detectmsk40.f90 | 29 ++++++++++++++++++----------- lib/genmsk144.f90 | 2 +- lib/genmsk40.f90 | 17 +++++++++-------- lib/msk144_decode.f90 | 2 +- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/lib/detectmsk40.f90 b/lib/detectmsk40.f90 index 650ba5533..894aad3fc 100644 --- a/lib/detectmsk40.f90 +++ b/lib/detectmsk40.f90 @@ -1,19 +1,21 @@ -subroutine detectmsk40(cbig,n,mycall,hiscall,lines,nmessages,nutc,ntol,t00) - use timer_module, only: timer +subroutine detectmsk40(cbig,n,pchk_file,mycall,hiscall,lines,nmessages, & + nutc,ntol,t00) + use timer_module, only: timer parameter (NSPM=240, NPTS=3*NSPM, MAXSTEPS=7500, NFFT=3*NSPM, MAXCAND=15) character*4 rpt(0:63) - character*6 mycall,hiscall + character*6 mycall,hiscall,mycall0,hiscall0 character*22 hashmsg,msgreceived character*80 lines(100) - character*40 pchk_file,gen_file + character*512 pchk_file,gen_file + character*512 pchk_file40,gen_file40 complex cbig(n) complex cdat(NPTS) !Analytic signal complex cdat2(NPTS) complex c(NSPM) complex ctmp(NFFT) complex cb(42) !Complex waveform for sync word - complex cbr(42) !Complex waveform for reversed sync word + complex cbr(42) !Complex waveform for reversed sync word complex cfac,cca,ccb complex ccr(NPTS) complex ccr1(NPTS) @@ -43,6 +45,7 @@ subroutine detectmsk40(cbig,n,mycall,hiscall,lines,nmessages,nutc,ntol,t00) real*8 lratio(32) logical first data first/.true./ + data mycall0/'dummy'/,hiscall0/'dummy'/ data s8/0,1,1,1,0,0,1,0/ data s8r/1,0,1,1,0,0,0,1/ ! codeword for the message RRR @@ -97,22 +100,26 @@ subroutine detectmsk40(cbig,n,mycall,hiscall,lines,nmessages,nutc,ntol,t00) enddo rpt(62)='RRR ' rpt(63)='73 ' + first=.false. + endif + if(mycall.ne.mycall0 .or. hiscall.ne.hiscall0) then do i=0,63 hashmsg=trim(mycall)//' '//trim(hiscall)//' '//rpt(i) call fmtmsg(hashmsg,iz) call hash(hashmsg,22,ihash) nhashes(i)=iand(ihash,1023) enddo - - first=.false. + mycall0=mycall + hiscall0=hiscall endif ! Temporarily hardwire filenames and init on every call - pchk_file="peg-32-16-reg3.pchk" - i=index(pchk_file,".pchk") - gen_file=pchk_file(1:i-1)//".gen" - call init_ldpc(trim(pchk_file)//char(0),trim(gen_file)//char(0)) + i=index(pchk_file,"128-80") + pchk_file40=pchk_file(1:i-1)//"32-16"//pchk_file(i+6:) + i=index(pchk_file40,".pchk") + gen_file40=pchk_file40(1:i-1)//".gen" + call init_ldpc(trim(pchk_file40)//char(0),trim(gen_file40)//char(0)) ! Fill the detmet, detferr arrays nstepsize=60 ! 5ms steps diff --git a/lib/genmsk144.f90 b/lib/genmsk144.f90 index 6d6c807da..2782a26b0 100644 --- a/lib/genmsk144.f90 +++ b/lib/genmsk144.f90 @@ -82,7 +82,7 @@ subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype,pchk_file) enddo if(message(1:1).eq.'<') then - call genmsk40(message,msgsent,ichk,i4tone,itype) + call genmsk40(message,msgsent,ichk,i4tone,itype,pchk_file) if(itype.lt.0) go to 999 i4tone(41)=-40 go to 999 diff --git a/lib/genmsk40.f90 b/lib/genmsk40.f90 index 52b011dab..f0ddcc4dd 100644 --- a/lib/genmsk40.f90 +++ b/lib/genmsk40.f90 @@ -1,11 +1,12 @@ -subroutine genmsk40(msg,msgsent,ichk,itone,itype) +subroutine genmsk40(msg,msgsent,ichk,itone,itype,pchk_file) use hashing character*22 msg,msgsent,hashmsg character*32 cwstring character*2 cwstrbit character*4 crpt,rpt(0:63) - character*40 pchk_file,gen_file + character*512 pchk_file,gen_file + character*512 pchk_file40,gen_file40 logical first integer itone(144) integer*1 message(16),codeword(32),bitseq(40) @@ -29,12 +30,12 @@ subroutine genmsk40(msg,msgsent,ichk,itone,itype) first=.false. endif -!####### TEMPORARILY HARDWIRE PCHK AND GEN FILES ################## -!These files will need to be installed. - - pchk_file="peg-32-16-reg3.pchk" - gen_file="peg-32-16-reg3.gen" - call init_ldpc(trim(pchk_file)//char(0),trim(gen_file)//char(0)) +! Temporarily hardwire filenames and init on every call + i=index(pchk_file,"128-80") + pchk_file40=pchk_file(1:i-1)//"32-16"//pchk_file(i+6:) + i=index(pchk_file40,".pchk") + gen_file40=pchk_file40(1:i-1)//".gen" + call init_ldpc(trim(pchk_file40)//char(0),trim(gen_file40)//char(0)) itype=-1 msgsent='*** bad message ***' itone=0 diff --git a/lib/msk144_decode.f90 b/lib/msk144_decode.f90 index bf3e6da8d..9572412e6 100644 --- a/lib/msk144_decode.f90 +++ b/lib/msk144_decode.f90 @@ -47,7 +47,7 @@ subroutine msk144_decode(id2,npts,nutc,nprint,pchk_file,mycall,hiscall, & if(nline.eq.0 .and. bShMsgs) then call timer('detect40',0) - call detectmsk40(c,npts,mycall,hiscall,line,nline,nutc,ntol,t0) + call detectmsk40(c,npts,pchk_file,mycall,hiscall,line,nline,nutc,ntol,t0) call timer('detect40',1) if( nprint .ne. 0 ) then do i=1,nline