From 3962aa3c43ef86cf1dd4352debf1d76bd1a80223 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sun, 15 Mar 2020 14:25:56 -0400 Subject: [PATCH] Replace hijacked ss(1:3,1) with a separate ipc(3) array. --- commons.h | 1 + lib/decoder.f90 | 10 +++++----- lib/ft8_decode.f90 | 10 +++++----- lib/jt9a.f90 | 23 +++++++++++++---------- lib/jt9com.f90 | 1 + widgets/mainwindow.cpp | 17 ++++++++--------- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/commons.h b/commons.h index 4083bb22f..04be9db2d 100644 --- a/commons.h +++ b/commons.h @@ -18,6 +18,7 @@ extern "C" { * sync with lib/jt9com.f90 */ extern struct dec_data { + int ipc[3]; float ss[184*NSMAX]; float savg[NSMAX]; float sred[5760]; diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 8b5fb7c82..7ed589efa 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -1,6 +1,6 @@ -subroutine multimode_decoder(ss,id2,params,nfsample) +subroutine multimode_decoder(ipc1,ss,id2,params,nfsample) - !$ use omp_lib +!$ use omp_lib use prog_args use timer_module, only: timer use jt4_decode @@ -97,7 +97,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) if(tseq.lt.9.0) tseq=tseq+15.0 if(params%nzhsym.eq.41) write(71,3001) ' ' sec=itime(7)+0.001*itime(8) - write(71,3001) 'BB decoderStart',tsec,params%nzhsym,nint(ss(1,1)),tseq, & + write(71,3001) 'BB decoderStart',tsec,params%nzhsym,ipc1,tseq, & itime(5)-itime(4)/60,itime(6),sec 3001 format(a15,f11.3,2i6,f8.3,i4.2,':',i2.2,':',f6.3,i6) flush(71) @@ -123,7 +123,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) params%nftx,newdat,params%nutc,params%nfa,params%nfb, & params%nzhsym,params%ndepth,ncontest,logical(params%nagain), & logical(params%lft8apon),logical(params%lapcqonly), & - params%napwid,mycall,hiscall,hisgrid,ss(1,1),params%ndiskdat) + params%napwid,mycall,hiscall,hisgrid,ipc1,params%ndiskdat) call timer('decft8 ',1) if(nfox.gt.0) then n30min=minval(n30fox(1:nfox)) @@ -314,7 +314,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) tseq=mod(itime(7)+0.001*itime(8),15.0) if(tseq.lt.9.0) tseq=tseq+15.0 sec=itime(7)+0.001*itime(8) - write(71,3001) 'DD decoderEnd ',tsec,params%nzhsym,nint(ss(1,1)),tseq, & + write(71,3001) 'DD decoderEnd ',tsec,params%nzhsym,ipc1,tseq, & itime(5)-itime(4)/60,itime(6),sec,ndecoded flush(71) diff --git a/lib/ft8_decode.f90 b/lib/ft8_decode.f90 index 38ed9e0e9..41b8555b7 100644 --- a/lib/ft8_decode.f90 +++ b/lib/ft8_decode.f90 @@ -34,7 +34,7 @@ contains subroutine decode(this,callback,iwave,nQSOProgress,nfqso,nftx,newdat, & nutc,nfa,nfb,nzhsym,ndepth,ncontest,nagain,lft8apon,lapcqonly, & - napwid,mycall12,hiscall12,hisgrid6,ss0,ldiskdat) + napwid,mycall12,hiscall12,hisgrid6,ipc1,ldiskdat) use timer_module, only: timer include 'ft8/ft8_params.f90' @@ -64,7 +64,7 @@ contains real xdt_save(MAX_EARLY) save s,dd,dd1,ndec_early,itone_save,f1_save,xdt_save,lsubtracted - volatile ss0 + volatile ipc1 this%callback => callback write(datetime,1001) nutc !### TEMPORARY ### @@ -90,7 +90,7 @@ contains lrefinedt) lsubtracted(i)=.true. endif - if(.not.ldiskdat .and. nint(ss0).ge.49) then !Bail out before done + if(.not.ldiskdat .and. ipc1.ge.49) then !Bail out before done call timer('sub_ft8b',1) dd1=dd go to 700 @@ -177,7 +177,7 @@ contains endif endif if(.not.ldiskdat .and. nzhsym.eq.41 .and. & - nint(ss0).ge.46) go to 700 !Bail out before done + ipc1.ge.46) go to 700 !Bail out before done enddo enddo go to 800 @@ -189,7 +189,7 @@ contains tseq=mod(itime(7)+0.001*itime(8),15.0) if(tseq.lt.9.0) tseq=tseq+15.0 sec=itime(7)+0.001*itime(8) - write(71,3001) 'CC Bailout ',tsec,nzhsym,nint(ss0),tseq, & + write(71,3001) 'CC Bailout ',tsec,nzhsym,ipc1,tseq, & itime(5)-itime(4)/60,itime(6),sec,ndecodes 3001 format(a15,f11.3,2i6,f8.3,i4.2,':',i2.2,':',f6.3,i6) flush(71) diff --git a/lib/jt9a.f90 b/lib/jt9a.f90 index 13765e9b1..917ebf3e8 100644 --- a/lib/jt9a.f90 +++ b/lib/jt9a.f90 @@ -39,19 +39,19 @@ subroutine jt9a() msdelay=30 call c_f_pointer(address_jt9(),shared_data) -! Wait here until GUI has set ss(2,1) to 1.0 +! Wait here until GUI has set ips(2) to 1.0 10 call lock_jt9() - if(shared_data%ss(2,1).eq.999.0) then + if(shared_data%ipc(2).eq.999.0) then call unlock_jt9() i1=detach_jt9() go to 999 endif - if(shared_data%ss(2,1).ne.1.0) then + if(shared_data%ipc(2).ne.1.0) then call unlock_jt9() call sleep_msec(msdelay) go to 10 endif - shared_data%ss(2,1)=0.0 + shared_data%ipc(2)=0 nbytes=size_jt9() if(nbytes.le.0) then @@ -70,27 +70,30 @@ subroutine jt9a() local_params%nzhsym=nearly id2a(1:nearly*3456)=shared_data%id2(1:nearly*3456) id2a(nearly*3456+1:)=0 - call multimode_decoder(shared_data%ss,id2a,local_params,12000) + call multimode_decoder(shared_data%ipc(1),shared_data%ss,id2a, & + local_params,12000) nearly=47 local_params%nzhsym=nearly id2a(1:nearly*3456)=shared_data%id2(1:nearly*3456) id2a(nearly*3456+1:)=0 - call multimode_decoder(shared_data%ss,id2a,local_params,12000) + call multimode_decoder(shared_data%ipc(1),shared_data%ss,id2a, & + local_params,12000) local_params%nzhsym=50 endif ! Normal decoding pass - call multimode_decoder(shared_data%ss,shared_data%id2,local_params,12000) + call multimode_decoder(shared_data%ipc(1),shared_data%ss,shared_data%id2, & + local_params,12000) call timer('decoder ',1) -! Wait here until GUI routine decodeDone() has set ss(3,1) to 1.0 +! Wait here until GUI routine decodeDone() has set ipc(3) to 1.0 100 call lock_jt9() - if(shared_data%ss(3,1).ne.1.0) then + if(shared_data%ipc(3).ne.1.0) then call unlock_jt9() call sleep_msec(msdelay) go to 100 endif - shared_data%ss(3,1)=0. + shared_data%ipc(3)=0 call unlock_jt9() go to 10 diff --git a/lib/jt9com.f90 b/lib/jt9com.f90 index c595582d6..3a6b8759c 100644 --- a/lib/jt9com.f90 +++ b/lib/jt9com.f90 @@ -49,6 +49,7 @@ end type params_block type, bind(C) :: dec_data + integer(c_int) :: ipc(3) real(c_float) :: ss(184,NSMAX) real(c_float) :: savg(NSMAX) real(c_float) :: sred(5760) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 52394c8a5..1d9436b7f 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -845,8 +845,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, } } -// pause_jt9 (); - to_jt9(0,0,0); //initialize + to_jt9(0,0,0); //initialize IPC variables QStringList jt9_args { "-s", QApplication::applicationName () // shared memory key, @@ -2968,7 +2967,7 @@ void MainWindow::decode() //decode() //nagain=1 ==> decode only at fQSO +/- Tol char *to = (char*)mem_jt9->data(); - char *from = (char*) dec_data.ss; + char *from = (char*) dec_data.ipc; int size=sizeof(struct dec_data); if(dec_data.params.newdat==0) { int noffset {offsetof (struct dec_data, params.nutc)}; @@ -3073,13 +3072,13 @@ void::MainWindow::fast_decode_done() void MainWindow::to_jt9(qint32 n, qint32 istart, qint32 idone) { - float ss0[3]; + int ipc[3]; mem_jt9->lock (); - memcpy(ss0,(char*)mem_jt9->data(),12); - ss0[0]=n; - if(istart>=0) ss0[1]=istart; - if(idone>=0) ss0[2]=idone; - memcpy((char*)mem_jt9->data(),ss0,12); + memcpy(ipc,(char*)mem_jt9->data(),12); + ipc[0]=n; + if(istart>=0) ipc[1]=istart; + if(idone>=0) ipc[2]=idone; + memcpy((char*)mem_jt9->data(),ipc,12); mem_jt9->unlock (); }