From cde0e5883efc028d6087d2ea408a207aa6d2f6e1 Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Mon, 20 Dec 2021 17:32:14 -0500 Subject: [PATCH] Rename "any" to "isany" --- man/remind.1 | 6 +++--- src/funcs.c | 8 ++++---- tests/test.cmp | 38 +++++++++++++++++++------------------- tests/test.rem | 20 ++++++++++---------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/man/remind.1 b/man/remind.1 index c70adf82..b4c88d60 100644 --- a/man/remind.1 +++ b/man/remind.1 @@ -2358,7 +2358,7 @@ $TimeSep and $DateTimeSep when formatting its output. For example: .PP .RE .TP -.B any(arg1 [,arg2, ..., argN]); +.B isany(arg1 [,arg2, ..., argN]); Returns 1 if the first argument \fIarg1\fR is equal to any of the subsequent arguments \fIarg2\fR through \fIargN\fR; returns 0 otherwise. Also returns 0 if called with only one argument. @@ -2369,7 +2369,7 @@ As an example, the following two expressions are equivalent: .nf (a == b) || (a == c) || (a == d) || (a == e) - any(a, b, c, d, e) + isany(a, b, c, d, e) .fi .RE .TP @@ -3753,7 +3753,7 @@ on the 15th of January, April, July, and October. You could make four separate reminders, or you could use: .PP .nf - REM 15 SATISFY [any($Tm, 1, 4, 7, 10)] MSG 15th Reminder! + REM 15 SATISFY [isany($Tm, 1, 4, 7, 10)] MSG 15th Reminder! .fi .PP This technique of using one \fBREM\fR command to calculate a trigger date diff --git a/src/funcs.c b/src/funcs.c index 7a3a96d5..dad02e07 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -58,7 +58,7 @@ static int FADusk (func_info *); static int FAbs (func_info *); static int FAccess (func_info *); static int FAmpm (func_info *); -static int FAny (func_info *); +static int FIsAny (func_info *); static int FArgs (func_info *); static int FAsc (func_info *); static int FBaseyr (func_info *); @@ -210,7 +210,6 @@ BuiltinFunc Func[] = { { "adawn", 0, 1, 0, FADawn}, { "adusk", 0, 1, 0, FADusk}, { "ampm", 1, 3, 1, FAmpm }, - { "any", 1, NO_MAX, 1, FAny }, { "args", 1, 1, 0, FArgs }, { "asc", 1, 1, 1, FAsc }, { "baseyr", 0, 0, 1, FBaseyr }, @@ -241,6 +240,7 @@ BuiltinFunc Func[] = { { "hour", 1, 1, 1, FHour }, { "iif", 1, NO_MAX, 1, FIif }, { "index", 2, 3, 1, FIndex }, + { "isany", 1, NO_MAX, 1, FIsAny }, { "isdst", 0, 2, 0, FIsdst }, { "isleap", 1, 1, 1, FIsleap }, { "isomitted", 1, 1, 0, FIsomitted }, @@ -1037,12 +1037,12 @@ static int FPlural(func_info *info) /***************************************************************/ /* */ -/* FAny */ +/* FIsAny */ /* Return 1 if the first arg equals any subsequent arg, 0 */ /* otherwise. */ /* */ /***************************************************************/ -static int FAny(func_info *info) +static int FIsAny(func_info *info) { int i; RetVal.type = INT_TYPE; diff --git a/tests/test.cmp b/tests/test.cmp index a45ec722..2685c64a 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -3268,25 +3268,25 @@ $IntMin => -2147483648 abs(-2147483648) => Number too high ../tests/test.rem(594): Number too high -# The "any" function -set a any(1) -any(1) => 0 -set a any("foo") -any("foo") => 0 -set a any(1:00) -any(01:00) => 0 -set a any(1, 2) -any(1, 2) => 0 -set a any("foo", 2) -any("foo", 2) => 0 -set a any(1:00, 2) -any(01:00, 2) => 0 -set a any(1, 2, 1, 3) -any(1, 2, 1, 3) => 1 -set a any("foo", 2, 3, "foo") -any("foo", 2, 3, "foo") => 1 -set a any(1:00, 2, "foo", 2:00, 1:00, 9:00) -any(01:00, 2, "foo", 02:00, 01:00, 09:00) => 1 +# The "isany" function +set a isany(1) +isany(1) => 0 +set a isany("foo") +isany("foo") => 0 +set a isany(1:00) +isany(01:00) => 0 +set a isany(1, 2) +isany(1, 2) => 0 +set a isany("foo", 2) +isany("foo", 2) => 0 +set a isany(1:00, 2) +isany(01:00, 2) => 0 +set a isany(1, 2, 1, 3) +isany(1, 2, 1, 3) => 1 +set a isany("foo", 2, 3, "foo") +isany("foo", 2, 3, "foo") => 1 +set a isany(1:00, 2, "foo", 2:00, 1:00, 9:00) +isany(01:00, 2, "foo", 02:00, 01:00, 09:00) => 1 # Shellescape set a shellescape(" !\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~") diff --git a/tests/test.rem b/tests/test.rem index 360a1e97..9b7ea0cb 100644 --- a/tests/test.rem +++ b/tests/test.rem @@ -593,16 +593,16 @@ set a $IntMin * (-1) set a (-1) * $IntMin set a abs($IntMin) -# The "any" function -set a any(1) -set a any("foo") -set a any(1:00) -set a any(1, 2) -set a any("foo", 2) -set a any(1:00, 2) -set a any(1, 2, 1, 3) -set a any("foo", 2, 3, "foo") -set a any(1:00, 2, "foo", 2:00, 1:00, 9:00) +# The "isany" function +set a isany(1) +set a isany("foo") +set a isany(1:00) +set a isany(1, 2) +set a isany("foo", 2) +set a isany(1:00, 2) +set a isany(1, 2, 1, 3) +set a isany("foo", 2, 3, "foo") +set a isany(1:00, 2, "foo", 2:00, 1:00, 9:00) # Shellescape set a shellescape(" !\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~")