2013-08-15 13:32:46 -04:00
|
|
|
subroutine jt9a(thekey,ldir)
|
2012-11-21 12:42:53 -05:00
|
|
|
|
2013-07-18 20:23:40 -04:00
|
|
|
character(len=*), intent(in):: thekey
|
2013-08-15 13:32:46 -04:00
|
|
|
character(len=*), intent(in):: ldir
|
2012-11-21 12:42:53 -05:00
|
|
|
|
2013-07-18 20:23:40 -04:00
|
|
|
! These routines connect the shared memory region to the decoder.
|
2012-11-21 12:42:53 -05:00
|
|
|
interface
|
|
|
|
function address_jt9()
|
2013-03-23 11:35:32 -04:00
|
|
|
integer*1, pointer :: address_jt9
|
2012-11-21 12:42:53 -05:00
|
|
|
end function address_jt9
|
|
|
|
end interface
|
|
|
|
|
2013-05-22 21:05:37 -04:00
|
|
|
integer*1 attach_jt9
|
|
|
|
! integer*1 lock_jt9,unlock_jt9
|
2012-11-21 12:42:53 -05:00
|
|
|
integer size_jt9
|
2013-03-23 11:35:32 -04:00
|
|
|
integer*1, pointer :: p_jt9
|
2012-11-21 12:42:53 -05:00
|
|
|
character*80 cwd
|
2013-07-18 20:23:40 -04:00
|
|
|
! Multiple instances:
|
|
|
|
character*80 mykey
|
2012-11-21 12:42:53 -05:00
|
|
|
logical fileExists
|
|
|
|
common/tracer/limtrace,lu
|
|
|
|
|
2013-07-18 20:23:40 -04:00
|
|
|
! Multiple instances:
|
|
|
|
i0 = len(trim(thekey))
|
|
|
|
|
2012-11-21 12:42:53 -05:00
|
|
|
call getcwd(cwd)
|
2012-11-24 10:18:17 -05:00
|
|
|
open(12,file='timer.out',status='unknown')
|
2012-11-21 12:42:53 -05:00
|
|
|
|
|
|
|
limtrace=0
|
2013-07-08 09:17:22 -04:00
|
|
|
! limtrace=-1 !Disable all calls to timer()
|
2012-11-21 12:42:53 -05:00
|
|
|
lu=12
|
2013-07-18 20:23:40 -04:00
|
|
|
|
|
|
|
! Multiple instances: set the shared memory key before attaching
|
|
|
|
mykey=trim(repeat(thekey,1))
|
|
|
|
i0 = len(mykey)
|
|
|
|
i0=setkey_jt9(trim(mykey))
|
|
|
|
|
2012-11-21 12:42:53 -05:00
|
|
|
i1=attach_jt9()
|
|
|
|
|
2013-08-15 13:32:46 -04:00
|
|
|
10 inquire(file=trim(ldir)//'/.lock',exist=fileExists)
|
2012-11-21 12:42:53 -05:00
|
|
|
if(fileExists) then
|
|
|
|
call sleep_msec(100)
|
|
|
|
go to 10
|
|
|
|
endif
|
|
|
|
|
2013-08-15 13:32:46 -04:00
|
|
|
inquire(file=trim(ldir)//'/.quit',exist=fileExists)
|
2012-11-21 12:42:53 -05:00
|
|
|
if(fileExists) then
|
|
|
|
! call ftnquit
|
2013-05-22 21:05:37 -04:00
|
|
|
i1=detach_jt9()
|
2012-11-21 12:42:53 -05:00
|
|
|
go to 999
|
|
|
|
endif
|
2013-05-22 21:05:37 -04:00
|
|
|
if(i1.eq.999999) stop !Silence compiler warning
|
2012-11-21 12:42:53 -05:00
|
|
|
|
|
|
|
nbytes=size_jt9()
|
|
|
|
if(nbytes.le.0) then
|
|
|
|
print*,'jt9a: Shared memory mem_jt9 does not exist.'
|
2013-07-18 20:23:40 -04:00
|
|
|
print*,"Must start 'jt9 -s <thekey>' from within WSJT-X."
|
2012-11-21 12:42:53 -05:00
|
|
|
go to 999
|
|
|
|
endif
|
|
|
|
p_jt9=>address_jt9()
|
2013-07-08 09:17:22 -04:00
|
|
|
call timer('jt9b ',0)
|
2012-11-21 12:42:53 -05:00
|
|
|
call jt9b(p_jt9,nbytes)
|
2013-07-08 09:17:22 -04:00
|
|
|
call timer('jt9b ',1)
|
2012-11-21 12:42:53 -05:00
|
|
|
|
2013-08-15 13:32:46 -04:00
|
|
|
100 inquire(file=trim(ldir)//'/.lock',exist=fileExists)
|
2012-11-21 12:42:53 -05:00
|
|
|
if(fileExists) go to 10
|
2013-03-26 10:00:51 -04:00
|
|
|
call sleep_msec(100)
|
2012-11-21 12:42:53 -05:00
|
|
|
go to 100
|
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
999 call timer('jt9b ',101)
|
|
|
|
|
|
|
|
return
|
2012-11-21 12:42:53 -05:00
|
|
|
end subroutine jt9a
|