Fix a few more issues with hashed callsigns.

This commit is contained in:
Joe Taylor 2018-07-05 13:20:31 -04:00
parent 641db21672
commit 0462008e15
11 changed files with 94 additions and 110 deletions

View File

@ -2,4 +2,5 @@ gfortran -c ../packjt.f90
gfortran -o encode77 -fbounds-check -Wall -Wno-conversion -Wno-real-q-constant \
encode77.f90 ../deg2grid.f90 ../grid2deg.f90 ../fix_contest_msg.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

View File

@ -1,2 +1,2 @@
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

View File

@ -1,34 +1,18 @@
subroutine hash10(n10,c13,isave)
subroutine hash10(n10,c13)
parameter (NMAX=20)
character*13 c13,callsign(NMAX)
integer ihash(NMAX)
logical first
data first/.true./
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.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)
go to 900
endif
enddo
endif
parameter (MAXHASH=20)
character*13 c13,callsign(MAXHASH)
integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH)
common/hashcom/ihash10,ihash12,ihash22,callsign
save /hashcom/
c13='<...>'
do i=1,MAXHASH
if(ihash10(i).eq.n10) then
c13=callsign(i)
go to 900
endif
enddo
900 return
end subroutine hash10

View File

@ -1,34 +1,19 @@
subroutine hash12(n12,c13,isave)
subroutine hash12(n12,c13)
parameter (NMAX=20)
character*13 c13,callsign(NMAX)
integer ihash(NMAX)
logical first
data first/.true./
save first,ihash,callsign
parameter (MAXHASH=20)
character*13 c13,callsign(MAXHASH)
integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH)
common/hashcom/ihash10,ihash12,ihash22,callsign
save /hashcom/
c13='<...>'
do i=1,MAXHASH
if(ihash12(i).eq.n12) then
c13=callsign(i)
go to 900
endif
enddo
if(first) then
ihash=-1
callsign=' '
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)
go to 900
endif
enddo
endif
900 return
end subroutine hash12

View File

@ -1,35 +1,18 @@
subroutine hash22(n22,c13,isave)
subroutine hash22(n22,c13)
parameter (NMAX=22)
character*13 c13,callsign(NMAX)
integer ihash(NMAX)
logical first
data first/.true./
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='<...>'
do i=1,NMAX
if(ihash(i).eq.n22) then
c13=callsign(i)
go to 900
endif
enddo
endif
parameter (MAXHASH=20)
character*13 c13,callsign(MAXHASH)
integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH)
common/hashcom/ihash10,ihash12,ihash22,callsign
save /hashcom/
c13='<...>'
do i=1,MAXHASH
if(ihash22(i).eq.n22) then
c13=callsign(i)
go to 900
endif
enddo
900 return
end subroutine hash22

View File

@ -78,8 +78,7 @@ subroutine pack28(c13,n28)
endif
! Check for <...> callsign
if(c13(1:1).eq.'<')then
n22=ihashcall(c13,22)
call hash22(n22,c13,1) !Save (key,value) in hash table
call save_hash_call(c13,n10,n12,n22) !Save callsign in hash table
n28=NTOKENS + n22
go to 900
endif
@ -104,8 +103,7 @@ subroutine pack28(c13,n28)
if(iarea.lt.2 .or. iarea.gt.3 .or. nplet.eq.0 .or. &
npdig.ge.iarea-1 .or. nslet.gt.3) then
! Treat this as a nonstandard callsign: compute its 22-bit hash
n22=ihashcall(c13,22)
call hash22(n22,c13,1) !Save (key,value) in hash table
call save_hash_call(c13,n10,n12,n22) !Save callsign in hash table
n28=NTOKENS + n22
go to 900
endif

View File

@ -3,11 +3,10 @@ subroutine pack77_01(nwords,w,i3,n3,c77)
! Pack a Type 0.1 message: DXpedition mode
! 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*6 bcall_1,bcall_2
logical ok1,ok2
common/hashcom/ihash10(20),chash
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;"
@ -29,8 +28,7 @@ subroutine pack77_01(nwords,w,i3,n3,c77)
n3=1
call pack28(w(1),n28a)
call pack28(w(3),n28b)
n10=ihashcall(w(4),10) !Get the 10-bit hash code
call hash10(n10,w(4),0) !Save this hash and its callsign
call save_hash_call(w(4),n10,n12,n22)
write(c77,1010) n28a,n28b,n10,n5,n3,i3
1010 format(2b28.28,b10.10,b5.5,2b3.3)

View File

@ -30,19 +30,14 @@ subroutine pack77_4(nwords,w,i3,n3,c77)
iflip=0
n12=0
c11=adjustr(call_2(1:11))
n10=ihashcall(w(2),10)
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
call save_hash_call(w(2),n10,n12,n22)
else if(w(1)(1:1).eq.'<') then
iflip=0
n12=ihashcall(w(1),12)
call hash12(n12,w(1),0) !Save this hash and its callsign
call save_hash_call(w(1),n10,n12,n22)
c11=adjustr(call_2(1:11))
else if(w(2)(1:1).eq.'<') then
iflip=1
n12=ihashcall(w(2),12)
call hash12(n12,w(2),0) !Save this hash and its callsign
call save_hash_call(w(2),n10,n12,n22)
c11=adjustr(call_1(1:11))
endif
n58=0

View File

@ -2,6 +2,7 @@ include 'hash10.f90'
include 'hash12.f90'
include 'hash22.f90'
include 'ihashcall.f90'
include 'save_hash_call.f90'
include 'pack77.f90'
include 'unpack77.f90'
include 'pack28.f90'

View 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

View File

@ -54,7 +54,7 @@ subroutine unpack77(c77,msg)
if(irpt.ge.0) crpt(1:1)='+'
call unpack28(n28a,call_1)
call unpack28(n28b,call_2)
call hash10(n10,call_3,-1)
call hash10(n10,call_3)
if(call_3(1:1).eq.'<') then
msg=trim(call_1)//' RR73; '//trim(call_2)//' '//trim(call_3)// &
' '//crpt
@ -213,7 +213,7 @@ subroutine unpack77(c77,msg)
c11(i:i)=c(j:j)
n58=n58/38
enddo
call hash12(n12,call_3,-1)
call hash12(n12,call_3)
if(iflip.eq.0) then
call_1=call_3
call_2=adjustl(c11)//' '