summaryrefslogtreecommitdiff
path: root/lib/ft8var/fillhashvar.f90
blob: 39489a08a69b381e09d60ffadb5adce74d5b18f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
subroutine fillhashvar(numthreads,lfill,knowledge)

  use packjt77
  use ft8_mod1, only : mycall,hiscall
  integer, intent(in) :: numthreads
  logical, intent(in) :: lfill
  type(pack77_state), target, optional, intent(inout) :: knowledge
  character*13 cw

  if(present(knowledge)) then
    if(lfill) then
      call fold_queued_calls_for_state(knowledge,numthreads)
    else
      call prepare_configured_decode_for_state(knowledge,mycall,hiscall)
    endif
    return
  endif

  if(lfill) then
    ! End of a configured/var decode pass: merge per-thread successful decode
    ! effects into the shared callsign hash and recent-call state.
    do i=1,numthreads
      do m=1,nqueued_calls_by_thread(i)
        nposition=thread_call_index(i)+m
        cw=queued_calls_by_thread(nposition)
!print *,i,m,cw
        call save_hash_call(cw,n10,n12,n22)
      enddo
    enddo
    call fold_queued_recent_calls(numthreads)
  else
    ! Start of a configured/var decode pass: clear staged worker effects and
    ! snapshot the operator-configured calls used by hash-only decode guards.
    nqueued_calls_by_thread=0
    nqueued_recent_calls_by_thread=0
    mycall13=mycall//' '; dxcall13=hiscall//' '
    call sync_configured_calls_for_decode_start()
  endif

  return
end subroutine fillhashvar