From 0f4326726afb5ebf63c4452fa7d73e90d52b10f8 Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Sat, 27 Dec 2025 15:44:21 -0500 Subject: [PATCH] Allow alternate transliterations of Hebrew months. --- man/remind.1.in | 21 ++++++++++++++++++++ src/hbcal.c | 38 ++++++++++++++++++++++++++++++++++++- tests/manpage-personal-dict | 1 + tests/test.cmp | 31 +++++++++++++++++++++++------- tests/test.rem | 17 +++++++++++++++++ 5 files changed, 100 insertions(+), 8 deletions(-) diff --git a/man/remind.1.in b/man/remind.1.in index b62c81d8..c1517341 100644 --- a/man/remind.1.in +++ b/man/remind.1.in @@ -6932,6 +6932,27 @@ namely: .PP תשרי, חשוון, כסלו, טבת, שבט, אדר, ניסן, אייר, סיוון, תמוז, אב, אלול. .PP +\fBRemind\fR also permits the following alternative spellings for +Hebrew month names: +.TP +.B Tishrey +Can also be spelled Tishri or Tishrey +.TP +.B Heshvan +Can also be spelled Cheshvan or Kheshvan +.TP +.B Shvat +Can also be spelled Shevat +.TP +.B Tamuz +Can also be spelled Tammuz +.TP +.B Adar A +Can also be spelled Adar 1, Adar I, אדר א or אדר 1. +.TP +.B Adar B +Can also be spelled Adar 2, Adar II, אדר ב or אדר 2. +.PP In a cycle of 19 years, there are 7 leap years, being years 3, 6, 8, 11, 14, 17 and 19 of the cycle. In a leap year, an extra month of 30 days is added before Adar. The two Adars are called Adar A and Adar B, diff --git a/src/hbcal.c b/src/hbcal.c index e81cf7a5..13912755 100644 --- a/src/hbcal.c +++ b/src/hbcal.c @@ -61,6 +61,11 @@ #define ADAR2ADARA 1 #define ADAR2BOTH 2 +struct AltMonthName { + char const *name; + int mon; +}; + static char const *HebMonthNames[] = { "Tishrey", "Heshvan", "Kislev", "Tevet", "Shvat", "Adar A", "Adar B", "Nisan", "Iyar", "Sivan", "Tamuz", "Av", "Elul", "Adar"}; @@ -81,6 +86,27 @@ static char const *IvritMonthNames[] = { "אלול", "אדר" }; +/* Alternate spellings */ +static struct AltMonthName AltMonthSpellings[] = { + { "Tishri", TISHREY }, + { "Tishrei", TISHREY }, + { "Cheshvan", HESHVAN }, + { "Kheshvan", HESHVAN }, + { "Shevat", SHVAT }, + { "Tammuz", TAMUZ }, + { "Adar 1", ADARA }, + { "Adar 2", ADARB }, + { "Adar I", ADARA }, + { "Adar II", ADARB }, + { "Iyyar", IYAR }, + { "אדר א", ADARA }, + { "אדר ב", ADARB }, + { "אדר 1", ADARA }, + { "אדר 2", ADARB }, + { "אדר I", ADARA }, + { "אדר II", ADARB } +}; + static char MaxMonLen[] = { 30, 30, 30, 29, 30, 30, 29, 30, 29, 30, 29, 30, 29, 29}; @@ -269,12 +295,22 @@ int HebNameToNum(char const *mname) } if (m == -1) { for (i=0; i<14; i++) { - if (!strcasecmp(mname, IvritMonthNames[i])) { + if (!strcmp(mname, IvritMonthNames[i])) { m = i; break; } } } + + /* Try the alternate spellings */ + if (m == -1) { + for (i=0; i < (int) (sizeof(AltMonthSpellings) / sizeof(AltMonthSpellings[0])); i++) { + if (!strcasecmp(mname, AltMonthSpellings[i].name)) { + m = AltMonthSpellings[i].mon; + break; + } + } + } return m; } diff --git a/tests/manpage-personal-dict b/tests/manpage-personal-dict index af1a3ac8..3302c57a 100644 --- a/tests/manpage-personal-dict +++ b/tests/manpage-personal-dict @@ -211,6 +211,7 @@ Joop Kamens Kasdorp Katan +Kheshvan Kiefte Koningsdag Kristian diff --git a/tests/test.cmp b/tests/test.cmp index 1234ea26..195eb3d3 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -16658,7 +16658,11 @@ mbchar(0, 120) => Number too low mbchar(120, 0) => Number too low ../tests/test.rem(1768): mbchar(): Number too low hebdate(1, "Tishrey") => 1991-09-09 +hebdate(1, "Tishri") => 1991-09-09 +hebdate(1, "Tishrei") => 1991-09-09 hebdate(1, "תשרי") => 1991-09-09 +hebdate(1, "Cheshvan") => 1991-10-09 +hebdate(1, "Kheshvan") => 1991-10-09 hebdate(1, "Heshvan") => 1991-10-09 hebdate(1, "חשוון") => 1991-10-09 hebdate(1, "Kislev") => 1991-11-08 @@ -16666,18 +16670,31 @@ hebdate(1, "כסלו") => 1991-11-08 hebdate(1, "Tevet") => 1991-12-08 hebdate(1, "טבת") => 1991-12-08 hebdate(1, "Shvat") => 1992-01-06 +hebdate(1, "Shevat") => 1992-01-06 hebdate(1, "שבט") => 1992-01-06 hebdate(1, "Adar A") => 1992-02-05 +hebdate(1, "Adar 1") => 1992-02-05 +hebdate(1, "Adar I") => 1992-02-05 hebdate(1, "אדר א'") => 1992-02-05 +hebdate(1, "אדר א") => 1992-02-05 +hebdate(1, "אדר 1") => 1992-02-05 +hebdate(1, "אדר I") => 1992-02-05 hebdate(1, "Adar B") => 1992-03-06 +hebdate(1, "Adar 2") => 1992-03-06 +hebdate(1, "Adar II") => 1992-03-06 hebdate(1, "אדר ב'") => 1992-03-06 +hebdate(1, "אדר ב") => 1992-03-06 +hebdate(1, "אדר 2") => 1992-03-06 +hebdate(1, "אדר II") => 1992-03-06 hebdate(1, "Nisan") => 1991-03-16 hebdate(1, "ניסן") => 1991-03-16 hebdate(1, "Iyar") => 1991-04-15 +hebdate(1, "Iyyar") => 1991-04-15 hebdate(1, "אייר") => 1991-04-15 hebdate(1, "Sivan") => 1991-05-14 hebdate(1, "סיוון") => 1991-05-14 hebdate(1, "Tamuz") => 1991-06-13 +hebdate(1, "Tammuz") => 1991-06-13 hebdate(1, "תמוז") => 1991-06-13 hebdate(1, "Av") => 1991-07-12 hebdate(1, "אב") => 1991-07-12 @@ -16726,22 +16743,22 @@ bad => " mbpad("foo", "", 3, 1) => "foo" bad => "" mbpad("foo", "", 8) => Invalid multibyte sequence -../tests/test.rem(1869): mbpad(): Invalid multibyte sequence +../tests/test.rem(1886): mbpad(): Invalid multibyte sequence bad => "" mbpad("foo", "", 8, 1) => Invalid multibyte sequence -../tests/test.rem(1870): mbpad(): Invalid multibyte sequence +../tests/test.rem(1887): mbpad(): Invalid multibyte sequence bad => "" mbpad("", "bar", 0) => Invalid multibyte sequence -../tests/test.rem(1871): mbpad(): Invalid multibyte sequence +../tests/test.rem(1888): mbpad(): Invalid multibyte sequence bad => "" mbpad("", "bar", 0, 1) => Invalid multibyte sequence -../tests/test.rem(1872): mbpad(): Invalid multibyte sequence +../tests/test.rem(1889): mbpad(): Invalid multibyte sequence bad => "" mbpad("", "bar", 8) => Invalid multibyte sequence -../tests/test.rem(1873): mbpad(): Invalid multibyte sequence +../tests/test.rem(1890): mbpad(): Invalid multibyte sequence bad => "" mbpad("", "bar", 8, 1) => Invalid multibyte sequence -../tests/test.rem(1874): mbpad(): Invalid multibyte sequence +../tests/test.rem(1891): mbpad(): Invalid multibyte sequence Variable hash table statistics: Entries: 100146; Buckets: 87719; Non-empty Buckets: 66303 Maxlen: 5; Minlen: 0; Avglen: 1.142; Stddev: 0.878; Avg nonempty len: 1.510 @@ -16763,7 +16780,7 @@ Expression nodes high-water: 302076 Expression nodes leaked: 0 Parse level high-water: 34 Max expr node evaluations per line: 2001 -Total expression node evaluations: 106681 +Total expression node evaluations: 106732 Test 2 diff --git a/tests/test.rem b/tests/test.rem index 87ce18ab..6a6c8b1b 100644 --- a/tests/test.rem +++ b/tests/test.rem @@ -1773,8 +1773,12 @@ set a "foo" # Hebrew dates SET a hebdate(1, "Tishrey") +SET a hebdate(1, "Tishri") +SET a hebdate(1, "Tishrei") SET a hebdate(1, "תשרי") +SET a hebdate(1, "Cheshvan") +SET a hebdate(1, "Kheshvan") SET a hebdate(1, "Heshvan") SET a hebdate(1, "חשוון") @@ -1785,24 +1789,37 @@ SET a hebdate(1, "Tevet") SET a hebdate(1, "טבת") SET a hebdate(1, "Shvat") +SET a hebdate(1, "Shevat") SET a hebdate(1, "שבט") SET a hebdate(1, "Adar A") +SET a hebdate(1, "Adar 1") +SET a hebdate(1, "Adar I") SET a hebdate(1, "אדר א'") +SET a hebdate(1, "אדר א") +SET a hebdate(1, "אדר 1") +SET a hebdate(1, "אדר I") SET a hebdate(1, "Adar B") +SET a hebdate(1, "Adar 2") +SET a hebdate(1, "Adar II") SET a hebdate(1, "אדר ב'") +SET a hebdate(1, "אדר ב") +SET a hebdate(1, "אדר 2") +SET a hebdate(1, "אדר II") SET a hebdate(1, "Nisan") SET a hebdate(1, "ניסן") SET a hebdate(1, "Iyar") +SET a hebdate(1, "Iyyar") SET a hebdate(1, "אייר") SET a hebdate(1, "Sivan") SET a hebdate(1, "סיוון") SET a hebdate(1, "Tamuz") +SET a hebdate(1, "Tammuz") SET a hebdate(1, "תמוז") SET a hebdate(1, "Av")