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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
module ft8var_work_types
implicit none
type :: tmpcqdec_struct
real :: freq,xdt
end type
type :: tmpcqsig_struct
real :: freq,xdt
complex :: cs(0:7,79)
end type
type :: tmpmyc_struct
real :: freq,xdt
end type
type :: tmpmycsig_struct
real :: freq,xdt
complex :: cs(0:7,79)
end type
type :: tmpqsosig_struct
real :: freq,xdt
complex :: cs(0:7,79)
end type
end module ft8var_work_types
module ft8var_codec_context
use packjt77, only: pack77_state,pack77_for_state,unpack77_configured_for_state, &
pack77_options,unpack77_options
use ft8_codec_context, only: get_ft8_codec_state
use ft8_mod1, only: icos7,graymap
implicit none
private
public :: genft8var_for_state,genft8sdvar_for_state,ft8var_tones_from_77bits
public :: tonesdvar,ft8sd1var,ft8sdvar,ft8svar,ft8mfcqvar
interface
subroutine tonesdvar(msgd,lcq,knowledge)
import pack77_state
character(len=37) :: msgd
logical(kind=1) :: lcq
type(pack77_state), target, optional, intent(inout) :: knowledge
end subroutine
subroutine ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq,knowledge)
import pack77_state
real :: s8(0:7,79)
integer :: itone(79)
character(len=37) :: msgd,msg37
logical(kind=1) :: lft8sd,lcq
type(pack77_state), target, optional, intent(inout) :: knowledge
end subroutine
subroutine ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq,knowledge)
import pack77_state
real :: s8(0:7,79),srr
integer :: itone(79)
character(len=37) :: msgd,msg37
logical(kind=1) :: lft8sd,lcq
type(pack77_state), target, optional, intent(inout) :: knowledge
end subroutine
subroutine ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint,knowledge)
import pack77_state
real :: s8(0:7,79),srr
integer :: itone(79),nft8rxfsens
character(len=37) :: msg37
logical(kind=1) :: lft8s,stophint
type(pack77_state), target, optional, intent(inout) :: knowledge
end subroutine
subroutine ft8mfcqvar(s8,itone,msgd,msg37,lft8sd,knowledge)
import pack77_state
real :: s8(0:7,79)
integer :: itone(79)
character(len=37) :: msgd,msg37
logical(kind=1) :: lft8sd
type(pack77_state), target, optional, intent(inout) :: knowledge
end subroutine
end interface
contains
subroutine genft8var_for_state(state,msg,i3,n3,ntxhash,msgsent,msgbits,itone)
type(pack77_state), target, intent(inout) :: state
character(len=37), intent(in) :: msg
integer, intent(inout) :: i3,n3
integer, intent(in) :: ntxhash
character(len=37), intent(out) :: msgsent
integer(kind=1), intent(out) :: msgbits(77)
integer, intent(out) :: itone(79)
character(len=77) :: c77
logical :: unpacked
call pack77_for_state(state,msg,i3,n3,c77,pack77_options(record_tx_hashes=ntxhash.eq.1))
call unpack77_configured_for_state(state,c77,0,msgsent,unpacked, &
unpack77_options(record_hashes=.false.,record_recent_calls=.false.))
read(c77,'(77i1)',err=10) msgbits
if(unpacked) then
call ft8var_tones_from_77bits(msgbits,itone)
return
endif
10 msgbits=0
itone=0
msgsent='*** bad message ***'
end subroutine genft8var_for_state
subroutine genft8sdvar_for_state(state,msg,i3,n3,msgsent,msgbits,itone)
type(pack77_state), target, intent(inout) :: state
character(len=37), intent(in) :: msg
integer, intent(out) :: i3,n3
character(len=37), intent(out) :: msgsent
integer(kind=1), intent(out) :: msgbits(77)
integer, intent(out) :: itone(79)
character(len=77) :: c77
logical :: unpacked
i3=-1
n3=-1
call pack77_for_state(state,msg,i3,n3,c77,pack77_options(record_tx_hashes=.false.))
if(.not.(i3.ge.0 .and. (i3.eq.1 .or. i3.eq.2) .and. index(msg,'<').eq.0)) then
i3=-1
n3=-1
endif
if(i3.ge.0) then
call unpack77_configured_for_state(state,c77,0,msgsent,unpacked, &
unpack77_options(record_hashes=.false.,record_recent_calls=.false.))
read(c77,'(77i1)',err=20) msgbits
if(unpacked) then
call ft8var_tones_from_77bits(msgbits,itone)
return
endif
endif
20 msgbits=0
itone=0
msgsent='*** bad message ***'
end subroutine genft8sdvar_for_state
subroutine ft8var_tones_from_77bits(msgbits,itone)
integer(kind=1), intent(in) :: msgbits(77)
integer, intent(out) :: itone(79)
integer(kind=1) :: codeword(174)
integer :: i,j,k,indx
call encode174_91var(msgbits,codeword)
itone(1:7)=icos7
itone(37:43)=icos7
itone(73:79)=icos7
k=7
do j=1,58
i=3*j-2
k=k+1
if(j.eq.30) k=k+7
indx=codeword(i)*4+codeword(i+1)*2+codeword(i+2)
itone(k)=graymap(indx)
enddo
end subroutine ft8var_tones_from_77bits
end module ft8var_codec_context
subroutine genft8var(msg,i3,n3,ntxhash,msgsent,msgbits,itone)
use ft8var_codec_context, only: genft8var_for_state
use ft8_codec_context, only: get_ft8_codec_state
use packjt77, only: pack77_state
implicit none
character(len=37), intent(in) :: msg
integer, intent(inout) :: i3,n3
integer, intent(in) :: ntxhash
character(len=37), intent(out) :: msgsent
integer(kind=1), intent(out) :: msgbits(77)
integer, intent(out) :: itone(79)
type(pack77_state), pointer :: state
state => get_ft8_codec_state()
call genft8var_for_state(state,msg,i3,n3,ntxhash,msgsent,msgbits,itone)
end subroutine genft8var
subroutine get_tones_from_77bits(msgbits,itone)
use ft8var_codec_context, only: ft8var_tones_from_77bits
implicit none
integer(kind=1), intent(in) :: msgbits(77)
integer, intent(out) :: itone(79)
call ft8var_tones_from_77bits(msgbits,itone)
end subroutine get_tones_from_77bits
|