mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-08-04 15:12:25 -04:00
New command-line program hash22calc will print the 22-bit hash value of a valid callsign.
This commit is contained in:
parent
f79e52a655
commit
53bf3f4de1
40
lib/77bit/hash22calc.f90
Normal file
40
lib/77bit/hash22calc.f90
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
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: hashcalc <callsign>'
|
||||||
|
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'
|
||||||
|
goto 999
|
||||||
|
endif
|
||||||
|
|
||||||
|
! calculate the hash
|
||||||
|
n22 = ihashcall(callsign,22)
|
||||||
|
write(*,'(a,i7.7)') callsign,n22
|
||||||
|
|
||||||
|
999 end program hash22calc
|
||||||
|
|
||||||
|
include '../chkcall.f90'
|
Loading…
x
Reference in New Issue
Block a user