summaryrefslogtreecommitdiff
path: root/map65/libm65/getpfx1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'map65/libm65/getpfx1.f90')
-rw-r--r--map65/libm65/getpfx1.f9052
1 files changed, 36 insertions, 16 deletions
diff --git a/map65/libm65/getpfx1.f90 b/map65/libm65/getpfx1.f90
index 40fcc369..ba7faa37 100644
--- a/map65/libm65/getpfx1.f90
+++ b/map65/libm65/getpfx1.f90
@@ -1,19 +1,34 @@
-subroutine getpfx1(callsign,k,nv2)
+module getpfx1_mod
+ implicit none
+contains
- character*12 callsign0,callsign,lof,rof
- character*8 c
- character addpfx*8,tpfx*4,tsfx*3
- logical ispfx,issfx,invalid
- common/pfxcom/addpfx
- include 'pfx.f90'
+subroutine getpfx1(callsign, k, nv2)
- callsign0=callsign
- nv2=0
- iz=index(callsign,' ') - 1
- if(iz.lt.0) iz=12
- islash=index(callsign(1:iz),'/')
- k=0
- c=' '
+ use pfx_data_mod
+ use pfx_mod
+ use nchar_mod
+ use k2grid_mod
+
+ implicit none
+
+ character(len=12), intent(inout) :: callsign
+ integer, intent(out) :: k, nv2
+
+ character(len=12) :: callsign0, lof, rof
+ character(len=8) :: c
+ character(len=4) :: tpfx
+ character(len=3) :: tsfx
+ logical :: ispfx, issfx, invalid
+ integer :: i, islash, iz, llof, lrof
+
+ callsign0 = callsign
+ nv2 = 1
+ iz = index(callsign,' ') - 1
+ if (iz < 0) iz = 12
+ islash = index(callsign(1:iz),'/')
+ k = 0
+ c = ' '
+
if(islash.gt.0 .and. islash.le.(iz-4)) then
! Add-on prefix
c=callsign(1:islash-1)
@@ -21,11 +36,13 @@ subroutine getpfx1(callsign,k,nv2)
do i=1,NZ
if(pfx(i)(1:4).eq.c) then
k=i
+ nv2=2
go to 10
endif
enddo
if(addpfx.eq.c) then
k=449
+ nv2=2
go to 10
endif
@@ -36,6 +53,7 @@ subroutine getpfx1(callsign,k,nv2)
do i=1,NZ2
if(sfx(i).eq.c(1:1)) then
k=400+i
+ nv2=3
go to 10
endif
enddo
@@ -45,6 +63,7 @@ subroutine getpfx1(callsign,k,nv2)
! Original JT65 would force this compound callsign to be treated as
! plain text. In JT65v2, we will encode the prefix or suffix into nc1.
! The task here is to compute the proper value of k.
+! TODO: Reject invalid compound characters before nchar can stop MAP65.
lof=callsign0(:islash-1)
rof=callsign0(islash+1:)
llof=len_trim(lof)
@@ -74,7 +93,7 @@ subroutine getpfx1(callsign,k,nv2)
k=37*k + nchar(tpfx(2:2))
k=37*k + nchar(tpfx(3:3))
k=37*k + nchar(tpfx(4:4))
- nv2=1
+ nv2=4
i=index(callsign0,'/')
callsign=callsign0(:i-1)
callsign=callsign0(i+1:)
@@ -84,7 +103,7 @@ subroutine getpfx1(callsign,k,nv2)
k=nchar(tsfx(1:1))
k=37*k + nchar(tsfx(2:2))
k=37*k + nchar(tsfx(3:3))
- nv2=2
+ nv2=5
i=index(callsign0,'/')
callsign=callsign0(:i-1)
endif
@@ -93,4 +112,5 @@ subroutine getpfx1(callsign,k,nv2)
return
end subroutine getpfx1
+end module getpfx1_mod