diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90 index 47cd3b6bb..e72b5add6 100644 --- a/lib/77bit/packjt77.f90 +++ b/lib/77bit/packjt77.f90 @@ -15,6 +15,38 @@ module packjt77 contains +subroutine readhash(filename) + character(len=*), intent(in) :: filename + logical :: file_exists + + inquire(file=filename, exist=file_exists) + if (file_exists) then + open(unit=10, file=filename, access='STREAM', form='UNFORMATTED', STATUS='OLD') + + READ(10) calls10 + READ(10) calls12 + READ(10) calls22 + READ(10) ihash22 + READ(10) nzhash + close(unit=10) + endif + +end subroutine readhash + +subroutine writehash(filename) + character(len=*), intent(in) :: filename + + open(unit=10, file=filename, access='STREAM', form='UNFORMATTED', STATUS='REPLACE') + + WRITE(10) calls10 + WRITE(10) calls12 + WRITE(10) calls22 + WRITE(10) ihash22 + WRITE(10) nzhash + close(unit=10) + +end subroutine writehash + subroutine hash10(n10,c13) character*13 c13 diff --git a/lib/jt9.f90 b/lib/jt9.f90 index d284f6dd2..2ab955ffb 100644 --- a/lib/jt9.f90 +++ b/lib/jt9.f90 @@ -10,7 +10,8 @@ program jt9 use timer_module, only: timer use timer_impl, only: init_timer, fini_timer use readwav - + use packjt77 + include 'jt9com.f90' integer*2 id2a(180000) @@ -26,8 +27,8 @@ program jt9 fhigh=4000,nrxfreq=1500,ndepth=1,nexp_decode=0,nQSOProg=0 logical :: read_files = .true., tx9 = .false., display_help = .false., & bLowSidelobes = .false., nexp_decode_set = .false., & - have_ntol = .false. - type (option) :: long_options(33) = [ & + have_ntol = .false., persist_hash = .false. + type (option) :: long_options(34) = [ & option ('help', .false., 'h', 'Display this help message', ''), & option ('shmem',.true.,'s','Use shared memory for sample data','KEY'), & option ('tr-period', .true., 'p', 'Tx/Rx period, default SECONDS=60', & @@ -75,6 +76,8 @@ program jt9 option ('my-grid', .true., 'G', 'my grid locator', 'GRID'), & option ('his-call', .true., 'x', 'his callsign', 'CALL'), & option ('his-grid', .true., 'g', 'his grid locator', 'GRID'), & + option ('persist-hash', .true., & + 'P', 'persist hashcodes', 'PATH'), & option ('experience-decode', .true., 'X', & 'experience based decoding flags (1..n), default FLAGS=0', & 'FLAGS') ] @@ -92,7 +95,7 @@ program jt9 TRperiod=60.d0 do - call getopt('hs:e:a:b:r:m:p:d:f:F:w:t:9876543WYqkTL:S:H:c:G:x:g:X:Q:', & + call getopt('hs:e:a:b:r:m:p:d:f:F:w:t:9876543WYqkTL:S:H:c:G:x:g:P:X:Q:', & long_options,c,optarg,arglen,stat,offset,remain,.true.) if (stat .ne. 0) then exit @@ -164,6 +167,9 @@ program jt9 read (optarg(:arglen), *) hiscall case ('g') read (optarg(:arglen), *) hisgrid + case ('P') + hash_file = optarg(:arglen) + persist_hash = .true. case ('X') read (optarg(:arglen), *) nexp_decode nexp_decode_set = .true. @@ -188,6 +194,10 @@ program jt9 go to 999 endif + if (persist_hash) then + call readhash(hash_file) + end if + iret=fftwf_init_threads() !Initialize FFTW threading ! Default to 1 thread, but use nthreads for the big ones @@ -378,4 +388,8 @@ program jt9 call filbig(a,-1,1,0.0,0,0,0,0,0) !used for FFT plans call fftwf_cleanup_threads() call fftwf_cleanup() + + if (persist_hash) then + call writehash(hash_file) + end if end program jt9 diff --git a/lib/prog_args.f90 b/lib/prog_args.f90 index 63cdb7928..ff2a116d7 100644 --- a/lib/prog_args.f90 +++ b/lib/prog_args.f90 @@ -1,4 +1,5 @@ MODULE prog_args CHARACTER(len=80) :: shm_key CHARACTER(len=500) :: exe_dir = '.', data_dir = '.', temp_dir = '.' + CHARACTER(len=500) :: hash_file = 'hash.dat' END MODULE prog_args