mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-04 08:21:17 -05:00
Implement special tokens CQ, DE, QRZ, ... in pack28/unpack28.
This commit is contained in:
parent
acd6d5cab9
commit
12e0def237
@ -7,22 +7,69 @@ subroutine pack28(c13,n28)
|
||||
integer nc(6)
|
||||
character*13 c13
|
||||
character*6 callsign
|
||||
character*37 c1
|
||||
character*36 c2
|
||||
character*10 c3
|
||||
character*27 c4
|
||||
data c1/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
|
||||
data c2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
|
||||
data c3/'0123456789'/
|
||||
data c4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
|
||||
character*1 c
|
||||
character*4 c4
|
||||
character*37 a1
|
||||
character*36 a2
|
||||
character*10 a3
|
||||
character*27 a4
|
||||
data a1/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
|
||||
data a2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
|
||||
data a3/'0123456789'/
|
||||
data a4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
|
||||
data nc/37,36,19,27,27,27/
|
||||
|
||||
n28=0
|
||||
callsign=c13(1:6)
|
||||
n28=-1
|
||||
! Check for special tokens first
|
||||
if(c13(1:3).eq.'DE ') then
|
||||
n28=0
|
||||
go to 900
|
||||
endif
|
||||
|
||||
if(c13(1:4).eq.'QRZ ') then
|
||||
n28=1
|
||||
go to 900
|
||||
endif
|
||||
|
||||
if(c13(1:3).eq.'CQ ') then
|
||||
n28=2
|
||||
go to 900
|
||||
endif
|
||||
|
||||
if(c13(1:3).eq.'CQ_') then
|
||||
n=len(trim(c13))
|
||||
if(n.ge.4 .and. n.le.7) then
|
||||
nlet=0
|
||||
nnum=0
|
||||
do i=4,n
|
||||
c=c13(i:i)
|
||||
if(c.ge.'A' .and. c.le.'Z') nlet=nlet+1
|
||||
if(c.ge.'0' .and. c.le.'9') nnum=nnum+1
|
||||
enddo
|
||||
if(nnum.eq.3 .and. nlet.eq.0) then
|
||||
read(c13(4:3+nnum),*) nqsy
|
||||
n28=3+nqsy
|
||||
go to 900
|
||||
endif
|
||||
if(nlet.ge.1 .and. nlet.le.4 .and. nnum.eq.0) then
|
||||
c4=c13(4:n)//' '
|
||||
c4=adjustr(c4)
|
||||
m=0
|
||||
do i=1,4
|
||||
j=0
|
||||
c=c4(i:i)
|
||||
if(c.ge.'A' .and. c.le.'Z') j=ichar(c)-ichar('A')+1
|
||||
m=27*m + j
|
||||
enddo
|
||||
n28=3+1000+m
|
||||
go to 900
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
callsign=c13(1:6)
|
||||
! Work-around for Swaziland prefix:
|
||||
if(c13(1:4).eq.'3DA0') callsign='3D0'//c13(5:7)
|
||||
|
||||
! Work-around for Guinea prefixes:
|
||||
if(c13(1:2).eq.'3X' .and. c13(3:3).ge.'A' .and. &
|
||||
c13(3:3).le.'Z') callsign='Q'//c13(3:6)
|
||||
@ -48,21 +95,21 @@ subroutine pack28(c13,n28)
|
||||
n=len(trim(callsign))
|
||||
callsign=adjustr(callsign)
|
||||
|
||||
i1=36*10*27*27*27*(index(c1,callsign(1:1))-1)
|
||||
i2=10*27*27*27*(index(c2,callsign(2:2))-1)
|
||||
i3=27*27*27*(index(c3,callsign(3:3))-1)
|
||||
i4=27*27*(index(c4,callsign(4:4))-1)
|
||||
i5=27*(index(c4,callsign(5:5))-1)
|
||||
i6=index(c4,callsign(6:6))-1
|
||||
i1=36*10*27*27*27*(index(a1,callsign(1:1))-1)
|
||||
i2=10*27*27*27*(index(a2,callsign(2:2))-1)
|
||||
i3=27*27*27*(index(a3,callsign(3:3))-1)
|
||||
i4=27*27*(index(a4,callsign(4:4))-1)
|
||||
i5=27*(index(a4,callsign(5:5))-1)
|
||||
i6=index(a4,callsign(6:6))-1
|
||||
n28=i1+i2+i3+i4+i5+i6
|
||||
|
||||
! n28=index(c1,callsign(1:1))-1
|
||||
! n28=n28*nc(2) + index(c2,callsign(2:2)) - 1
|
||||
! n28=n28*nc(3) + index(c3,callsign(3:3)) - 1
|
||||
! n28=n28*nc(4) + index(c4,callsign(4:4)) - 1
|
||||
! n28=n28*nc(5) + index(c4,callsign(5:5)) - 1
|
||||
! n28=n28*nc(6) + index(c4,callsign(6:6)) - 1
|
||||
! n28=index(a1,callsign(1:1))-1
|
||||
! n28=n28*nc(2) + index(a2,callsign(2:2)) - 1
|
||||
! n28=n28*nc(3) + index(a3,callsign(3:3)) - 1
|
||||
! n28=n28*nc(4) + index(a4,callsign(4:4)) - 1
|
||||
! n28=n28*nc(5) + index(a4,callsign(5:5)) - 1
|
||||
! n28=n28*nc(6) + index(a4,callsign(6:6)) - 1
|
||||
n28=n28 + NTOKENS + N24
|
||||
|
||||
return
|
||||
|
||||
900 return
|
||||
end subroutine pack28
|
||||
|
@ -1,4 +1,4 @@
|
||||
subroutine unpack28(n28,c13)
|
||||
subroutine unpack28(n28_0,c13)
|
||||
|
||||
parameter (NTOKENS=4874084,N24=16777216)
|
||||
integer nc(6)
|
||||
@ -13,8 +13,31 @@ subroutine unpack28(n28,c13)
|
||||
data c4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
|
||||
data nc/37,36,19,27,27,27/
|
||||
|
||||
n28=n28_0
|
||||
if(n28.lt.NTOKENS) then
|
||||
!code for tokens CQ, DE, QRZ, etc.
|
||||
! Special tokens DE, QRZ, CQ, CQ_nnn, CQ_aaaa
|
||||
if(n28.eq.0) c13='DE '
|
||||
if(n28.eq.1) c13='QRZ '
|
||||
if(n28.eq.2) c13='CQ '
|
||||
if(n28.le.2) go to 900
|
||||
if(n28.le.1002) then
|
||||
write(c13,1002) n28-3
|
||||
1002 format('CQ_',i3.3)
|
||||
go to 900
|
||||
endif
|
||||
if(n28.le.532443) then
|
||||
n=n28-1003
|
||||
i1=n/(27*27*27)
|
||||
n=n-27*27*27*i1
|
||||
i2=n/(27*27)
|
||||
n=n-27*27*i2
|
||||
i3=n/27
|
||||
i4=n-27*i3
|
||||
c13=c4(i1+1:i1+1)//c4(i2+1:i2+1)//c4(i3+1:i3+1)//c4(i4+1:i4+1)
|
||||
c13=adjustl(c13)
|
||||
c13='CQ_'//c13
|
||||
go to 900
|
||||
endif
|
||||
endif
|
||||
n28=n28-NTOKENS
|
||||
if(n28.lt.N24) then
|
||||
@ -23,24 +46,19 @@ subroutine unpack28(n28,c13)
|
||||
|
||||
! Standard callsign
|
||||
n=n28 - N24
|
||||
|
||||
i1=n/(36*10*27*27*27)
|
||||
n=n-36*10*27*27*27*i1
|
||||
|
||||
i2=n/(10*27*27*27)
|
||||
n=n-10*27*27*27*i2
|
||||
|
||||
i3=n/(27*27*27)
|
||||
n=n-27*27*27*i3
|
||||
|
||||
i4=n/(27*27)
|
||||
n=n-27*27*i4
|
||||
|
||||
i5=n/27
|
||||
i6=n-27*i5
|
||||
c13=c1(i1+1:i1+1)//c2(i2+1:i2+1)//c3(i3+1:i3+1)//c4(i4+1:i4+1)// &
|
||||
c4(i5+1:i5+1)//c4(i6+1:i6+1)//' '
|
||||
c13=adjustl(c13)
|
||||
|
||||
return
|
||||
900 return
|
||||
end subroutine unpack28
|
||||
|
Loading…
Reference in New Issue
Block a user