summaryrefslogtreecommitdiff
path: root/lib/77bit/hash22calc.f90
diff options
context:
space:
mode:
authortony mancill <tmancill@debian.org>2023-09-03 19:46:43 -0700
committertony mancill <tmancill@debian.org>2023-09-03 19:46:43 -0700
commit393a486ee1d7e308a49f8e0b8c3a4b2f43223248 (patch)
tree6a6e8a56ace360795e1cf1a310d5652bb23f1386 /lib/77bit/hash22calc.f90
parent6a285ab382ebff18c88e52bec75dc1773ac33b74 (diff)
New upstream version 2.7.0~rc2+repackupstream/2.7.0_rc2+repack
Diffstat (limited to 'lib/77bit/hash22calc.f90')
-rwxr-xr-xlib/77bit/hash22calc.f9042
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/77bit/hash22calc.f90 b/lib/77bit/hash22calc.f90
new file mode 100755
index 00000000..46581a98
--- /dev/null
+++ b/lib/77bit/hash22calc.f90
@@ -0,0 +1,42 @@
+program hash22calc
+! Given a valid callsign, calculate and print its 22-bit hash.
+
+ use packjt77
+
+ character*13 callsign
+ character*1 c
+ character*6 basecall
+ logical cok
+
+ nargs=iargc()
+ if(nargs.ne.1) then
+ print*,'Given a valid callsign, print its 22-bit hash.'
+ print*,'Usage: hash22calc <callsign>'
+ print*,' e.g. hash22calc W9ABC'
+ go to 999
+ endif
+ call getarg(1,callsign)
+
+! convert to upper case
+ ilen=len(trim(callsign))
+ do i=1, ilen
+ c=callsign(i:i)
+ if(c.ge.'a' .and. c.le.'z') c=char(ichar(c)-32) !Force upper case
+ callsign(i:i)=c
+ enddo
+
+! check for a valid callsign
+ call chkcall(callsign,basecall,cok)
+ if(.not.cok) then
+ print*,'Invalid callsign'
+ print*,'Usage: hash22calc <callsign>'
+ goto 999
+ endif
+
+! calculate the hash
+ n22 = ihashcall(callsign,22)
+ write(*,'(a,i7.7)') callsign,n22
+
+999 end program hash22calc
+
+include '../chkcall.f90'