Make "Hush Mode" suppress all purge-mode diagnostics.

We only get the "#!P: Expired" lines in that case.
This commit is contained in:
Dianne Skoll
2025-05-21 11:15:56 -04:00
parent 1e3657b728
commit 5d822e294d
3 changed files with 35 additions and 10 deletions

View File

@@ -214,12 +214,17 @@ int DoRem(ParsePtr p)
}
if (trig.typ == NO_TYPE) {
PurgeEchoLine("%s\n%s\n", "#!P! Cannot parse next line", CurLine);
if (!Hush) {
PurgeEchoLine("%s\n", "#!P! Cannot parse next line");
}
PurgeEchoLine("%s\n", CurLine);
FreeTrig(&trig);
return E_EOLN;
}
if (trig.typ == SAT_TYPE) {
PurgeEchoLine("%s\n", "#!P: Cannot purge SATISFY-type reminders");
if (!Hush) {
PurgeEchoLine("%s\n", "#!P: Cannot purge SATISFY-type reminders");
}
PurgeEchoLine("%s\n", CurLine);
r=DoSatRemind(&trig, &tim, p);
if (r) {
@@ -284,7 +289,9 @@ int DoRem(ParsePtr p)
dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
if (r) {
if (PurgeMode) {
PurgeEchoLine("%s: %s\n", "#!P! Problem calculating trigger date", GetErr(r));
if (!Hush) {
PurgeEchoLine("%s: %s\n", "#!P! Problem calculating trigger date", GetErr(r));
}
PurgeEchoLine("%s\n", CurLine);
}
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
@@ -307,11 +314,15 @@ int DoRem(ParsePtr p)
if (trig.expired || dse < DSEToday) {
if (p->expr_happened) {
if (p->nonconst_expr) {
PurgeEchoLine("%s\n", "#!P: Next line may have expired, but contains non-constant expression");
PurgeEchoLine("%s\n", "#!P: or a relative SCANFROM clause");
if (!Hush) {
PurgeEchoLine("%s\n", "#!P: Next line may have expired, but contains non-constant expression");
PurgeEchoLine("%s\n", "#!P: or a relative SCANFROM clause");
}
PurgeEchoLine("%s\n", CurLine);
} else {
PurgeEchoLine("%s\n", "#!P: Next line has expired, but contains expression... please verify");
if (!Hush) {
PurgeEchoLine("%s\n", "#!P: Next line has expired, but contains expression... please verify");
}
PurgeEchoLine("#!P: Expired: %s\n", CurLine);
}
} else {

View File

@@ -392,7 +392,9 @@ static void DoReminders(void)
PurgeEchoLine("%s\n", CurLine);
} else {
if (r) {
PurgeEchoLine("#!P! Could not parse next line: %s\n", GetErr(r));
if (!Hush) {
PurgeEchoLine("#!P! Could not parse next line: %s\n", GetErr(r));
}
PurgeEchoLine("%s\n", CurLine);
}
}
@@ -1145,7 +1147,7 @@ int DoIf(ParsePtr p)
push_if(1, !p->nonconst_expr);
} else {
push_if(0, !p->nonconst_expr);
if (PurgeMode) {
if (PurgeMode && !Hush) {
PurgeEchoLine("%s\n", "#!P: The next IF evaluated false...");
PurgeEchoLine("%s\n", "#!P: REM statements in IF block not checked for purging.");
}
@@ -1165,7 +1167,7 @@ int DoElse(ParsePtr p)
int was_ignoring = should_ignore_line();
int r = encounter_else();
if (PurgeMode && should_ignore_line() && !was_ignoring) {
if (PurgeMode && should_ignore_line() && !was_ignoring && !Hush) {
PurgeEchoLine("%s\n", "#!P: The previous IF evaluated true.");
PurgeEchoLine("%s\n", "#!P: REM statements in ELSE block not checked for purging");
}
@@ -1227,7 +1229,7 @@ int DoIfTrig(ParsePtr p)
push_if(1, 0);
} else {
push_if(0, 0);
if (PurgeMode) {
if (PurgeMode && !Hush) {
PurgeEchoLine("%s\n", "#!P: The next IFTRIG did not trigger.");
PurgeEchoLine("%s\n", "#!P: REM statements in IFTRIG block not checked for purging.");
}

View File

@@ -148,6 +148,18 @@ echo "F3" >> ../tests/test.out
cat ../tests/purge_dir/f3.rem.purged >> ../tests/test.out
rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
echo "Hush Purge Test" >> ../tests/test.out
../src/remind -h -j999 ../tests/purge_dir/f1.rem 3 Feb 2012 >> ../tests/test.out 2>&1
echo "F1" >> ../tests/test.out
cat ../tests/purge_dir/f1.rem.purged >> ../tests/test.out
echo "F2" >> ../tests/test.out
cat ../tests/purge_dir/f2.rem.purged >> ../tests/test.out
echo "F3" >> ../tests/test.out
cat ../tests/purge_dir/f3.rem.purged >> ../tests/test.out
rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
../src/remind ../tests/runtest.rem >> ../tests/test.out 2>&1
../src/remind -p ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1