Add ADDMOMIT keyword; bump version to 03.03.10

This commit is contained in:
Dianne Skoll
2021-11-18 15:13:12 -05:00
parent cb841adf86
commit 79289fe6c4
10 changed files with 499 additions and 449 deletions

2
configure vendored
View File

@@ -4032,7 +4032,7 @@ _ACEOF
fi
done
VERSION=03.03.09
VERSION=03.03.10
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile"

View File

@@ -76,7 +76,7 @@ if test "$GCC" = yes; then
fi
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
VERSION=03.03.09
VERSION=03.03.10
AC_SUBST(VERSION)
AC_SUBST(PERL)
AC_OUTPUT(src/Makefile www/Makefile src/version.h rem2html/Makefile)

View File

@@ -423,6 +423,7 @@ Its syntax is:
[\fBPRIORITY\fR \fIprio\fR]
[\fBSKIP\fR | \fBBEFORE\fR | \fBAFTER\fR]
[\fBOMIT\fR \fIomit_list\fR]
[\fBADDOMIT\fR]
[\fBOMITFUNC\fR \fIomit_function\fR]
[\fBAT\fR \fItime\fR [\fItdelta\fR] [\fItrepeat\fR]]
[\fBSCHED\fR \fIsched_function\fR]
@@ -991,6 +992,12 @@ omitted. For that reason, when \fBRemind\fR searches through omitted days,
it terminates the search after the \fBSATISFY\fR iteration limit
(command-line option \fB\-x\fR.)
.PP
.B ADDING TRIGGER DATES TO THE OMIT CONTEXT
.PP
If the \fBADDOMIT\fR keyword appears in a \fBREM\fR command, then
the trigger date (if one could be calculated) is automatically
added to the list of global OMITs.
.PP
.B TIMED REMINDERS
.PP
Timed reminders are those that have an \fBAT\fR keyword followed
@@ -4762,9 +4769,7 @@ in September. It can move over a range of 7 days. Consider the
following sequence:
.PP
.nf
REM Mon 1 Sept SCANFROM [today()\-7] SATISFY 1
OMIT [trigdate()]
REM Mon 1 Sept SCANFROM [today()\-7] ADDOMIT MSG Labour Day
REM Mon AFTER MSG Hello
.fi
.PP
@@ -4778,10 +4783,7 @@ a negative number \-N is interpreted as N days before today. Thus,
the previous example could also be written like this:
.PP
.nf
# This form of SCANFROM requires Remind 03.01.17 or later.
REM Mon 1 Sept SCANFROM \-7 SATISFY 1
OMIT [trigdate()]
REM Mon 1 Sept SCANFROM \-7 ADDOMIT MSG Labour Day
REM Mon AFTER MSG Hello
.fi
.PP

View File

@@ -141,6 +141,14 @@ int DoRem(ParsePtr p)
}
}
/* Add to global OMITs if so indicated */
if (trig.addomit) {
r = AddGlobalOmit(jul);
if (r) {
FreeTrig(&trig);
return r;
}
}
if (PurgeMode) {
if (trig.expired || jul < JulianToday) {
if (p->expr_happened) {
@@ -211,6 +219,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
trig->localomit = NO_WD;
trig->skip = NO_SKIP;
trig->once = NO_ONCE;
trig->addomit = 0;
trig->typ = NO_TYPE;
trig->scanfrom = NO_DATE;
trig->from = NO_DATE;
@@ -280,6 +289,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
break;
case T_MaybeUncomputable:
DBufFree(&buf);
trig->maybe_uncomputable = 1;
break;
@@ -374,6 +384,11 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
trig->once = ONCE_ONCE;
break;
case T_AddOmit:
DBufFree(&buf);
trig->addomit = 1;
break;
case T_Omit:
DBufFree(&buf);
if (trig->omitfunc[0]) {

View File

@@ -370,20 +370,30 @@ int DoOmit(ParsePtr p)
NumPartialOmits++;
}
} else {
if (NumFullOmits == MAX_FULL_OMITS) return E_2MANY_FULL;
if (d > DaysInMonth(m, y)) return E_BAD_DATE;
syndrome = Julian(y, m, d);
if (!BexistsIntArray(FullOmitArray, NumFullOmits, syndrome)) {
InsertIntoSortedArray(FullOmitArray, NumFullOmits, syndrome);
NumFullOmits++;
}
r = AddGlobalOmit(syndrome);
if (r) {
return r;
}
}
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
return OK;
}
int
AddGlobalOmit(int jul)
{
if (NumFullOmits == MAX_FULL_OMITS) return E_2MANY_FULL;
if (!BexistsIntArray(FullOmitArray, NumFullOmits, jul)) {
InsertIntoSortedArray(FullOmitArray, NumFullOmits, jul);
NumFullOmits++;
}
return OK;
}
static int
DoThroughOmit(ParsePtr p, int ystart, int mstart, int dstart)
{

View File

@@ -163,3 +163,4 @@ void PrintJSONKeyPairDateTime(char const *name, int dt);
void PrintJSONKeyPairTime(char const *name, int t);
void System(char const *cmd);
int ShellEscape(char const *in, DynamicBuffer *out);
int AddGlobalOmit(int jul);

View File

@@ -37,7 +37,7 @@ while (isdigit(*(string))) { \
Keep this array sorted, or software will not work. */
Token TokArray[] = {
/* NAME MINLEN TYPE VALUE */
{ "addomit", 7, T_AddOmit, 0 },
{ "after", 3, T_Skip, AFTER_SKIP },
{ "april", 3, T_Month, 3 },
{ "at", 2, T_At, 0 },

View File

@@ -74,6 +74,7 @@ typedef struct {
int eventstart; /* Original event start (datetime) */
int eventduration; /* Original event duration (minutes) */
int maybe_uncomputable; /* Suppress "can't compute trigger" warnings */
int addomit; /* Add trigger date to global OMITs */
char sched[VAR_NAME_LEN+1]; /* Scheduling function */
char warn[VAR_NAME_LEN+1]; /* Warning function */
char omitfunc[VAR_NAME_LEN+1]; /* OMITFUNC function */
@@ -153,6 +154,7 @@ enum TokTypes
T_Rem, T_Push, T_Pop, T_Preserve, T_Include, T_IncludeCmd, T_If, T_Else, T_EndIf,
T_IfTrig, T_ErrMsg,
T_Set, T_UnSet, T_Fset, T_Omit, T_Banner, T_Exit,
T_AddOmit,
T_WkDay,
T_Month, T_Time, T_Date, T_DateTime,
T_Skip, T_At, T_RemType, T_Until, T_Year, T_Day, T_Rep, T_Delta, T_Back,

File diff suppressed because it is too large Load Diff

View File

@@ -226,6 +226,13 @@ REM 1991/02/28@14:45 MSG Feb 28
REM Wed UNTIL 1991-01-01 MSG Expired
REM Wed SCANFROM 1991-02-26 MSG SCANFROM
CLEAR-OMIT-CONTEXT
# Test ADDOMIT
REM Mon 15 Feb ADDOMIT MSG Family Day
REM Feb 18 AFTER MSG Should trigger on Feb 19
OMIT DUMP
set a000 abs(1)
set a001 abs(-1)
set a002 asc("foo")