Work around what appears to be a gcc 4.9.0 defect.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4036 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-04-16 16:43:52 +00:00
parent d157c20016
commit 3b8c9c0f0e
1 changed files with 141 additions and 140 deletions

View File

@ -1,140 +1,141 @@
program jt9 program jt9
! Decoder for JT9. Can run stand-alone, reading data from *.wav files; ! Decoder for JT9. Can run stand-alone, reading data from *.wav files;
! or as the back end of wsjt-x, with data placed in a shared memory region. ! or as the back end of wsjt-x, with data placed in a shared memory region.
use options use options
use prog_args use prog_args
include 'constants.f90' include 'constants.f90'
integer*4 ihdr(11) integer*4 ihdr(11)
real*4 s(NSMAX) real*4 s(NSMAX)
integer*2 id2 integer*2 id2
character c character c
character(len=500) optarg, infile character(len=500) optarg, infile
integer*4 arglen,stat,offset,remain integer*4 arglen,stat,offset,remain
logical :: shmem = .false., read_files = .false., have_args = .false. logical :: shmem = .false., read_files = .false., have_args = .false.
common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX),nutc,ndiskdat,ntr, & type (option) :: long_options (0)
mousefqso,newdat,nfa,nfsplit,nfb,ntol,kin,nzhsym,nsynced,ndecoded common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX),nutc,ndiskdat,ntr, &
common/tracer/limtrace,lu mousefqso,newdat,nfa,nfsplit,nfb,ntol,kin,nzhsym,nsynced,ndecoded
common/tracer/limtrace,lu
do
call getopt('s:e:a:r:p:d:f:',(/type(option) ::/),c,optarg,arglen,stat,offset,remain) do
if (stat .ne. 0) then call getopt('s:e:a:r:p:d:f:',long_options,c,optarg,arglen,stat,offset,remain)
exit if (stat .ne. 0) then
end if exit
have_args = .true. end if
select case (c) have_args = .true.
case ('s') select case (c)
shmem = .true. case ('s')
shm_key = optarg(:arglen) shmem = .true.
shm_key = optarg(:arglen)
case ('e')
exe_dir = optarg(:arglen) case ('e')
exe_dir = optarg(:arglen)
case ('a')
data_dir = optarg(:arglen) case ('a')
data_dir = optarg(:arglen)
case ('p')
read_files = .true. case ('p')
read (optarg(:arglen), *) ntrperiod read_files = .true.
read (optarg(:arglen), *) ntrperiod
case ('d')
read_files = .true. case ('d')
read (optarg(:arglen), *) ndepth read_files = .true.
read (optarg(:arglen), *) ndepth
case ('f')
read_files = .true. case ('f')
read (optarg(:arglen), *) nrxfreq read_files = .true.
end select read (optarg(:arglen), *) nrxfreq
end do end select
end do
if (.not. have_args .or. (stat .lt. 0 .or. (shmem .and. remain .gt. 0) &
.or. (read_files .and. remain .eq. 0) .or. (shmem .and. read_files))) then if (.not. have_args .or. (stat .lt. 0 .or. (shmem .and. remain .gt. 0) &
print*,'Usage: jt9 -p TRperiod -d ndepth -f rxfreq -e exe_dir file1 [file2 ...]' .or. (read_files .and. remain .eq. 0) .or. (shmem .and. read_files))) then
print*,' Reads data from *.wav files.' print*,'Usage: jt9 -p TRperiod -d ndepth -f rxfreq -e exe_dir file1 [file2 ...]'
print*,'' print*,' Reads data from *.wav files.'
print*,' jt9 -s <key> -e exe_dir' print*,''
print*,' Gets data from shared memory region with key==<key>' print*,' jt9 -s <key> -e exe_dir'
go to 999 print*,' Gets data from shared memory region with key==<key>'
endif go to 999
endif
if (shmem) then
call jt9a() if (shmem) then
go to 999 call jt9a()
endif go to 999
endif
limtrace=0
lu=12 limtrace=0
lu=12
do iarg = offset + 1, offset + remain
call get_command_argument (iarg, optarg, arglen) do iarg = offset + 1, offset + remain
infile = optarg(:arglen) call get_command_argument (iarg, optarg, arglen)
open(10,file=infile,access='stream',status='old',err=998) infile = optarg(:arglen)
read(10) ihdr open(10,file=infile,access='stream',status='old',err=998)
nutc0=ihdr(1) !Silence compiler warning read(10) ihdr
i1=index(infile,'.wav') nutc0=ihdr(1) !Silence compiler warning
read(infile(i1-4:i1-1),*,err=1) nutc0 i1=index(infile,'.wav')
go to 2 read(infile(i1-4:i1-1),*,err=1) nutc0
1 nutc0=0 go to 2
2 nsps=0 1 nutc0=0
if(ntrperiod.eq.1) then 2 nsps=0
nsps=6912 if(ntrperiod.eq.1) then
nzhsym=173 nsps=6912
else if(ntrperiod.eq.2) then nzhsym=173
nsps=15360 else if(ntrperiod.eq.2) then
nzhsym=178 nsps=15360
else if(ntrperiod.eq.5) then nzhsym=178
nsps=40960 else if(ntrperiod.eq.5) then
nzhsym=172 nsps=40960
else if(ntrperiod.eq.10) then nzhsym=172
nsps=82944 else if(ntrperiod.eq.10) then
nzhsym=171 nsps=82944
else if(ntrperiod.eq.30) then nzhsym=171
nsps=252000 else if(ntrperiod.eq.30) then
nzhsym=167 nsps=252000
endif nzhsym=167
if(nsps.eq.0) stop 'Error: bad TRperiod' endif
if(nsps.eq.0) stop 'Error: bad TRperiod'
kstep=nsps/2
k=0 kstep=nsps/2
nhsym0=-999 k=0
npts=(60*ntrperiod-6)*12000 nhsym0=-999
if(iarg .eq. offset + 1) then npts=(60*ntrperiod-6)*12000
open(12,file=trim(data_dir)//'/timer.out',status='unknown') if(iarg .eq. offset + 1) then
call timer('jt9 ',0) open(12,file=trim(data_dir)//'/timer.out',status='unknown')
endif call timer('jt9 ',0)
endif
id2=0 !??? Why is this necessary ???
id2=0 !??? Why is this necessary ???
do iblk=1,npts/kstep
k=iblk*kstep do iblk=1,npts/kstep
call timer('read_wav',0) k=iblk*kstep
read(10,end=10) id2(k-kstep+1:k) call timer('read_wav',0)
call timer('read_wav',1) read(10,end=10) id2(k-kstep+1:k)
call timer('read_wav',1)
nhsym=(k-2048)/kstep
if(nhsym.ge.1 .and. nhsym.ne.nhsym0) then nhsym=(k-2048)/kstep
! Emit signal readyForFFT if(nhsym.ge.1 .and. nhsym.ne.nhsym0) then
ingain=0 ! Emit signal readyForFFT
call timer('symspec ',0) ingain=0
call symspec(k,ntrperiod,nsps,ingain,slope,pxdb,s,df3,ihsym,npts8) call timer('symspec ',0)
call timer('symspec ',1) call symspec(k,ntrperiod,nsps,ingain,slope,pxdb,s,df3,ihsym,npts8)
nhsym0=nhsym call timer('symspec ',1)
if(ihsym.ge.173) go to 10 nhsym0=nhsym
endif if(ihsym.ge.173) go to 10
enddo endif
enddo
10 close(10)
call fillcom(nutc0,ndepth,nrxfreq) 10 close(10)
call decoder(ss,id2) call fillcom(nutc0,ndepth,nrxfreq)
enddo call decoder(ss,id2)
enddo
call timer('jt9 ',1)
call timer('jt9 ',101) call timer('jt9 ',1)
go to 999 call timer('jt9 ',101)
go to 999
998 print*,'Cannot open file:'
print*,infile 998 print*,'Cannot open file:'
print*,infile
999 end program jt9
999 end program jt9