summaryrefslogtreecommitdiff
path: root/map65/libm65/display.f90
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
commit059831534c7e884f0a607ed86b582fd00d821731 (patch)
tree76bcb67a78f8aa2654fd34c2ad801a62136b0170 /map65/libm65/display.f90
parentd83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff)
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to 'map65/libm65/display.f90')
-rw-r--r--map65/libm65/display.f9043
1 files changed, 39 insertions, 4 deletions
diff --git a/map65/libm65/display.f90 b/map65/libm65/display.f90
index a7f71175..901313c8 100644
--- a/map65/libm65/display.f90
+++ b/map65/libm65/display.f90
@@ -6,6 +6,8 @@ subroutine display(nkeep, ftol)
use stdout_channel_mod, only: write_stdout
use iso_fortran_env, only: real64
use indexx_mod, only: indexx
+ use debug_log, only: dbg, itoa, rtoa
+ use sec_midn_mod, only: sec_midn
implicit none
! Arguments
@@ -27,7 +29,7 @@ subroutine display(nkeep, ftol)
! Hz offset within kHz) alongside cfreq0 in the "&" bandmap line.
! The C++ overlay handler (mainwindow.cpp processStdOut) reads
! both fields and places the tick at nkHz + ndf/1000 instead of
- ! integer kHz, which was up to ±500 Hz off on signals with
+ ! integer kHz, which was up to �500 Hz off on signals with
! non-zero ndf.
character(len=18) :: freqcall(MAXCALLS)
@@ -51,6 +53,12 @@ subroutine display(nkeep, ftol)
callsign0 = ' '
freqcall = ' '
+ ! TEMP diagnostic 2026-09-10 for the "decode reaches map65_rx.log but not
+ ! the Messages window" investigation -- this is the entry point for the
+ ! ENTIRE "@"/"&" (Messages/Band Map window) pipeline; nothing gets to
+ ! those windows except through here.
+ call dbg('display: ENTRY at t=' // rtoa(sec_midn()) // ' nkeep=' // itoa(nkeep))
+
!------------------ Read and filter valid lines ---------------------
rewind(26)
nz = 0
@@ -66,12 +74,16 @@ subroutine display(nkeep, ftol)
utc(i) = 60*nh + nm
freqkHz(i) = 1000.d0*(f0 - 144.d0) + 0.001d0*ndf
enddo
-
+
10 backspace(26)
nz = i -1
- utcz = utc(nz)
+ call dbg('display: read from unit 26, raw record count nz=' // itoa(nz))
+ if (nz >= 1) utcz = utc(nz)
nz=nz-1
- if (nz < 1) return
+ if (nz < 1) then
+ call dbg('display: EARLY RETURN, nz<1 after decrement -- no records to emit')
+ return
+ endif
nquad = max(nkeep/4, 3)
do i = 1, nz
nage = utcz - utc(i)
@@ -101,6 +113,18 @@ subroutine display(nkeep, ftol)
write(26,1022) line(i)
1022 format(a83)
enddo
+ ! Rewriting fewer records than the file previously held does not
+ ! shrink it -- the old, longer tail stays on disk past this point.
+ ! Without truncating here, a later rewind+read pass reads straight
+ ! through into that stale leftover data and resurrects entries this
+ ! trim was supposed to drop for good, causing unbounded growth of
+ ! the Messages window over a long session regardless of nkeep.
+ ! endfile leaves the file positioned after the EOF marker it just
+ ! wrote, and Fortran forbids further sequential I/O from there
+ ! without repositioning first -- backspace moves back onto that
+ ! marker so the next append (map65a.f90/q65b.F90) can write there.
+ endfile(26)
+ backspace(26)
endif
flush(26)
@@ -167,6 +191,7 @@ subroutine display(nkeep, ftol)
cfreq0=' '
nc = 0
callsign0=' '
+ call dbg('display: about to walk k3=' // itoa(k3) // ' sorted records for "@" emission')
do k = 1, k3
out = line3(k)(1:13)//line3(k)(28:31)//line3(k)(39:45)// &
line3(k)(35:38)//line3(k)(46:80)
@@ -180,7 +205,14 @@ subroutine display(nkeep, ftol)
livecq3 = out(1:61)//' '//livecq2(23:27)//' '//livecq2(79:83)
write(linenew,'("@",A)') trim(livecq3)
call write_stdout(trim(linenew)//new_line('a'))
+ call dbg('display: k=' // itoa(k) // ' "@" EMITTED freq=' // out(6:8) // &
+ ' utc=' // out(19:22) // ' msg="' // trim(out(31:55)) // '"')
out0 = out
+ else
+ call dbg('display: k=' // itoa(k) // ' "@" SUPPRESSED (matches out0) freq=' // out(6:8) // &
+ ' utc=' // out(19:22) // ' msg="' // trim(out(31:55)) // &
+ '" -- out0 was freq=' // out0(6:8) // ' utc=' // out0(19:22) // &
+ ' msg="' // trim(out0(31:55)) // '"')
endif
i1 = index(out(31:), ' ')
@@ -201,8 +233,11 @@ subroutine display(nkeep, ftol)
freqcall(nc) = cfreq0//line3(k)(9:13)//' '//callsign//line3(k)(79:80)
endif
endif
+ else
+ call dbg('display: k=' // itoa(k) // ' SKIPPED entirely (out(6:8) blank -- not a frequency record)')
endif
enddo
+ call dbg('display: done, nc(bandmap entries)=' // itoa(nc))
if(nc.lt.MAXCALLS) nc=nc+1
freqcall(nc)=' '