mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-06-25 06:35:17 -04:00
Fix a few more issues with hashed callsigns.
This commit is contained in:
parent
641db21672
commit
0462008e15
@ -2,4 +2,5 @@ gfortran -c ../packjt.f90
|
|||||||
gfortran -o encode77 -fbounds-check -Wall -Wno-conversion -Wno-real-q-constant \
|
gfortran -o encode77 -fbounds-check -Wall -Wno-conversion -Wno-real-q-constant \
|
||||||
encode77.f90 ../deg2grid.f90 ../grid2deg.f90 ../fix_contest_msg.f90 \
|
encode77.f90 ../deg2grid.f90 ../grid2deg.f90 ../fix_contest_msg.f90 \
|
||||||
../to_contest_msg.f90 ../fmtmsg.f90 ../azdist.f90 ../geodist.f90 \
|
../to_contest_msg.f90 ../fmtmsg.f90 ../azdist.f90 ../geodist.f90 \
|
||||||
ihashcall.f90 hash10.f90 hash12.f90 hash22.f90 packjt.o
|
ihashcall.f90 hash10.f90 hash12.f90 hash22.f90 save_hash_call.f90 \
|
||||||
|
packjt.o
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
gfortran -o test28 -fbounds-check -Wall -Wno-conversion test28.f90 pack28.f90 \
|
gfortran -o test28 -fbounds-check -Wall -Wno-conversion test28.f90 pack28.f90 \
|
||||||
unpack28.f90 ihashcall.f90 hash22.f90
|
unpack28.f90 ihashcall.f90 hash22.f90 save_hash_call.f90
|
||||||
|
@ -1,34 +1,18 @@
|
|||||||
subroutine hash10(n10,c13,isave)
|
subroutine hash10(n10,c13)
|
||||||
|
|
||||||
parameter (NMAX=20)
|
parameter (MAXHASH=20)
|
||||||
character*13 c13,callsign(NMAX)
|
character*13 c13,callsign(MAXHASH)
|
||||||
integer ihash(NMAX)
|
integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH)
|
||||||
logical first
|
common/hashcom/ihash10,ihash12,ihash22,callsign
|
||||||
data first/.true./
|
save /hashcom/
|
||||||
save first,ihash,callsign
|
|
||||||
|
|
||||||
if(first) then
|
c13='<...>'
|
||||||
ihash=-1
|
do i=1,MAXHASH
|
||||||
callsign=' '
|
if(ihash10(i).eq.n10) then
|
||||||
first=.false.
|
|
||||||
endif
|
|
||||||
|
|
||||||
if(isave.ge.0) then
|
|
||||||
do i=1,NMAX
|
|
||||||
if(ihash(i).eq.n10) go to 900 !This one is already in the list
|
|
||||||
enddo
|
|
||||||
ihash(NMAX:2:-1)=ihash(NMAX-1:1:-1)
|
|
||||||
callsign(NMAX:2:-1)=callsign(NMAX-1:1:-1)
|
|
||||||
ihash(1)=n10
|
|
||||||
callsign(1)=c13
|
|
||||||
else
|
|
||||||
do i=1,NMAX
|
|
||||||
if(ihash(i).eq.n10) then
|
|
||||||
c13=callsign(i)
|
c13=callsign(i)
|
||||||
go to 900
|
go to 900
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
endif
|
|
||||||
|
|
||||||
900 return
|
900 return
|
||||||
end subroutine hash10
|
end subroutine hash10
|
||||||
|
@ -1,34 +1,19 @@
|
|||||||
subroutine hash12(n12,c13,isave)
|
subroutine hash12(n12,c13)
|
||||||
|
|
||||||
parameter (NMAX=20)
|
parameter (MAXHASH=20)
|
||||||
character*13 c13,callsign(NMAX)
|
character*13 c13,callsign(MAXHASH)
|
||||||
integer ihash(NMAX)
|
integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH)
|
||||||
logical first
|
common/hashcom/ihash10,ihash12,ihash22,callsign
|
||||||
data first/.true./
|
save /hashcom/
|
||||||
save first,ihash,callsign
|
|
||||||
|
|
||||||
if(first) then
|
c13='<...>'
|
||||||
ihash=-1
|
do i=1,MAXHASH
|
||||||
callsign=' '
|
if(ihash12(i).eq.n12) then
|
||||||
first=.false.
|
|
||||||
endif
|
|
||||||
|
|
||||||
if(isave.ge.0) then
|
|
||||||
do i=1,NMAX
|
|
||||||
if(ihash(i).eq.n12) go to 900 !This one is already in the list
|
|
||||||
enddo
|
|
||||||
ihash(NMAX:2:-1)=ihash(NMAX-1:1:-1)
|
|
||||||
callsign(NMAX:2:-1)=callsign(NMAX-1:1:-1)
|
|
||||||
ihash(1)=n12
|
|
||||||
callsign(1)=c13
|
|
||||||
else
|
|
||||||
do i=1,NMAX
|
|
||||||
if(ihash(i).eq.n12) then
|
|
||||||
c13=callsign(i)
|
c13=callsign(i)
|
||||||
go to 900
|
go to 900
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
endif
|
|
||||||
|
|
||||||
900 return
|
900 return
|
||||||
end subroutine hash12
|
end subroutine hash12
|
||||||
|
@ -1,35 +1,18 @@
|
|||||||
subroutine hash22(n22,c13,isave)
|
subroutine hash22(n22,c13)
|
||||||
|
|
||||||
parameter (NMAX=22)
|
parameter (MAXHASH=20)
|
||||||
character*13 c13,callsign(NMAX)
|
character*13 c13,callsign(MAXHASH)
|
||||||
integer ihash(NMAX)
|
integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH)
|
||||||
logical first
|
common/hashcom/ihash10,ihash12,ihash22,callsign
|
||||||
data first/.true./
|
save /hashcom/
|
||||||
save first,ihash,callsign
|
|
||||||
|
|
||||||
if(first) then
|
|
||||||
ihash=-1
|
|
||||||
callsign=' '
|
|
||||||
first=.false.
|
|
||||||
endif
|
|
||||||
|
|
||||||
if(isave.ge.0) then
|
|
||||||
do i=1,NMAX
|
|
||||||
if(ihash(i).eq.n22) go to 900 !This one is already in the list
|
|
||||||
enddo
|
|
||||||
ihash(NMAX:2:-1)=ihash(NMAX-1:1:-1)
|
|
||||||
callsign(NMAX:2:-1)=callsign(NMAX-1:1:-1)
|
|
||||||
ihash(1)=n22
|
|
||||||
callsign(1)=c13
|
|
||||||
else
|
|
||||||
c13='<...>'
|
c13='<...>'
|
||||||
do i=1,NMAX
|
do i=1,MAXHASH
|
||||||
if(ihash(i).eq.n22) then
|
if(ihash22(i).eq.n22) then
|
||||||
c13=callsign(i)
|
c13=callsign(i)
|
||||||
go to 900
|
go to 900
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
endif
|
|
||||||
|
|
||||||
900 return
|
900 return
|
||||||
end subroutine hash22
|
end subroutine hash22
|
||||||
|
@ -78,8 +78,7 @@ subroutine pack28(c13,n28)
|
|||||||
endif
|
endif
|
||||||
! Check for <...> callsign
|
! Check for <...> callsign
|
||||||
if(c13(1:1).eq.'<')then
|
if(c13(1:1).eq.'<')then
|
||||||
n22=ihashcall(c13,22)
|
call save_hash_call(c13,n10,n12,n22) !Save callsign in hash table
|
||||||
call hash22(n22,c13,1) !Save (key,value) in hash table
|
|
||||||
n28=NTOKENS + n22
|
n28=NTOKENS + n22
|
||||||
go to 900
|
go to 900
|
||||||
endif
|
endif
|
||||||
@ -104,8 +103,7 @@ subroutine pack28(c13,n28)
|
|||||||
if(iarea.lt.2 .or. iarea.gt.3 .or. nplet.eq.0 .or. &
|
if(iarea.lt.2 .or. iarea.gt.3 .or. nplet.eq.0 .or. &
|
||||||
npdig.ge.iarea-1 .or. nslet.gt.3) then
|
npdig.ge.iarea-1 .or. nslet.gt.3) then
|
||||||
! Treat this as a nonstandard callsign: compute its 22-bit hash
|
! Treat this as a nonstandard callsign: compute its 22-bit hash
|
||||||
n22=ihashcall(c13,22)
|
call save_hash_call(c13,n10,n12,n22) !Save callsign in hash table
|
||||||
call hash22(n22,c13,1) !Save (key,value) in hash table
|
|
||||||
n28=NTOKENS + n22
|
n28=NTOKENS + n22
|
||||||
go to 900
|
go to 900
|
||||||
endif
|
endif
|
||||||
|
@ -3,11 +3,10 @@ subroutine pack77_01(nwords,w,i3,n3,c77)
|
|||||||
! Pack a Type 0.1 message: DXpedition mode
|
! Pack a Type 0.1 message: DXpedition mode
|
||||||
! Example message: "K1ABC RR73; W9XYZ <KH1/KH7Z> -11" 28 28 10 5
|
! Example message: "K1ABC RR73; W9XYZ <KH1/KH7Z> -11" 28 28 10 5
|
||||||
|
|
||||||
character*13 w(19),chash(20)
|
character*13 w(19)
|
||||||
character*77 c77
|
character*77 c77
|
||||||
character*6 bcall_1,bcall_2
|
character*6 bcall_1,bcall_2
|
||||||
logical ok1,ok2
|
logical ok1,ok2
|
||||||
common/hashcom/ihash10(20),chash
|
|
||||||
|
|
||||||
if(nwords.ne.5) go to 900 !Must have 5 words
|
if(nwords.ne.5) go to 900 !Must have 5 words
|
||||||
if(trim(w(2)).ne.'RR73;') go to 900 !2nd word must be "RR73;"
|
if(trim(w(2)).ne.'RR73;') go to 900 !2nd word must be "RR73;"
|
||||||
@ -29,8 +28,7 @@ subroutine pack77_01(nwords,w,i3,n3,c77)
|
|||||||
n3=1
|
n3=1
|
||||||
call pack28(w(1),n28a)
|
call pack28(w(1),n28a)
|
||||||
call pack28(w(3),n28b)
|
call pack28(w(3),n28b)
|
||||||
n10=ihashcall(w(4),10) !Get the 10-bit hash code
|
call save_hash_call(w(4),n10,n12,n22)
|
||||||
call hash10(n10,w(4),0) !Save this hash and its callsign
|
|
||||||
write(c77,1010) n28a,n28b,n10,n5,n3,i3
|
write(c77,1010) n28a,n28b,n10,n5,n3,i3
|
||||||
1010 format(2b28.28,b10.10,b5.5,2b3.3)
|
1010 format(2b28.28,b10.10,b5.5,2b3.3)
|
||||||
|
|
||||||
|
@ -30,19 +30,14 @@ subroutine pack77_4(nwords,w,i3,n3,c77)
|
|||||||
iflip=0
|
iflip=0
|
||||||
n12=0
|
n12=0
|
||||||
c11=adjustr(call_2(1:11))
|
c11=adjustr(call_2(1:11))
|
||||||
n10=ihashcall(w(2),10)
|
call save_hash_call(w(2),n10,n12,n22)
|
||||||
call hash10(n10,w(2),0) !Save this hash10 and its callsign
|
|
||||||
n12=ihashcall(w(2),12)
|
|
||||||
call hash12(n12,w(2),0) !Save this hash12 and its callsign
|
|
||||||
else if(w(1)(1:1).eq.'<') then
|
else if(w(1)(1:1).eq.'<') then
|
||||||
iflip=0
|
iflip=0
|
||||||
n12=ihashcall(w(1),12)
|
call save_hash_call(w(1),n10,n12,n22)
|
||||||
call hash12(n12,w(1),0) !Save this hash and its callsign
|
|
||||||
c11=adjustr(call_2(1:11))
|
c11=adjustr(call_2(1:11))
|
||||||
else if(w(2)(1:1).eq.'<') then
|
else if(w(2)(1:1).eq.'<') then
|
||||||
iflip=1
|
iflip=1
|
||||||
n12=ihashcall(w(2),12)
|
call save_hash_call(w(2),n10,n12,n22)
|
||||||
call hash12(n12,w(2),0) !Save this hash and its callsign
|
|
||||||
c11=adjustr(call_1(1:11))
|
c11=adjustr(call_1(1:11))
|
||||||
endif
|
endif
|
||||||
n58=0
|
n58=0
|
||||||
|
@ -2,6 +2,7 @@ include 'hash10.f90'
|
|||||||
include 'hash12.f90'
|
include 'hash12.f90'
|
||||||
include 'hash22.f90'
|
include 'hash22.f90'
|
||||||
include 'ihashcall.f90'
|
include 'ihashcall.f90'
|
||||||
|
include 'save_hash_call.f90'
|
||||||
include 'pack77.f90'
|
include 'pack77.f90'
|
||||||
include 'unpack77.f90'
|
include 'unpack77.f90'
|
||||||
include 'pack28.f90'
|
include 'pack28.f90'
|
||||||
|
39
lib/77bit/save_hash_call.f90
Normal file
39
lib/77bit/save_hash_call.f90
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
subroutine save_hash_call(c13,n10,n12,n22)
|
||||||
|
|
||||||
|
parameter (MAXHASH=20)
|
||||||
|
character*13 c13,callsign(MAXHASH)
|
||||||
|
integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH)
|
||||||
|
logical first
|
||||||
|
common/hashcom/ihash10,ihash12,ihash22,callsign
|
||||||
|
save first,/hashcom/
|
||||||
|
|
||||||
|
|
||||||
|
if(first) then
|
||||||
|
ihash10=-1
|
||||||
|
ihash12=-1
|
||||||
|
ihash22=-1
|
||||||
|
callsign=' '
|
||||||
|
first=.false.
|
||||||
|
endif
|
||||||
|
|
||||||
|
n10=ihashcall(c13,10)
|
||||||
|
n12=ihashcall(c13,12)
|
||||||
|
n22=ihashcall(c13,22)
|
||||||
|
do i=1,MAXHASH
|
||||||
|
if(ihash22(i).eq.n22) go to 900 !This one is already in the table
|
||||||
|
enddo
|
||||||
|
|
||||||
|
! New entry: move table down, making room for new one at the top
|
||||||
|
ihash10(MAXHASH:2:-1)=ihash10(MAXHASH-1:1:-1)
|
||||||
|
ihash12(MAXHASH:2:-1)=ihash12(MAXHASH-1:1:-1)
|
||||||
|
ihash22(MAXHASH:2:-1)=ihash22(MAXHASH-1:1:-1)
|
||||||
|
|
||||||
|
! Add the new entry
|
||||||
|
callsign(MAXHASH:2:-1)=callsign(MAXHASH-1:1:-1)
|
||||||
|
ihash10(1)=n10
|
||||||
|
ihash12(1)=n12
|
||||||
|
ihash22(1)=n22
|
||||||
|
callsign(1)=c13
|
||||||
|
|
||||||
|
900 return
|
||||||
|
end subroutine save_hash_call
|
@ -54,7 +54,7 @@ subroutine unpack77(c77,msg)
|
|||||||
if(irpt.ge.0) crpt(1:1)='+'
|
if(irpt.ge.0) crpt(1:1)='+'
|
||||||
call unpack28(n28a,call_1)
|
call unpack28(n28a,call_1)
|
||||||
call unpack28(n28b,call_2)
|
call unpack28(n28b,call_2)
|
||||||
call hash10(n10,call_3,-1)
|
call hash10(n10,call_3)
|
||||||
if(call_3(1:1).eq.'<') then
|
if(call_3(1:1).eq.'<') then
|
||||||
msg=trim(call_1)//' RR73; '//trim(call_2)//' '//trim(call_3)// &
|
msg=trim(call_1)//' RR73; '//trim(call_2)//' '//trim(call_3)// &
|
||||||
' '//crpt
|
' '//crpt
|
||||||
@ -213,7 +213,7 @@ subroutine unpack77(c77,msg)
|
|||||||
c11(i:i)=c(j:j)
|
c11(i:i)=c(j:j)
|
||||||
n58=n58/38
|
n58=n58/38
|
||||||
enddo
|
enddo
|
||||||
call hash12(n12,call_3,-1)
|
call hash12(n12,call_3)
|
||||||
if(iflip.eq.0) then
|
if(iflip.eq.0) then
|
||||||
call_1=call_3
|
call_1=call_3
|
||||||
call_2=adjustl(c11)//' '
|
call_2=adjustl(c11)//' '
|
||||||
|
Loading…
x
Reference in New Issue
Block a user