summaryrefslogtreecommitdiff
path: root/map65/libm65/run_m65.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/run_m65.f90
parentd83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff)
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to 'map65/libm65/run_m65.f90')
-rw-r--r--map65/libm65/run_m65.f9072
1 files changed, 31 insertions, 41 deletions
diff --git a/map65/libm65/run_m65.f90 b/map65/libm65/run_m65.f90
index e927e33e..cc0ffe73 100644
--- a/map65/libm65/run_m65.f90
+++ b/map65/libm65/run_m65.f90
@@ -9,11 +9,14 @@ subroutine run_m65(pol, sample_rate_96000) bind(C, name='run_m65_')
use timer_impl, only: init_timer, fini_timer
use debug_log
use m65a_mod
- use datcom_ptrs_mod, only: dd, ss, savg
- use npar_ptrs_mod, only: newdat, stop_m65, decoder_ready
+ use npar_ptrs_mod, only: t_start, nhsym, mycall, hiscall, hisgrid, neme, &
+ initialize_decode_parameters, claim_decode_request, get_stop_m65, &
+ active_request_id, active_request_expired
use stdout_channel_mod, only: write_stdout
use decodes_mod, only: nhsym1,nhsym2
+ use deep65_mod, only: build_call3_candidates
use sleep_msec_mod
+ use sec_midn_mod, only: sec_midn
implicit none
@@ -22,17 +25,13 @@ subroutine run_m65(pol, sample_rate_96000) bind(C, name='run_m65_')
! Local variables
integer :: sample_rate
character(len=128) :: line
-
- ! timestamp variables
- character(len=8) :: d
- character(len=10) :: t
- integer :: v(8)
- character(len=32) :: timestamp
+ integer :: t_rate
+ integer :: t_now
nhsym1=280
- nhsym2=302
-
- ! call ensure_log_open() !uncomment this to enable logging to file
+ nhsym2=302
+
+ dbg_enabled = .false. ! flip to .true. to enable dbg() logging to w3sz_debug.log
if (sample_rate_96000 /=0) then
sample_rate = 96000
@@ -71,39 +70,30 @@ subroutine run_m65(pol, sample_rate_96000) bind(C, name='run_m65_')
!print *, 'IN RUN_M65, initial stop_m65 =', stop_m65
!flush(6)
- !call date_and_time(d, t, values=v)
-
- !write(timestamp, '(I4.4,"-",I2.2,"-",I2.2," ",I2.2,":",I2.2,":",I2.2,".",I3.3)') &
- ! v(1), v(2), v(3), v(5), v(6), v(7), v(8)
-
- !print *, trim(timestamp), ' CALLING M65A'
-
-
call init_timer()
-
- !print *, 'IN RUN_M65, just passed init_timer'
- do while (stop_m65 == 0)
- if (decoder_ready /=0 .and. newdat /= 0) then
- ! call date_and_time(d, t, values=v)
-
- ! write(timestamp, '(I4.4,"-",I2.2,"-",I2.2," ",I2.2,":",I2.2,":",I2.2,".",I3.3)') &
- ! v(1), v(2), v(3), v(5), v(6), v(7), v(8)
-
- ! print *, trim(timestamp), ' CALLING M65A'
- call m65a()
- end if
-!print *, ' ENTERING SLEEP_MSEC'
-call sleep_msec(50)
-!print *, ' RETURNED FROM SLEEP_MSEC'
-!print *, ' LOOP: stop_m65 =', stop_m65, &
-! ' decoder_ready=', decoder_ready, &
-! ' newdat=', newdat
-
-! stop_m65 = .true.
+ call initialize_decode_parameters()
+
+ ! Encode the CALL3.TXT candidates before the first decode's time budget starts.
+ ! deep65 rebuilds them when calls, grids, the EME filter, or CALL3.TXT change.
+ call dbg('run_m65: eager build_call3_candidates() STARTING at t=' // rtoa(sec_midn()))
+ call build_call3_candidates(mycall, hiscall, hisgrid, neme)
+ call dbg('run_m65: eager build_call3_candidates() DONE at t=' // rtoa(sec_midn()))
+
+ do while (get_stop_m65() == 0)
+ if (claim_decode_request()) then
+ if (active_request_expired) then
+ write(line, '(A,1X,I0)') '<DecodeSkipped>', active_request_id
+ call write_stdout(trim(line)//new_line('a'))
+ else
+ call system_clock(t_start, t_rate)
+ call m65a()
+ call system_clock(t_now)
+ call dbg('run_m65: request completed, elapsed=' // rtoa(real(t_now - t_start)/real(t_rate)))
+ endif
+ endif
+ call sleep_msec(50)
end do
-! print *, 'RUN_M65 exiting main loop.'
-! flush (6)
call fini_timer()
close(21)