From c292cbf34ab1987033c8bce54c8f649a75837c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Sun, 9 Sep 2012 22:59:13 +0200 Subject: [PATCH] Calendar.Events: Added generic solar events. --- lib/modules/Calendar.pmod/Events.pmod | 15 +++++++++++++-- lib/modules/Calendar.pmod/events/regional | 7 +++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/modules/Calendar.pmod/Events.pmod b/lib/modules/Calendar.pmod/Events.pmod index 9457815605..e991ad285d 100644 --- a/lib/modules/Calendar.pmod/Events.pmod +++ b/lib/modules/Calendar.pmod/Events.pmod @@ -145,14 +145,25 @@ Event.Event make_event(string source) case "Equinox": if (sscanf(rule, "Equinox%*[ \t]%s", string type)) { switch(String.trim_all_whites(type)) { - case "Vernal": + case "Vernal": case "Northward": return Event.Solar(0); - case "Autumnal": + case "Autumnal": case "Southward": return Event.Solar(2); } } error("Events: rule error; unknown rule format:\n%O\n",source); + case "Solstice": + if (sscanf(rule, "Solstice%*[ \t]%s", string type)) { + switch(String.trim_all_whites(type)) { + case "Summer": case "Northern": + return Event.Solar(1); + case "Winter": case "Southern": + return Event.Solar(3); + } + } + error("Events: rule error; unknown rule format:\n%O\n",source); + case "Weekday": if (sscanf(rule,"Weekday%*[ \t]%s%*[ \t]%d days", wd,days)>=2 && (n=wd2n[wd])) diff --git a/lib/modules/Calendar.pmod/events/regional b/lib/modules/Calendar.pmod/events/regional index 9fae27ff6e..775f18fc9e 100644 --- a/lib/modules/Calendar.pmod/events/regional +++ b/lib/modules/Calendar.pmod/events/regional @@ -87,6 +87,13 @@ # Global Events +# Astronomical events + + Event "northward equinox" - "Northward Equinox" Equinox Vernal + Event "Southward equinox" - "Southward Equinox" Equinox Autumnal + Event "northern solstice" - "Northern Solstice" Solstice Northern + Event "southern solstice" - "Southern Solstice" Solstice Southern + # western gregorian calendar events Event "new year" - "New Year's Day" Fixed Jan 1 -- GitLab