diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /map65/libm65/fmtmsg.f90 | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'map65/libm65/fmtmsg.f90')
| -rw-r--r-- | map65/libm65/fmtmsg.f90 | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/map65/libm65/fmtmsg.f90 b/map65/libm65/fmtmsg.f90 index 2ceb8155..8e583f55 100644 --- a/map65/libm65/fmtmsg.f90 +++ b/map65/libm65/fmtmsg.f90 @@ -1,21 +1,42 @@ -subroutine fmtmsg(msg,iz) +module fmtmsg_mod + implicit none +contains - character*22 msg +subroutine fmtmsg(msg, iz) + implicit none -! Convert all letters to upper case - iz=22 - do i=1,22 - if(msg(i:i).ge.'a' .and. msg(i:i).le.'z') & - msg(i:i)= char(ichar(msg(i:i))+ichar('A')-ichar('a')) - if(msg(i:i).ne.' ') iz=i - enddo + !-------------------------------------------------------------------- + ! Arguments + !-------------------------------------------------------------------- + character(len=22), intent(inout) :: msg + integer, intent(out) :: iz - do iter=1,5 !Collapse multiple blanks into one - ib2=index(msg(1:iz),' ') - if(ib2.lt.1) go to 100 - msg=msg(1:ib2)//msg(ib2+2:) - iz=iz-1 - enddo + !-------------------------------------------------------------------- + ! Locals + !-------------------------------------------------------------------- + integer :: i, iter, ib2 + + !-------------------------------------------------------------------- + ! Convert all letters to upper case and track last nonblank + !-------------------------------------------------------------------- + iz = 22 + do i = 1, 22 + if (msg(i:i) >= 'a' .and. msg(i:i) <= 'z') then + msg(i:i) = char(ichar(msg(i:i)) + ichar('A') - ichar('a')) + end if + if (msg(i:i) /= ' ') iz = i + end do + + !-------------------------------------------------------------------- + ! Collapse multiple blanks into one (up to 5 passes) + !-------------------------------------------------------------------- + do iter = 1, 5 + ib2 = index(msg(1:iz), ' ') + if (ib2 < 1) exit + msg = msg(1:ib2) // msg(ib2+2:) + iz = iz - 1 + end do -100 return end subroutine fmtmsg + +end module fmtmsg_mod |
