From 4d013fef1b5ec2bc28bf049d53f7632721a2680b Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 20 Sep 2018 14:02:49 -0400 Subject: [PATCH 1/2] Minor corrections and code cleanup in packjt77.f90. --- lib/77bit/packjt77.f90 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90 index 7204f668b..f59c7e466 100644 --- a/lib/77bit/packjt77.f90 +++ b/lib/77bit/packjt77.f90 @@ -1,7 +1,7 @@ module packjt77 ! These variables are accessible from outside via "use packjt": - parameter (MAXHASH=100) + parameter (MAXHASH=1000) character*13 callsign(MAXHASH) integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH) integer n28a,n28b,nzhash @@ -92,8 +92,9 @@ subroutine save_hash_call(c13,n10,n12,n22) character*13 c13 logical first + data first/.true./ save first - + if(first) then ihash10=-1 ihash12=-1 @@ -102,6 +103,7 @@ subroutine save_hash_call(c13,n10,n12,n22) nzhash=0 first=.false. endif + if(c13(1:1).eq.' ' .or. c13(1:5).eq.'<...>') return n10=ihashcall(c13,10) @@ -466,7 +468,6 @@ subroutine pack28(c13,n28) ! integer. parameter (NTOKENS=2063592,MAX22=4194304) - integer nc(6) logical is_digit,is_letter character*13 c13 character*6 callsign @@ -480,7 +481,6 @@ subroutine pack28(c13,n28) data a2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ data a3/'0123456789'/ data a4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ - data nc/37,36,19,27,27,27/ is_digit(c)=c.ge.'0' .and. c.le.'9' is_letter(c)=c.ge.'A' .and. c.le.'Z' @@ -586,7 +586,7 @@ subroutine pack28(c13,n28) 27*i5 + i6 n28=n28 + NTOKENS + MAX22 -900 n28=iand(n28,2**28-1) +900 n28=iand(n28,ishft(1,28)-1) return end subroutine pack28 @@ -594,7 +594,6 @@ end subroutine pack28 subroutine unpack28(n28_0,c13,success) parameter (NTOKENS=2063592,MAX22=4194304) - integer nc(6) logical success character*13 c13 character*37 c1 @@ -605,7 +604,6 @@ subroutine unpack28(n28_0,c13,success) data c2/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ data c3/'0123456789'/ data c4/' ABCDEFGHIJKLMNOPQRSTUVWXYZ'/ - data nc/37,36,19,27,27,27/ success=.true. n28=n28_0 @@ -833,7 +831,7 @@ subroutine pack77_03(nwords,w,i3,n3,c77) if(.not.ok1 .or. .not.ok2) return isec=-1 do i=1,NSEC - if(csec(i).eq.w(nwords)) then + if(csec(i).eq.w(nwords)(1:3)) then isec=i exit endif From b6fb6e3dd9d66871273fe19f3d42e0bbc956a907 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 20 Sep 2018 14:04:48 -0400 Subject: [PATCH 2/2] Simplify stdmsg.f90. (Will it still be OK for the 72-bit modes?) --- lib/stdmsg.f90 | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/lib/stdmsg.f90 b/lib/stdmsg.f90 index f61935622..fec6c3396 100644 --- a/lib/stdmsg.f90 +++ b/lib/stdmsg.f90 @@ -2,15 +2,6 @@ function stdmsg(msg0) ! Returns .true. if msg0 a standard "JT-style" message - ! itype - ! 1 Standard 72-bit structured message - ! 2 Type 1 prefix - ! 3 Type 1 suffix - ! 4 Type 2 prefix - ! 5 Type 2 suffix - ! 6 Free text - ! 7 Hashed calls (MSK144 short format) - ! i3.n3 ! 0.0 Free text ! 0.1 DXpeditiion mode @@ -27,23 +18,26 @@ function stdmsg(msg0) use iso_c_binding, only: c_bool use packjt - character*37 msg0,msg1,msg - integer dat(12) + use packjt77 + + character*37 msg0,msg1 + character*77 c77 logical(c_bool) :: stdmsg msg1=msg0 - i0=index(msg1,' OOO ') - if(i0.gt.10) msg1=msg0(1:i0) - call packmsg(msg0,dat,itype) - call unpackmsg(dat,msg) - msg(23:37)=' ' - stdmsg=(msg(1:22).eq.msg1(1:22)) .and. (itype.ge.0) .and. (itype.ne.6) - if(.not.stdmsg) then - i0=index(msg1,' ') - msg1(i0:)=' ' - call parse77(msg1,i3,n3) - if(i3.gt.0 .or. n3.gt.0) stdmsg=.true. - endif + i3=-1 + n3=-1 + call pack77(msg1,i3,n3,c77) + stdmsg=(i3.gt.0 .or. n3.gt.0) +!### +! rewind 82 +! do i=1,nzhash +! write(82,3082) i,nzhash,callsign(i) +!3082 format(2i5,2x,a13) +! enddo +! flush(82) +!### + return end function stdmsg