mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-13 15:41:50 -05:00
d431e2cecd
Re-factor the JT4, JT65 and JT9 decoders as Fortran modules using type bound procedures, the decoder types implement a callback procedure such that he client of the decoder can interpret the decode results as they need. The JT4 decoder has a second callback that delivers message averaging status. Also the previously separate source files lib/jt4a.f90 and lib/avg4.f90 have been merged into lib/jt4_decode.f90 as private type bound procedures of the new jt4_decoder type. Re-factored the lib/decoder.f90 subroutine to utilize the new decoder types. Added local procedures to process decodes and averaging results including the necessary OpenMP synchronization directives for parallel JT9+JT65 decoding. Added the jt65_test module which is a basic test harness for JT65 decoding. Re-factored the jt65 utility to utilize the new jt65_test module. Changed a few integers to logical variables where their meaning is clearly binary. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6324 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
76 lines
2.0 KiB
Fortran
76 lines
2.0 KiB
Fortran
subroutine jt9a()
|
|
use, intrinsic :: iso_c_binding, only: c_f_pointer
|
|
use prog_args
|
|
use timer_module, only: timer
|
|
use timer_impl, only: init_timer !, limtrace
|
|
|
|
include 'jt9com.f90'
|
|
|
|
! These routines connect the shared memory region to the decoder.
|
|
interface
|
|
function address_jt9()
|
|
use, intrinsic :: iso_c_binding, only: c_ptr
|
|
type(c_ptr) :: address_jt9
|
|
end function address_jt9
|
|
end interface
|
|
|
|
integer*1 attach_jt9
|
|
! integer*1 lock_jt9,unlock_jt9
|
|
integer size_jt9
|
|
! Multiple instances:
|
|
character*80 mykey
|
|
type(dec_data), pointer :: shared_data
|
|
type(params_block) :: local_params
|
|
logical fileExists
|
|
|
|
! Multiple instances:
|
|
i0 = len(trim(shm_key))
|
|
|
|
call init_timer (trim(data_dir)//'/timer.out')
|
|
! open(23,file=trim(data_dir)//'/CALL3.TXT',status='unknown')
|
|
|
|
! limtrace=-1 !Disable all calls to timer()
|
|
|
|
! Multiple instances: set the shared memory key before attaching
|
|
mykey=trim(repeat(shm_key,1))
|
|
i0 = len(mykey)
|
|
i0=setkey_jt9(trim(mykey))
|
|
|
|
i1=attach_jt9()
|
|
|
|
10 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists)
|
|
if(fileExists) then
|
|
call sleep_msec(100)
|
|
go to 10
|
|
endif
|
|
|
|
inquire(file=trim(temp_dir)//'/.quit',exist=fileExists)
|
|
if(fileExists) then
|
|
i1=detach_jt9()
|
|
go to 999
|
|
endif
|
|
if(i1.eq.999999) stop !Silence compiler warning
|
|
|
|
nbytes=size_jt9()
|
|
if(nbytes.le.0) then
|
|
print*,'jt9a: Shared memory mem_jt9 does not exist.'
|
|
print*,"Must start 'jt9 -s <thekey>' from within WSJT-X."
|
|
go to 999
|
|
endif
|
|
call c_f_pointer(address_jt9(),shared_data)
|
|
local_params=shared_data%params !save a copy because wsjtx carries on accessing
|
|
call flush(6)
|
|
call timer('decoder ',0)
|
|
call multimode_decoder(shared_data%ss,shared_data%id2,local_params,12000)
|
|
call timer('decoder ',1)
|
|
|
|
100 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists)
|
|
if(fileExists) go to 10
|
|
call sleep_msec(100)
|
|
go to 100
|
|
|
|
999 call timer('decoder ',101)
|
|
|
|
return
|
|
end subroutine jt9a
|