Fix bug that didn't save trigger date for a fully-specified REM in the past.

This commit is contained in:
Dianne Skoll
2025-06-30 19:23:45 -04:00
parent 4fd62f9894
commit 0f83b98698
4 changed files with 13 additions and 3 deletions

View File

@@ -1994,9 +1994,11 @@ SaveAllTriggerInfo(Trigger const *t, TimeTrig const *tt, int trigdate, int trigt
{
SaveLastTrigger(t);
SaveLastTimeTrig(tt);
LastTriggerDate = trigdate;
if (trigdate != -1) {
LastTriggerDate = trigdate;
LastTrigValid = valid;
}
LastTriggerTime = trigtime;
LastTrigValid = valid;
}
void

View File

@@ -541,6 +541,7 @@ int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
trig->expired = 0;
if (save_in_globals) {
LastTrigValid = 0;
LastTriggerDate = -1;
}
/* Assume everything works */
@@ -579,7 +580,6 @@ int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
while (nattempts++ < TRIG_ATTEMPTS) {
result = GetNextTriggerDate(trig, start, err, &nextstart);
/* If there's an error, die immediately */
if (*err) return -1;
if (result == -1) {

View File

@@ -16577,6 +16577,7 @@ Base: 1991-02-09
Base: 1991-02-09
../tests/test.rem(1611): Expired
../tests/test.rem(1612): Expired
trigvalid = 1; trigdate = 1991-01-14
Variable hash table statistics:
Entries: 100143; Buckets: 87719; Non-empty Buckets: 66301
Maxlen: 5; Minlen: 0; Avglen: 1.142; Stddev: 0.878; Avg nonempty len: 1.510

View File

@@ -1612,6 +1612,13 @@ REM SECOND SATURDAY +300 UNTIL 1991-02-02 MSG [$T]
REM SECOND SATURDAY +300 UNTIL 1991-02-16 MSG [$T]
DEBUG -t
# Fully-specified trigger date in the past
REM 14 Jan 1991 MSG In the past
set a trigvalid()
set b trigdate()
REM MSG trigvalid = [a]; trigdate = [b]
# Output expression-node stats
DEBUG +h