summaryrefslogtreecommitdiff
path: root/lib/qra/q65/q65_set_list2.f90
blob: 7043dbadd30bde68e9464a8713c00de2dd08c0e5 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
subroutine q65_set_list2(mycall,hiscall,hisgrid,callers,nhist2,codewords,ncw)

  use types
  use q65_callers, only: Q65_MAX_CALLERS,Q65_MAX_CODEWORDS
  character*12 mycall,hiscall
  character*6 hisgrid,c6
  character*4 g4
  character*37 msg,msgsent
  logical std,isgrid
  integer codewords(63,Q65_MAX_CODEWORDS)
  integer itone(85)
  integer isync(22)
  type(q3list) callers(Q65_MAX_CALLERS)

  data isync/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/

  isgrid(g4)=g4(1:1).ge.'A' .and. g4(1:1).le.'R' .and. g4(2:2).ge.'A' .and. &
       g4(2:2).le.'R' .and. g4(3:3).ge.'0' .and. g4(3:3).le.'9' .and.       &
       g4(4:4).ge.'0' .and. g4(4:4).le.'9' .and. g4(1:4).ne.'RR73'

  ncw=0
  if(nhist2.lt.0 .or. nhist2.gt.Q65_MAX_CALLERS) return

  call stdcall(hiscall,std)
  jmax=nhist2
  if(std .and. isgrid(hisgrid(1:4))) then
     jmax=nhist2+1
     do j=1,nhist2
        if(callers(j)%call .eq. hiscall(1:6)) then
           jmax=nhist2
           exit
        endif
     enddo
  endif

  codewords(:,1)=0
  i=1
  do j=1,jmax
     if(j.eq.nhist2+1) then
        c6=hiscall(1:6)
        g4=hisgrid(1:4)
     else
        c6=callers(j)%call
        g4=callers(j)%grid
     endif
     do k=1,5
        msg=trim(mycall)//' '//trim(c6)
        j0=len(trim(msg))+1
        if(k.eq.1) msg=msg(1:j0)//g4
        if(k.eq.2) msg=msg(1:j0)//'R '//g4
        if(k.eq.3) msg(j0:j0+3)=' RRR'
        if(k.eq.4) msg(j0:j0+4)=' RR73'
        if(k.eq.5) msg(j0:j0+2)=' 73'
        ! Generate both flag values: a caller may or may not have set
        ! bit78 (copied our last transmission), and both must be
        ! present as exact candidates for the full-AP list match to
        ! recognize either with full sensitivity.
        do iflag=0,1
           i=i+1
           call genq65(msg,0,msgsent,itone,i3,n3,iflag)
           i0=1
           jj=0
           do kk=1,85
              if(kk.eq.isync(i0)) then
                 i0=i0+1
                 cycle
              endif
              jj=jj+1
              codewords(jj,i)=itone(kk) - 1
           enddo
!          write(71,3001) i,j,k,iflag,codewords(1:13,i),trim(msg)
!3001      format(4i3,2x,13i3,2x,a)
        enddo
     enddo
  enddo
  ncw=i

  return
end subroutine q65_set_list2