summaryrefslogtreecommitdiffstats
path: root/libkholidays
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /libkholidays
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkholidays')
-rw-r--r--libkholidays/Makefile.am30
-rw-r--r--libkholidays/holidays/Makefile.am20
-rw-r--r--libkholidays/holidays/holiday_BelgiumDutch34
-rw-r--r--libkholidays/holidays/holiday_BelgiumFrench34
-rw-r--r--libkholidays/holidays/holiday_BelgiumWalloon34
-rw-r--r--libkholidays/holidays/holiday_Suedtirol32
-rw-r--r--libkholidays/holidays/holiday_ar58
-rw-r--r--libkholidays/holidays/holiday_at48
-rw-r--r--libkholidays/holidays/holiday_au69
-rw-r--r--libkholidays/holidays/holiday_bavarian93
-rw-r--r--libkholidays/holidays/holiday_be30
-rw-r--r--libkholidays/holidays/holiday_br238
-rw-r--r--libkholidays/holidays/holiday_ca21
-rw-r--r--libkholidays/holidays/holiday_catalan29
-rw-r--r--libkholidays/holidays/holiday_ch17
-rw-r--r--libkholidays/holidays/holiday_co27
-rw-r--r--libkholidays/holidays/holiday_cz18
-rw-r--r--libkholidays/holidays/holiday_de30
-rw-r--r--libkholidays/holidays/holiday_dk59
-rw-r--r--libkholidays/holidays/holiday_ee38
-rw-r--r--libkholidays/holidays/holiday_es88
-rw-r--r--libkholidays/holidays/holiday_fi82
-rw-r--r--libkholidays/holidays/holiday_fr29
-rw-r--r--libkholidays/holidays/holiday_frswiss17
-rw-r--r--libkholidays/holidays/holiday_gb14
-rw-r--r--libkholidays/holidays/holiday_gr309
-rw-r--r--libkholidays/holidays/holiday_gt35
-rw-r--r--libkholidays/holidays/holiday_hu26
-rw-r--r--libkholidays/holidays/holiday_ie16
-rw-r--r--libkholidays/holidays/holiday_il72
-rw-r--r--libkholidays/holidays/holiday_is60
-rw-r--r--libkholidays/holidays/holiday_it64
-rw-r--r--libkholidays/holidays/holiday_jp80
-rw-r--r--libkholidays/holidays/holiday_lt42
-rw-r--r--libkholidays/holidays/holiday_mx32
-rw-r--r--libkholidays/holidays/holiday_nl72
-rw-r--r--libkholidays/holidays/holiday_no32
-rw-r--r--libkholidays/holidays/holiday_nz99
-rw-r--r--libkholidays/holidays/holiday_pl41
-rw-r--r--libkholidays/holidays/holiday_pt349
-rw-r--r--libkholidays/holidays/holiday_py25
-rw-r--r--libkholidays/holidays/holiday_quebec19
-rw-r--r--libkholidays/holidays/holiday_ro21
-rw-r--r--libkholidays/holidays/holiday_ru111
-rw-r--r--libkholidays/holidays/holiday_se37
-rw-r--r--libkholidays/holidays/holiday_si22
-rw-r--r--libkholidays/holidays/holiday_sk29
-rw-r--r--libkholidays/holidays/holiday_th30
-rw-r--r--libkholidays/holidays/holiday_ua118
-rw-r--r--libkholidays/holidays/holiday_us54
-rw-r--r--libkholidays/holidays/holiday_uy39
-rw-r--r--libkholidays/holidays/holiday_za17
-rw-r--r--libkholidays/kholidays.cpp148
-rw-r--r--libkholidays/kholidays.h80
-rw-r--r--libkholidays/kholidays_version.h47
-rw-r--r--libkholidays/lunarphase.cpp291
-rw-r--r--libkholidays/lunarphase.h150
-rw-r--r--libkholidays/parseholiday.c2653
-rw-r--r--libkholidays/parseholiday.h112
-rw-r--r--libkholidays/parseholiday.y715
-rw-r--r--libkholidays/scanholiday.c2037
-rw-r--r--libkholidays/scanholiday.lex96
62 files changed, 9369 insertions, 0 deletions
diff --git a/libkholidays/Makefile.am b/libkholidays/Makefile.am
new file mode 100644
index 000000000..aeef6fcf8
--- /dev/null
+++ b/libkholidays/Makefile.am
@@ -0,0 +1,30 @@
+SUBDIRS=holidays
+
+METASOURCES = AUTO
+
+INCLUDES = -I$(top_srcdir) $(all_includes)
+
+lib_LTLIBRARIES = libkholidays.la
+
+libkholidays_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 1:0:0
+libkholidays_la_LIBADD = $(LIB_KIO)
+libkholidays_la_SOURCES = kholidays.cpp scanholiday.c parseholiday.h parseholiday.c lunarphase.cpp
+
+#the lex/flex and yacc/bison files are in CVS and NOT generated
+#we do this to eliminate the need for those programs
+#parseholiday.c:
+# $(YACC) -p kcal -d -o parseholiday.c parseholiday.y
+#
+#parseholiday.h:
+# $(YACC) -p kcal -d -o parseholiday.c parseholiday.y
+#
+#scanholiday.c: parseholiday.h
+# $(LEX) -Pkcal -B -i -oscanholiday.c scanholiday.lex
+#
+#clean:
+# -rm -f scanholiday.c parseholiday.h parseholiday.c
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/libkholidays.pot
+
+include $(top_srcdir)/admin/Doxyfile.am
diff --git a/libkholidays/holidays/Makefile.am b/libkholidays/holidays/Makefile.am
new file mode 100644
index 000000000..e22166c33
--- /dev/null
+++ b/libkholidays/holidays/Makefile.am
@@ -0,0 +1,20 @@
+
+holidaysdir = $(kde_datadir)/libkholidays
+
+holidays_DATA = holiday_ar holiday_at holiday_au \
+ holiday_bavarian holiday_br \
+ holiday_BelgiumDutch holiday_BelgiumFrench holiday_BelgiumWalloon \
+ holiday_ca holiday_catalan holiday_co \
+ holiday_ch holiday_cz holiday_de holiday_dk holiday_ee \
+ holiday_es holiday_fi holiday_fr holiday_frswiss holiday_gb \
+ holiday_gr holiday_gt \
+ holiday_hu holiday_is holiday_il holiday_it holiday_jp \
+ holiday_lt holiday_mx \
+ holiday_nl \
+ holiday_no holiday_nz holiday_pl holiday_pt holiday_py \
+ holiday_quebec \
+ holiday_ro holiday_ru \
+ holiday_se holiday_si holiday_th holiday_ua holiday_us \
+ holiday_uy holiday_ie \
+ holiday_Suedtirol holiday_za
+
diff --git a/libkholidays/holidays/holiday_BelgiumDutch b/libkholidays/holidays/holiday_BelgiumDutch
new file mode 100644
index 000000000..9b663a435
--- /dev/null
+++ b/libkholidays/holidays/holiday_BelgiumDutch
@@ -0,0 +1,34 @@
+:
+: Belgian (in Dutch) holiday file. Copy to ~/.holiday
+:
+: Author: Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
+: Adapted from Dutch holiday by Danny Backx <u27113@kb.be> and Jean Cayron <jean.cayron@gmail.com>
+:
+small "Nieuwjaar" weekend on 1.1.
+small "Driekoningen" on 6.1
+small "Lichtmis" on 2.2
+small "Vastenavond" on easter minus 47 days
+small "Aswoensdag" on easter minus 46 days
+small "Palmzondag" on easter minus 7 days
+small "Witte Donderdag" on easter minus 3 days
+small "Goede Vrijdag" on easter minus 2 days
+small "Pasen - Feestdag" weekend on easter
+small "Paasmaandag" weekend on easter plus 1 day
+small "Feest van de Arbeid" weekend on 1.5
+small "Hemelvaart" weekend on easter plus 39 days
+small "Moederdag" on every second sunday in may
+small "Pinksteren" weekend on easter plus 49 days length 2 days
+small "Vaderdag" on every third sunday in june
+small "Vlaamse Gemeenschap feestdag" on 11.7
+small "Nationale feestdag" weekend on 21.7
+small "OLV Hemelvaart" weekend on 15.8
+small "Franse Gemeenschap feestdag" on 27.9
+small "Waalse feesten" on every third sunday in september
+small "Allerheiligen" weekend on 1.11
+small "Allerzielen" on 2.11
+small "Wapenstilstand" weekend on 11.11
+smaal "Duitstalige Gemeenschap feestdag" on 15.11
+small "Sinterklaas" on 06.12
+small "Kerstmis" weekend on 25.12.
+small "Tweede kerstdag" on 26.12.
+small "Oudjaar" on 31.12
diff --git a/libkholidays/holidays/holiday_BelgiumFrench b/libkholidays/holidays/holiday_BelgiumFrench
new file mode 100644
index 000000000..918d9f6c4
--- /dev/null
+++ b/libkholidays/holidays/holiday_BelgiumFrench
@@ -0,0 +1,34 @@
+:
+: Belgian (in french) holiday file. Copy to ~/.holiday
+:
+: Author: Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
+: Adapted from Dutch holiday by Danny Backx <u27113@kb.be> and Jean Cayron <jean.cayron@gmail.com>
+:
+small "Jour de l'an" weekend on 1.1.
+small "Épiphanie" on 6.1
+small "Chandeleur" on 2.2
+small "Mardi-gras" on easter minus 47 days
+small "Mercredi des cendres" on easter minus 46 days
+small "Dimanche des rameaux" on easter minus 7 days
+small "Jeudi saint" on easter minus 3 days
+small "Vendredi saint" on easter minus 2 days
+small "Pâques" weekend on easter
+small "Lundi de Pâques" weekend on easter plus 1 day
+small "Fête du travail" weekend on 1.5
+small "Ascencion" weekend on easter plus 39 days
+small "Fête des mères" on every second sunday in may
+small "Pentecôte" weekend on easter plus 49 days
+small "Lundi de Pentecôte" weekend on easter plus 50 days
+small "Fête des pères" on every third sunday in june
+small "Fête de la Communauté flamande" on 11.7
+small "Fête nationale - Férié" weekend on 21.7
+small "Assomption" weekend on 15.8
+small "Fête de la Communauté française de Belgique" on 27.9
+small "Fêtes de Wallonie" on every third sunday in september
+small "Toussaint" weekend on 1.11
+small "Jour des morts" on 2.11
+small "Armistice" weekend on 11.11
+smaal "Fête de la Communauté germanophone de Belgique" on 15.11
+small "Saint Nicolas" on 06.12
+small "Noël" weekend on 25.12.
+small "Saint-Sylvestre" on 31.12
diff --git a/libkholidays/holidays/holiday_BelgiumWalloon b/libkholidays/holidays/holiday_BelgiumWalloon
new file mode 100644
index 000000000..aace37dc0
--- /dev/null
+++ b/libkholidays/holidays/holiday_BelgiumWalloon
@@ -0,0 +1,34 @@
+:
+: Belgian (in walloon) holiday file. Copy to ~/.holiday
+:
+: Author: Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
+: Adapted from Dutch holiday by Danny Backx <u27113@kb.be> and Djan Cayron <jean.cayron@gmail.com>
+:
+small "Novelan" weekend on 1.1.
+small "Fiesse des Rwès" on 6.1
+small "Tchandleuse" on 2.2
+small "Crås mårdi" on easter minus 47 days
+small "Mierkidi des cindes" on easter minus 46 days
+small "Floreye Påke" on easter minus 7 days
+small "Djudi sint" on easter minus 3 days
+small "Bon vénrdi" on easter minus 2 days
+small "Påke" weekend on easter
+small "Londi d' Påke" weekend on easter plus 1 day
+small "Fiesse do boutaedje" weekend on 1.5
+small "Assincion" weekend on easter plus 39 days
+small "Fiesse des méres" on every second sunday in may
+small "Céncweme (Pintcosse)" weekend on easter plus 49 days
+small "Londi d' Céncweme" weekend on easter plus 50 days
+small "Fiesse des péres" on every third sunday in june
+small "Fiesse del Cominålté flaminde" on 11.7
+small "Fiesse nacionåle" weekend on 21.7
+small "Grande Notru Dame" weekend on 15.8
+small "Fiesse del Cominålté francesse di Beldjike" on 27.9
+small "Fiesses di Walonreye" on every third sunday in september
+small "Tossint" weekend on 1.11
+small "Djoû des åmes" on 2.11
+small "Årmistice" weekend on 11.11
+smaal "Fiesse del Cominålté Tîxhon-cåzante di Belgjike" on 15.11
+small "Sint Nicolai" on 06.12
+small "Noyé" weekend on 25.12.
+small "Sint Silvesse" on 31.12
diff --git a/libkholidays/holidays/holiday_Suedtirol b/libkholidays/holidays/holiday_Suedtirol
new file mode 100644
index 000000000..3838dbea5
--- /dev/null
+++ b/libkholidays/holidays/holiday_Suedtirol
@@ -0,0 +1,32 @@
+:
+: Südtirol holiday file.
+: by Roland Reiterer (roland_reiterer2001@gmx.net)
+:
+"Neujahr" weekend on 1.1
+"Hl. 3 Könige" weekend on 6.1
+small "Tag der Frau" on 8.3
+small "Hl. Joseph" on 19.3
+small "Vatertag" on 19.3
+small "Unnsinger Donnerstag" on easter minus 52 days
+small "Faschingsdienstag" on easter minus 47 days
+small "Aschermittwoch" on easter minus 46 days
+"Ostersonntag" weekend on easter
+"Ostermontag" weekend on easter plus 1 day
+small "Pfingstsonntag" on easter plus 49 days
+small "Pfingstmontag" on easter plus 50 days
+small "Christi Himmelfahrt" on easter plus 39 days
+"Tag der Freiheit" weekend on 25.4
+"Tag der Arbeit" weekend on 1.5
+small "Muttertag" on second sunday in may
+small "Tag der Republik" on 2.6
+small "Hl. Peter und Paul" on 29.6
+"Maria Himmelfahrt" weekend on 15.8
+small "Ferragosto" on 15.8
+small "Hl. Franziskus" on 4.10
+"Allerheiligen" weekend on 1.11
+small "Allerseelen" on 2.11
+small "Nationalfeiertag" on 4.11
+"Maria Empfängnis" weekend on 8.12
+"Christtag" weekend on 25.12
+"Stephanstag" weekend on 26.12
+small "Silvester" on 31.12
diff --git a/libkholidays/holidays/holiday_ar b/libkholidays/holidays/holiday_ar
new file mode 100644
index 000000000..95c4185bc
--- /dev/null
+++ b/libkholidays/holidays/holiday_ar
@@ -0,0 +1,58 @@
+:
+: Argentina holiday file
+:
+: Official Holiday List
+: See http://www.mininterior.gov.ar/servicios/feriados.asp
+:
+: Related national laws
+: http://www.uncu.edu.ar/contenido/skins/unc/download/Ley%2023555.pdf
+: http://www.uncu.edu.ar/contenido/skins/unc/download/Ley%2024445.pdf
+: http://www.puntoprofesional.com/P/0650/LEY_26416.HTM
+:
+: Author: Daniel Vega <dv5a@dc.uba.ar>
+
+
+: National holidays
+
+small "Año Nuevo" weekend on 1/1
+small "Día Nacional de la Memoria" weekend on 3/24
+small "Viernes Santo" weekend on easter minus 2
+small "Día de los Caídos en Malvinas" weekend on 4/2
+small "Día del Trabajador" weekend on 5/1
+small "Primer Gobierno Patrio" weekend on 5/25
+small "Día de Manuel Belgrano" weekend on third monday in june
+small "Día de la Independencia" weekend on 7/9
+small "Día de San Martín" weekend on third monday in august
+small "Día de la Raza" weekend on (([10/12] == [tuesday after ([10/11])] || [10/12] == [wednesday after ([10/11])]) ? [monday before ([10/12])] :
+ [monday after ([10/11])])
+small "Inmaculada Concepción de María" weekend on 12/8
+small "Navidad" weekend on 12/25
+
+: Non-workable days
+small "Jueves Santo" on easter minus 3
+
+: Jewish and Islamic holidays not easy to calculate
+
+: Interesting dates
+
+small "Día de Reyes" on 1/6
+small "Día de San Valentín" on 2/14
+small "Día de la Mujer" on 3/8
+small "Sábado de Gloria" on easter minus 1
+small "Domingo de Pascua" on easter
+small "Día del Animal" on 4/29
+small "Día del Ahijado/Nieto" on second sunday in may
+small "Día del Padre" on third sunday in june
+small "Día del Amigo" on 7/20
+small "Dia del Niño" on second sunday in august
+small "Día de la Madre" on third sunday in october
+small "Halloween" on 10/31
+small "Noche Buena" on 12/24
+small "Día de los Inocentes" on 12/28
+small "Fin de Año" on 12/31
+
+: Seasons
+"Equinoxio de otoño" on 3/21
+"Solsticio de invierno" on 6/21
+"Equinoxio de primavera" on 9/21
+"Solsticio de verano" on 12/21
diff --git a/libkholidays/holidays/holiday_at b/libkholidays/holidays/holiday_at
new file mode 100644
index 000000000..b84c10699
--- /dev/null
+++ b/libkholidays/holidays/holiday_at
@@ -0,0 +1,48 @@
+:
+: Austrian holiday file.
+: Author: Friedrich Leisch <Friedrich.Leisch@ci.tuwien.ac.at>
+:
+small "Neujahr" weekend on 1.1.
+small "Hl. 3 Könige" weekend on 6.1.
+
+blue "Sommerzeit" on last sunday in march
+
+small "Rosenmontag" on easter minus 48 days
+small "Faschingsdienstag" on easter minus 47 days
+small "Aschermittwoch" on easter minus 46 days
+small "Palmsonntag" on easter minus 7 days
+small "Gründonnerstag" on easter minus 3 days
+small "Karfreitag" on easter minus 2 days
+small "Karsamstag" on easter minus 1 days
+small "Ostern" weekend on easter length 2 days
+small "Pfingsten" weekend on easter plus 49 days length 2 days
+small "Christi Himmelfahrt" weekend on easter plus 39 days
+small "Fronleichnam" weekend on easter plus 60 days
+
+small "Tag der Arbeit" weekend on 1.5.
+small "Muttertag" on second sunday in may
+small "Vatertag" on second sunday in june
+
+small "Maria Himmelfahrt" weekend on 15.8.
+
+blue "Winterzeit" on last sunday in october
+
+small "Nationalfeiertag" weekend on 26.10.
+
+small "Allerheiligen" weekend on 1.11.
+small "Allerseelen" on 2.11.
+
+small "Martini" on 11.11.
+small "Leopoldi" on 15.11.
+small "Krampus" on 5.12.
+small "Nikolaus" on 6.12.
+small "Maria Empfängnis" weekend on 8.12.
+small "1. Advent" on sunday before 24.12. minus 21 days
+small "2. Advent" on sunday before 24.12. minus 14 days
+small "3. Advent" on sunday before 24.12. minus 7 days
+small "4. Advent" on sunday before 24.12.
+small "Hl. Abend" on 24.12.
+small "Christtag" weekend on 25.12.
+small "Stephani" weekend on 26.12.
+
+small "Silvester" on 31.12.
diff --git a/libkholidays/holidays/holiday_au b/libkholidays/holidays/holiday_au
new file mode 100644
index 000000000..052aa702e
--- /dev/null
+++ b/libkholidays/holidays/holiday_au
@@ -0,0 +1,69 @@
+:
+: Australian holiday file. Copy to ~/.holiday
+:
+: Author: Peter Turnbull (peter@cbr.atr.com.au)
+:
+: Note that some standard holidays vary widely depending on which state you
+: are in. It is recommended that you either remove the weekend keyword from
+: the states that aren't applicable to you, or just remove them.
+:
+: TODO: correct the holidays as noted below. I'm not sure how to do that.
+
+: If Christmas or Boxing Day fall on a weekend then the holidays are
+: moved to the following Monday and Tuesday.
+
+small "Christmas" weekend on december 25
+small "Boxing Day" weekend on december 26
+
+: If new years day falls on a weekend then the Monday is a holiday.
+small "New Year's Day" weekend on january 1
+
+small "Australia Day" on january 26
+
+small "Anzac Day" on april 25
+small "Easter Sunday" weekend on easter
+small "Good Friday" weekend on easter minus 2
+small "Easter Monday" weekend on easter plus 1
+
+: About the 2nd weekend in June. The holiday is always a Monday.
+small "Queen's Birthday" weekend on second monday in june
+small "Melbourne Cup" weekend on first tuesday in november
+
+: Labour day for ACT, NSW, SA
+small "Labour Day" weekend on first monday in october
+
+: Specific holidays for the ACT
+small "Canberra Day" weekend on march 21
+small "ACT - Bank holiday" weekend on first monday in august
+
+: Specific holidays for Victoria
+small "VIC - Labour Day" weekend on second monday in march
+
+: Show day is always a Thursday. I think the last in Spetember but not sure.
+small "Melbourne Show Day" weekend on september 22
+
+: Specific holidays for SA
+small "Adelaide Cup Day" weekend on may 16
+small "SA - Proclamation Day" weekend on december 28
+
+: Specific holidays for Tasmania
+small "TAS - Eight Hours Day" weekend on march 7
+small "TAS - Bank Holiday" weekend on april 5
+small "TAS - Recreation Day" weekend on november 7
+
+: Specific holidays for WA
+small "WA - Labour Day" weekend on first monday in march
+small "WA - Foundation Day" weekend on first monday in june
+small "WA - Queen's Birthday" weekend on september 26
+
+: Specific holidays for NT
+small "NT - May Day" weekend on first monday in may
+small "Alice Springs Show Day" weekend on first friday in july
+small "Tennant Creek Show Day" weekend on second friday in july
+small "Katherine Show Day" weekend on third friday in july
+small "Darwin Show Day" weekend on last friday in july
+small "NT - Picnic Day" weekend on first monday in august
+
+: Specific holidays for QLD
+small "QLD - Labour Day" weekend on first monday in may
+
diff --git a/libkholidays/holidays/holiday_bavarian b/libkholidays/holidays/holiday_bavarian
new file mode 100644
index 000000000..dffc08f97
--- /dev/null
+++ b/libkholidays/holidays/holiday_bavarian
@@ -0,0 +1,93 @@
+:
+: Slightly bavarianized german holiday file.
+: by Burkhard Ludwig <ludwig@zfe.siemens.de>
+:
+
+: Rearranged and bavaricized version of holiday_german:
+
+:
+: Hints (to be understood by germans):
+:
+: Schwalben...
+: An OCULI da kommen sie
+: An MARIÄ GEBURT, da sind sie wieder furt.
+: Geranien...
+: pflanzt man auf dem Balkon nach den Eisheiligen (PANKRAZ bis kalte SOPHIE)
+: Gänse...
+: Wer einen guten Braten macht hat auch ein gutes Herz. (MARTINI)
+: Spargel...
+: wird bis höchstens JOHANNI gestochen.
+: Regen...
+: Wenns ans SIEBENSCHLÄFER regnet, so regnet's sieben Wochen.
+:
+
+:
+: 2) Holidays which are known by the usual pagan too.
+: (Since its vacation or sentimental or the like)
+:
+
+small "Neujahr" weekend on 1.1.
+small "Hl. 3 Könige" weekend on 6.1.
+small "Rosenmontag" on easter minus 48 days
+small "Fasching" on easter minus 47 days
+small "Aschermittwoch" on easter minus 46 days
+small "Karfreitag" weekend on easter minus 2 days
+small "Ostern" weekend on easter length 2 days
+small "Pfingsten" weekend on easter plus 49 days length 2 days
+small "Christi Himmelfahrt" weekend on easter plus 39 days
+small "Mariä Himmelfahrt" weekend on 15.8
+small "Fronleichnam" weekend on easter plus 60 days
+small "1. Mai" weekend on 1.5.
+small "Einheitstag" weekend on 3.10.
+small "Allerheiligen" weekend on 1.11.
+small "Buß- und Bettag" weekend on sunday before 24.12. minus 32 days
+small "Hl. Abend" on 24.12.
+small "Weihnachten" weekend on 25.12. length 2 days
+small "Silvester" on 31.12.
+
+:
+: 3) Devil's Grandmothers Days
+:
+ blue "Sommerzeit" on last sunday in march
+ blue "Winterzeit" on last sunday in october
+:
+: 4) Ecclestiastica
+:
+
+small black "1. Advent" on sunday before 24.12. minus 21 days
+small black "2. Advent" on sunday before 24.12. minus 14 days
+small black "3. Advent" on sunday before 24.12. minus 7 days
+small black "4. Advent" on sunday before 24.12.
+small black "1. Fastensonntag" on easter minus 42 days
+small black "2. Fastensonntag" on easter minus 35 days
+small black "3. Fastensonntag" on easter minus 28 days
+ blue "Oculi" on easter minus 28 days
+small black "4. Fastensonntag" on easter minus 21 days
+small black "5. Fastensonntag" on easter minus 14 days
+small black "Palmsonntag" on easter minus 7 days
+small black "Christkönig" on sunday before 23.12. minus 28 days
+
+:
+: 5) Selected saints
+:
+
+small black "Lichtmeß" on 2.2.
+small black "Pankraz" on 11.5.
+small black "Servaz" on 12.5.
+small black "Bonifaz" on 13.5.
+small black "Sophie" on 14.5.
+small black "Johanni" on 24.6.
+small black "Siebenschläfer" on 27.6.
+small black "Mariä Geburt" on 8.9.
+small black "Martini" on 11.11.
+small black "Nikolaus" on 6.12.
+
+:
+: 6) Commercials --- beware
+:
+
+small black "Muttertag" on second sunday in may
+small black "1. Wies'nsonntag" on first sunday in october minus 14 days
+small green "Karwoche" on easter minus 6days length 6 days
+
+
diff --git a/libkholidays/holidays/holiday_be b/libkholidays/holidays/holiday_be
new file mode 100644
index 000000000..d202b984d
--- /dev/null
+++ b/libkholidays/holidays/holiday_be
@@ -0,0 +1,30 @@
+:
+: Belgian holiday file. Copy to ~/.holiday
+:
+: Author: Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
+: Adapted from Dutch holiday by Danny Backx <u27113@kb.be>
+:
+small "Nieuwjaar" weekend on 1.1.
+small "Driekoningen" weekend on 6.1
+small "Lichtmis" weekend on 2.2
+small "Vastenavond" weekend on easter minus 47 days
+small "Aswoensdag" weekend on easter minus 46 days
+small "Palmzondag" on easter minus 7 days
+small "Witte Donderdag" weekend on easter minus 3 days
+small "Goede Vrijdag" weekend on easter minus 2 days
+small "Pasen" weekend on easter
+small "Paasmaandag" weekend on easter plus 1 day
+small "Feest van de Arbeid" on 1.5
+small "Hemelvaart" weekend on easter plus 39 days
+small "Moederdag" on every second sunday in may
+small "Pinksteren" weekend on easter plus 49 days length 2 days
+small "Vaderdag" on every third sunday in june
+small "Vlaamse feestdag" weekend on 11.7
+small "Nationale feestdag" on 21.7
+small "OLV Hemelvaart" on 15.8
+small "Waalse feestdag" weekend on 27.9
+small "Allerheiligen" on 1.11
+small "Allerzielen" weekend on 2.11
+small "Kerstmis" on 25.12.
+small "Tweede kerstdag" on 26.12.
+small "Oudjaar" on 31.12
diff --git a/libkholidays/holidays/holiday_br b/libkholidays/holidays/holiday_br
new file mode 100644
index 000000000..09bb15dcc
--- /dev/null
+++ b/libkholidays/holidays/holiday_br
@@ -0,0 +1,238 @@
+:
+: Brazilian holiday file.
+:
+: Author: Juliano Ferraz Ravasi <dev@juliano.info>
+: Version: 1 - 1 Oct 2006
+:
+: Released under the General Public License
+:
+
+: Feriados nacionais (Fedaral holidays)
+:::
+
+small weekend "Confraternização Universal" on january 1
+small weekend "Tiradentes" on april 21
+small weekend "Dia do Trabalho" on may 1
+small weekend "Independência do Brasil" on september 7
+small weekend "Proclamação da República" on november 15
+
+: Feriados e datas comemorativas religiosos (Religious holidays)
+:::
+
+small "Reis Magos" on january 6
+small weekend "Carnaval" on easter minus 48 days
+small weekend "Carnaval" on easter minus 47 days
+small "Cinzas" on easter minus 46 days
+small "Paixão de Cristo" on easter minus 2 days
+small weekend "Páscoa" on easter
+small weekend "Corpus Christi" on easter plus 60 days
+small weekend "Nossa Senhora Aparecida" on october 12
+small "Todos os Santos" on november 1
+small weekend "Finados" on november 2
+small weekend "Natal" on december 25
+
+: Estações do ano (Seasons)
+:::
+
+small green "Início do Outono" on march 22
+small green "Início do Inverno" on june 22
+small green "Início da Primavera" on september 22
+small green "Início do Verão" on december 22
+
+: Datas comemorativas mundiais (International commemmorative dates)
+:::
+
+:small "Dia Mundial da Religião" on january 21
+small "Dia Internacional da Mulher" on march 8
+:small "Dia Mundial do Consumidor" on march 15
+:small "Dia Internacional Contra a Discriminação Racial" on march 21
+:small "Dia Mundial da Água" on march 22
+:small "Dia Internacional do Livro Infantil" on april 2
+small "Dia Mundial da Saúde" on april 7
+small "Dia Mundial de Combate ao Câncer" on april 8
+:small "Dia Internacional do Café" on april 14
+:small "Dia Mundial do Desenhista" on april 15
+:small "Dia Mundial do Escoteiro" on april 23
+:small "Dia Internacional da Cruz Vermelha" on may 8
+:small "Dia Mundial do Enfermeiro" on may 12
+:small "Dia Internacional das Telecomunicações" on may 17
+:small "Dia Mundial dos Museus" on may 18
+:small "Dia Internacional das Crianças Vítimas de Agressão" on june 4
+:small "Dia Mundial do Meio Ambiente" on june 5
+small "Dia Internacional do Combate às Drogas" on june 26
+:small "Dia Mundial da População" on july 11
+:small "Dia Mundial da Alfabetização" on september 8
+:small "Dia Internacional para Preservação da Camada de Ozônio" on september 16
+:small "Dia Mundial da Alimentação" on october 16
+small "Dia das Bruxas" on october 31
+small "Dia Mundial de Ação de Graças" on november 28
+small "Dia Mundial da Luta contra a AIDS" on december 1
+:small "Dia Internacional das Pessoas Portadoras de Deficiência" on december 3
+:small "Dia Internacional do Voluntário" on december 5
+:small "Dia da Declaração dos Direitos do Homem" on december 10
+small "Reveillon" on december 31
+
+: Outras datas comemorativas (Other commemorative dates)
+:::
+
+:small "Dia da Criação da 1ª Tipografia" on january 4
+:small "Dia do Fotógrafo" on january 6
+:small "Dia da Gratidão" on january 6
+:small "Dia da Liberdade de Culto" on january 7
+:small "Dia do Fico" on january 9
+:small "Dia do Farmacêutico" on january 20
+:small "Dia do Fusca" on january 20
+:small "Dia da Previdência Social" on january 24
+:small "Dia do Carteiro" on january 25
+:small "Dia da Saudade" on january 30
+:small "Dia do Publicitário" on february 1
+:small "Dia do Gráfico" on february 7
+:small "Dia do Repórter" on february 16
+:small "Dia do Esportista" on february 19
+:small "Dia do Turismo" on march 2
+:small "Dia do Filatelista Brasileiro" on march 5
+:small "Dia do Fuzileiro Naval" on march 7
+:small "Dia do Telefone" on march 10
+:small "Dia do Bibliotecário" on march 12
+:small "Dia da Poesia" on march 14
+:small "Dia da Escola" on march 15
+:small "Dia do Meteorologista" on march 23
+:small "Dia do Circo" on march 27
+:small "Dia do Teatro" on march 27
+:small "Dia do Revisor e do Diagramador" on march 28
+:small "Dia da Mentira" on april 1
+:small "Dia do Jornalismo" on april 7
+:small "Dia da Natação" on april 8
+:small "Dia dos Jovens" on april 13
+:small "Dia da Conservação do Solo" on april 15
+:small "Dia do Índio" on april 19
+:small "Dia do Diplomata" on april 20
+:small "Dia do Metalúrgico" on april 21
+:small "Dia do Planeta Terra" on april 22
+:small "Dia da Força Aérea Brasileira" on april 22
+:small "Dia do Contabilista" on april 25
+:small "Dia da Empregada Doméstica" on april 27
+:small "Dia da Educação" on april 28
+:small "Dia do Ferroviário" on april 30
+:small "Dia do Cartógrafo" on may 6
+:small "Dia do Artista Plástico" on may 8
+:small "Dia do Automóvel" on may 13
+:small "Dia do Assistente Social" on may 15
+:small "Dia do Gari" on may 16
+:small "Dia da Língua Nacional" on may 21
+:small "Dia do Apicultor" on may 22
+:small "Dia do Vestibulando" on may 24
+:small "Dia da Indústria" on may 25
+:small "Dia do Profissional Liberal" on may 27
+:small "Dia do Estatístico" on may 29
+:small "Dia do Geógrafo" on may 29
+:small "Dia do Geólogo" on may 30
+:small "Dia da Imprensa" on june 1
+:small "Dia do Porteiro" on june 9
+:small "Dia da Língua Portuguesa" on june 10
+:small "Dia da Marinha Brasileira" on june 11
+small "Dia dos Namorados" on june 12
+:small "Dia do Paleontólogo" on june 15
+:small "Dia do Químico" on june 18
+:small "Dia do Migrante" on june 19
+:small "Dia da Música" on june 21
+:small "Dia do Aeroviário" on june 22
+:small "Dia do Imigrante" on june 25
+:small "Dia do Metrologista" on june 26
+:small "Dia da Telefonista" on june 29
+:small "Dia do Pescador" on june 29
+:small "Dia da Vacina BCG" on july 1
+:small "Dia do Bombeiro" on july 2
+:small "Dia do Engenheiro Florestal" on july 12
+:small "Dia de Proteção às Florestas" on july 17
+:small "Dia do Futebol" on july 19
+:small "Dia da Amizade" on july 20
+:small "Dia do Escritor" on july 25
+:small "Dia do Agricultor" on july 28
+:small "Dia do Advogado" on august 11
+:small "Dia da Televisão" on august 11
+:small "Dia do Economista" on august 13
+:small "Dia da Informática" on august 15
+:small "Dia da Habitação" on august 21
+:small "Dia do Folclore" on august 22
+:small "Dia do Soldado" on august 25
+:small "Dia do Psicólogo" on august 27
+:small "Dia do Nutricionista" on august 31
+:small "Dia do Biólogo" on september 3
+:small "Dia da Independência" on september 7
+:small "Dia do Administrador" on september 9
+:small "Dia do Médico Veterinário" on september 9
+:small "Dia dos Símbolos Nacionais" on september 18
+:small "Dia do Idoso" on september 21
+:small "Dia da Árvore" on september 21
+:small "Dia do Rádio" on september 25
+:small "Dia do Trânsito" on september 25
+:small "Dia da Secretária" on september 30
+:small "Dia dos Animais" on october 4
+:small "Dia da Promulgação da Atual Constituição Brasileira" on october 5
+:small "Dia da Pessoa Portadora de Deficiência Física" on october 11
+small "Dia da Criança" on october 12
+:small "Dia do Agrônomo" on october 12
+:small "Dia do Fisioterapeuta" on october 13
+:small "Dia da Pecuária" on october 14
+:small "Dia do Professor" on october 15
+:small "Dia do Médico" on october 18
+:small "Dia do Aviador" on october 23
+:small "Dia da ONU" on october 24
+:small "Dia da Democracia" on october 25
+:small "Dia do Dentista" on october 25
+:small "Dia do Funcionário Público" on october 28
+:small "Dia do Livro" on october 29
+:small "Dia do Comércio" on october 30
+:small "Dia do Cinema Brasileiro" on november 5
+:small "Dia da Bandeira" on november 19
+:small "Dia da Consciência Negra" on november 20
+:small "Dia do Teólogo" on november 30
+:small "Dia da Reforma Agrária" on november 30
+:small "Dia da Astronomia" on december 2
+:small "Dia do Orientador Educacional" on december 4
+:small "Dia da Família" on december 8
+:small "Dia do Fonoaudiólogo" on december 9
+:small "Dia do Engenheiro" on december 11
+:small "Dia do Arquiteto" on december 11
+
+: Datas históricas
+:::
+
+small "Abertura dos Portos no Brasil, 1808" on january 28
+small "Descobrimento do Brasil, 1500" on april 22
+small "Abolição da Escravatura, 1888" on may 13
+small "Golpe Militar, 1964" on march 31
+small "Chegada do Homem à Lua, 1969" on june 20
+small "Descobrimento da América, 1492" on october 12
+
+: Datas comemorativas de estados e cidades
+:::
+
+:small "Aniversário de Belém" on january 12
+:small "Aniversário da Cidade de São Paulo" on january 25
+:small "Aniversário de Macapá" on february 4
+:small "Aniversário da Cidade do Rio de Janeiro" on march 1
+:small "Aniversário de Recife" on march 12
+:small "Aniversário de Aracaju" on march 17
+:small "Aniversário de Florianópolis" on march 23
+:small "Aniversário de Porto Alegre" on march 26
+:small "Aniversário de Curitiba" on march 29
+:small "Aniversário de Cuiabá" on april 8
+:small "Aniversário de Fortaleza" on april 12
+:small "Aniversário de Brasília" on april 21
+:small "Aniversário de Palmas" on may 20
+:small "Aniversário de Boa Vista" on june 9
+:small "Aniversário de Teresina" on august 16
+:small "Aniversário de Campo Grande" on august 26
+:small "Aniversário de Vitória" on september 8
+:small "Aniversário de São Luís" on september 8
+:small "Aniversário de Maceió" on december 5
+:small "Aniversário de Belo Horizonte" on december 12
+:small "Aniversário de Rio Branco" on december 28
+
+: Datas comerciais
+:::
+
+small "Dia das Mães" on second sunday in may
+small "Dia dos Pais" on second sunday in august
diff --git a/libkholidays/holidays/holiday_ca b/libkholidays/holidays/holiday_ca
new file mode 100644
index 000000000..55832b4f3
--- /dev/null
+++ b/libkholidays/holidays/holiday_ca
@@ -0,0 +1,21 @@
+:
+: Canadian holiday file. Copy to ~/.holiday
+:
+: Author: Peter Littlefield <plittle@sofkin.ca>
+:
+small "New Year's Day" weekend on january 1
+small "Valentine's Day" on february 14
+small "Good Friday" weekend on easter minus 2 days
+small "Easter" weekend on easter
+small "Easter Monday" weekend on easter plus 1 day
+small "Mother's Day" on second sunday in may
+small "Victoria Day" weekend on monday before may 24
+small "Father's Day" on third sunday in june
+small "St-Jean Baptiste" on june 24
+small "Canada Day" weekend on july 1
+small "Civic Holiday" weekend on first monday in august
+small "Labour Day" weekend on first monday in september
+small "Thanksgiving" weekend on second monday in october
+small "Remembrance Day" weekend on november 11
+small "Christmas" weekend on december 25
+small "Boxing Day" weekend on december 26
diff --git a/libkholidays/holidays/holiday_catalan b/libkholidays/holidays/holiday_catalan
new file mode 100644
index 000000000..6afee6450
--- /dev/null
+++ b/libkholidays/holidays/holiday_catalan
@@ -0,0 +1,29 @@
+:
+: Catalan holidays
+: Jordi Saludes <saludes@grec.upc.es>
+: Last modified on Apr 24 1999
+:
+:
+: fixed
+:
+"Any nou" on 1/1
+"Reis" on 1/6
+small "Sant Jordi" on 4/23
+"Primer de Maig" on 5/1
+"Sant Joan" on 6/24
+"Mare de Déu d'Agost" on 8/15
+"Diada Nacional" on 9/11
+"Pilar" on 10/12
+"Tots Sants" on 11/1
+"Constitució" on 12/6
+"Immaculada" on 12/8
+"Nadal" on 12/25
+:
+: mobile
+:
+small "Dijous Sant" weekend on easter minus 3 days
+small "Divendres Sant" weekend on easter minus 2 days
+small "Pasqua" weekend on easter
+small "Dimecres de cendra" on easter minus 46 days
+small "Pentecosta" weekend on easter plus 49 days
+
diff --git a/libkholidays/holidays/holiday_ch b/libkholidays/holidays/holiday_ch
new file mode 100644
index 000000000..8dd0e3c53
--- /dev/null
+++ b/libkholidays/holidays/holiday_ch
@@ -0,0 +1,17 @@
+:
+: Swiss holiday file. Copy to ~/.holiday
+: Use this as a starting point, some holidays are missing, and some listed
+: here are largely irrelevant.
+:
+: Author: Christian Iseli
+:
+red "Nouvel-An" weekend on 1/1
+red "Vendredi Saint" weekend on easter minus 2 days
+red "Paques" weekend on easter
+red "Ascension" weekend on easter plus 39 days
+red "Pentecote" weekend on easter plus 49 days
+red "L. de Pentecote" weekend on easter plus 50 days
+red "Noel" weekend on 12/25
+red "Premier Aout" weekend on august 1
+red "Jeune Federal" weekend on third sunday in september
+red "Lundi du Jeune" weekend on third sunday in september plus 1 day
diff --git a/libkholidays/holidays/holiday_co b/libkholidays/holidays/holiday_co
new file mode 100644
index 000000000..57529c7e8
--- /dev/null
+++ b/libkholidays/holidays/holiday_co
@@ -0,0 +1,27 @@
+:
+: Archivo holiday_colombia. Cópialo a ~/.holiday
+: Modifica este archivo borrando y añadiendo lo que te parezca.
+:
+: Festivos
+:
+red "Año nuevo" red on january 1
+red "Reyes magos" red on monday after january 6
+red "San José" red on march 24
+red "Día del Trabajo" red on may 1
+red "Dia de la ascención" red on june 2
+red "Día del Corpus" red on monday after june 23
+red "San Pedro y San Pablo" red on monday after june 30
+red "Sagrado Corazón" red on monday after june 30
+red "Día de la Independencia" red on july 20
+red "Fiesta de la Batalla de Boyaca" red on august 7
+red "Asunción" red on monday after august 18
+red "Día de la Raza" red on october 13
+red "Todos los Santos" red on monday after november 3
+red "Independencia de Cartagena" red on november 17
+red "La Inmaculada" red on december 8
+red "Día de Navidad" red on december 25
+:
+: Relacionados con la pascua
+:
+small "Jueves Santo" weekend on easter minus 3 days
+small "Viernes Santo" weekend on easter minus 2 days
diff --git a/libkholidays/holidays/holiday_cz b/libkholidays/holidays/holiday_cz
new file mode 100644
index 000000000..e0838a66d
--- /dev/null
+++ b/libkholidays/holidays/holiday_cz
@@ -0,0 +1,18 @@
+:
+: Czech holiday file.
+: Author: Miroslav Flídr<flidr@kky.zcu.cz>
+:
+small "Nový rok" weekend on 1.1.
+small "Velikonoce" weekend on easter
+small "Velikonoční pondělí" weekend on easter plus 1 days
+small "Svátek práce" weekend on 1.5.
+small "Státní svátek - Den osvobození" weekend on 8.5.
+small "Státní svátek - Den slovanských věrozvěstů Cyrila a Metoděje" weekend on 5.7.
+small "Statní svátek - Mistr Jan Hus" weekend on 6.7.
+small "Státní svátek - Den České státnosti" weekend on 28.9.
+small "Státní svátek - Den vzniku samostatného Československa (1918)" weekend on 28.10.
+small "Státní svátek - Den boje studentů za svobodu a demokracii" weekend on 17.11.
+small "Štědrý den" weekend on 24.12.
+small "1. svátek vánoční" weekend on 25.12.
+small "2. svátek vánoční" weekend on 26.12.
+small blue "Silvestr" on 31.12.
diff --git a/libkholidays/holidays/holiday_de b/libkholidays/holidays/holiday_de
new file mode 100644
index 000000000..ba2f4b1a0
--- /dev/null
+++ b/libkholidays/holidays/holiday_de
@@ -0,0 +1,30 @@
+:
+: German holiday file. Copy to ~/.holiday
+: Bavarians please add the weekend keyword everywhere, and sprinkle
+: generously with more obscure catholic holidays.
+:
+small "Neujahr" weekend on 1.1.
+small "Hl. 3 Könige" on 6.1.
+blue "Sommerzeit" on last sunday in march
+small "Rosenmontag" on easter minus 48 days
+small "Fasching" on easter minus 47 days
+small "Aschermittwoch" on easter minus 46 days
+small "Karfreitag" weekend on easter minus 2 days
+small "Ostern" weekend on easter length 2 days
+small "Pfingsten" weekend on easter plus 49 days length 2 days
+small "Himmelfahrt" weekend on easter plus 39 days
+small "Fronleichnam" on easter plus 60 days
+small "1. Mai" weekend on 1.5.
+small "Muttertag" on second sunday in may
+blue "Winterzeit" on last sunday in october
+small "Tag d. Einheit" weekend on 3.10.
+small "Reformationstag" on 31.10.
+small "Allerheiligen" on 1.11.
+small "Buß & Bettag" on sunday before 24.12. minus 32 days
+small "1. Advent" on sunday before 24.12. minus 21 days
+small "2. Advent" on sunday before 24.12. minus 14 days
+small "3. Advent" on sunday before 24.12. minus 7 days
+small "4. Advent" on sunday before 24.12.
+small "Hl. Abend" on 24.12.
+small "Weihnachten" weekend on 25.12. length 2 days
+small "Silvester" on 31.12.
diff --git a/libkholidays/holidays/holiday_dk b/libkholidays/holidays/holiday_dk
new file mode 100644
index 000000000..cab02bbfe
--- /dev/null
+++ b/libkholidays/holidays/holiday_dk
@@ -0,0 +1,59 @@
+:
+: Danish holiday file.
+: (colors edited by thomas@bitrot.in-berlin.de)
+:
+: Helligdage
+"Hellig tre Konger" on 6.1
+weekend "Fastelavn" weekend on easter minus 49 days
+weekend "Palme søndag" weekend on easter minus 7 days
+weekend "Skærtorsdag" weekend on easter minus 3 days
+weekend "Langfredag" weekend on easter minus 2 days
+weekend "Påskedag" weekend on easter
+weekend "2. Påskedag" weekend on easter plus 1 day
+weekend "Store bededag" weekend on easter plus 26 days
+weekend "Kristi himmelfart" weekend on easter plus 39 days
+weekend "Pinsedag" weekend on easter plus 49 days
+weekend "2. Pinsedag" weekend on easter plus 50 days
+"Skt. Hans dag" on 24.6
+"Mortensdag" on 11.11
+weekend "Juleaftensdag" weekend on 24.12
+weekend "Juledag" weekend on 25.12
+weekend "2. Juledag" weekend on 26.12
+weekend "1. Advent" weekend on sunday before 24.12 minus 21 days
+weekend "2. Advent" weekend on sunday before 24.12 minus 14 days
+weekend "3. Advent" weekend on sunday before 24.12 minus 7 days
+weekend "4. Advent" weekend on sunday before 24.12
+:
+: Nationle fridage
+weekend "Nytårsdag" weekend on 1.1
+weekend "Grundlovsdag/Fars dag" weekend on 5.6
+:
+: Nationale mærkedage
+"Kampen ved Myslunde 1864" on 2.2
+"Stormen på København 1659" on second tuesday in february
+"Slaget på reden 1801" on 2.4
+"Danmarks Besættelse 1940" on 9.4
+"Slaget ved Dybbøl 1864" on 18.4
+"Danmarks befrielse 1945" on 5.5
+"Kampen ved Helgoland 1864" on 9.5
+"Valdemarsdag/Genforeningsdag" on 15.6
+"Slaget ved Fredericia 1849" on 6.7
+"Slaget ved Isted 1850" on 25.7
+"Stormen på Frederiksstad 1850" on 4.10
+"FN-dag" on 24.10
+:
+: Royale fødselsdage
+"Kronprinsesse Mary" on 5.2
+"Dronning Margrete II" on 16.4
+"Prinsesse Benedikte" on 29.4
+"Kronprins Frederik" on 26.5
+"Prins Joachim" on 7.6
+"Prins Henrik" on 11.6
+"Prinsesse Alexandra" on 30.6
+"Prins Felix" on 22.7
+"Prins Nikolai" on 28.8
+:
+: Andet
+small blue "Sommertid" on last sunday in march
+small blue "Vintertid" on last sunday in october
+"Mors dag" on second sunday in may
diff --git a/libkholidays/holidays/holiday_ee b/libkholidays/holidays/holiday_ee
new file mode 100644
index 000000000..fbb260d01
--- /dev/null
+++ b/libkholidays/holidays/holiday_ee
@@ -0,0 +1,38 @@
+: Estonian holiday file. Copy to ~/.holiday
+:
+: Author: Hasso Tepper <hasso@estpak.ee>
+
+: Rahvuslik püha
+red "Iseseisvuspäev" on 24 february
+
+: Riigipühad
+red "Uusaasta" on 1 january
+red "Kevadpüha" on 1 may
+red "Võidupüha" on 23 june
+red "Jaanipäev" on 24 june
+red "Taasiseseisvumispäev" on 20 august
+red "Esimene jõulupüha" on 25 december
+red "Teine jõulupüha" on 26 december
+
+red "Suur reede" on easter minus 2 days
+red "Ülestõusmispühade 1. püha" on easter
+red "Nelipühade 1. püha" on easter plus 49 days
+
+: Riiklikud tähtpäevad
+blue "Kolmekuningapäev" on 6 january
+blue "Tartu rahulepingu aastapäev" on 2 february
+blue "Emakeelepäev" on 14 march
+blue "Emadepäev" on second sunday in may
+blue "Leinapäev" on 14 june
+blue "Hingedepäev" on 2 november
+blue "Isadepäev" on second sunday in november
+blue "Taassünnipäev" on 16 november
+
+: Muud tähtpäevad
+blue "Naistepäev" on 8 march
+
+red "1. advent" on sunday before 24 december minus 21 days
+red "2. advent" on sunday before 24 december minus 14 days
+red "3. advent" on sunday before 24 december minus 7 days
+red "4. advent" on sunday before 24 december
+
diff --git a/libkholidays/holidays/holiday_es b/libkholidays/holidays/holiday_es
new file mode 100644
index 000000000..196bbab73
--- /dev/null
+++ b/libkholidays/holidays/holiday_es
@@ -0,0 +1,88 @@
+:
+: holiday_es -- Defines spanish holidays
+:
+: For corrections, comments, etc., write to kde-es@kybs.de
+: Para correcciones, comentarios, etc., escriba a kde-es@kybs.de
+
+::
+:: Holidays in all parts of Spain
+::
+: http://www.mtas.es/infpuntual/Fiestas2005/caracteristicas.htm
+: «se respetarán como fiestas de ámbito nacional las de
+: la Natividad del Señor,
+: Año Nuevo,
+: 1 de Mayo como fiesta del Trabajo,
+: y 12 de Octubre como fiesta Nacional de España.»
+"Año nuevo" weekend on january 1
+"Fiesta del Trabajo" weekend on may 1
+"Fiesta Nacional de España" weekend on october 12
+"Natividad del Señor" weekend on december 25
+
+: http://www.mtas.es/infpuntual/Fiestas2005/RES061004.htm
+: «Fiesta Nacional no sustituible»
+"Asunción de la Virgen" weekend on august 15
+"Todos los Santos" weekend on november 1
+"Día de la Constitución Española" weekend on december 6
+"La Inmaculada Concepción" weekend on december 8
+
+: http://www.mtas.es/infpuntual/Fiestas2005/RES061004.htm
+: «Fiesta Nacional respecto de la que no se ha ejercido la facultad
+: de sustitución.»
+"Epifanía del Señor" weekend on january 6
+small "San Esteban" on december 26
+
+
+::
+:: Easter related
+::
+small "Jueves Santo" on easter minus 3 days
+"Viernes Santo" weekend on easter minus 2 days
+small "Lunes de Pascua" on easter plus 1 day
+small "Pentecostes / 2º Pascua" on easter plus 50 days
+
+
+::
+:: Holidays of the autonomic communities
+::
+small "Día de Andalucía" on february 28
+
+small "Día de las Islas Baleares" on march 1
+small "San José" on march 19
+
+small "Sant Jordi" on april 23
+small "Fiesta de la Comunidad de Castilla y León" on april 23
+small "Día de Aragón" on april 23
+
+small "Fiesta de la Comunidad de Madrid" on may 3
+small "Día de las Letras Gallegas" on may 17
+small "Día de Canarias" on may 30
+small "Día de la Región de Castilla y la Mancha" on may 31
+
+small "Día de la Región de Murcia" on june 9
+small "Día de la Rioja" on june 9
+small "San Juan" on june 24
+
+small "Santiago Apóstol" on july 25
+small "Día de las Instituciones" on july 28
+
+small "Día de la Ciudad Autónoma de Ceuta" on september 2
+small "Día de Asturias" on september 8
+small "Día de Extremadura" on september 8
+small "Diada de Cataluña" on september 11
+small "Ntra. Sra. de la Bien Aparecida" on september 15
+
+
+::
+:: Daylight saving time
+::
+small "Adelanto horario" on last sunday in march
+small "Retraso horario" on last sunday in october
+
+
+::
+:: Seasons
+::
+small "Equinoccio e inicio de primavera" on march 21
+small "Solsticio e inicio de verano" on june 21
+small "Equinoccio e inicio de otoño" on september 23
+small "Solsticio e inicio de invierno" on december 21
diff --git a/libkholidays/holidays/holiday_fi b/libkholidays/holidays/holiday_fi
new file mode 100644
index 000000000..6f05cd75a
--- /dev/null
+++ b/libkholidays/holidays/holiday_fi
@@ -0,0 +1,82 @@
+: Finnish holiday file. Copy to ~/.holiday
+:
+: Author: Steven Wahlberg <stegu@iki.fi>
+:
+: $Id$
+
+: pääsiäisen määräämät
+red "Laskiaissunnuntai" on easter minus 49 days
+red "Laskiaistiistai" on easter minus 47 days
+red "Marianpäivä" on easter minus 14 days
+red "Palmusunnuntai" on easter minus 7 days
+red "Pitkäperjantai" weekend on easter minus 2 days
+red "Pääsiäinen" weekend on easter
+red "2. pääsiäispäivä" weekend on easter plus 1 days
+red "Rukoussunnnuntai" weekend on easter plus 35 days
+red "Helatorstai" weekend on easter plus 39 days
+red "Helluntaipäivä" on easter plus 49 days
+
+: Kaikki muut
+blue "Uudenvuodenpäivä" weekend on 1 january
+red "Loppiainen" weekend on 6 january
+
+blue "Runebergin päivä" on 5 february
+blue "Ystävänpäivä" on 14 february
+: karkauspäivä vain karkausvuotena. Kuinka määritellään plan:lle?
+: blue "Karkauspäivä" on 29 february minus 5 days
+blue "Karkauspäivä" on 24 february 1964
+blue "Karkauspäivä" on 24 february 1968
+blue "Karkauspäivä" on 24 february 1972
+blue "Karkauspäivä" on 24 february 1976
+blue "Karkauspäivä" on 24 february 1980
+blue "Karkauspäivä" on 24 february 1984
+blue "Karkauspäivä" on 24 february 1988
+blue "Karkauspäivä" on 24 february 1992
+blue "Karkauspäivä" on 24 february 1996
+blue "Karkauspäivä" on 24 february 2000
+blue "Karkauspäivä" on 24 february 2004
+blue "Karkauspäivä" on 24 february 2008
+blue "Karkauspäivä" on 24 february 2012
+blue "Karkauspäivä" on 24 february 2016
+blue "Karkauspäivä" on 24 february 2020
+blue "Karkauspäivä" on 24 february 2024
+blue "Karkauspäivä" on 24 february 2028
+blue "Karkauspäivä" on 24 february 2032
+blue "Karkauspäivä" on 24 february 2036
+blue "Karkauspäivä" on 24 february 2040
+blue "Kalevalan päivä" on 28 february
+
+blue "Naistenpäivä" on 8 march
+cyan "Kesäaika alkaa (+1)" on last sunday in march
+
+blue "Agricolan päivä" on 9 april
+blue "Veteraanipäivä" on 27 april
+
+blue "Vappu" weekend on 1 may
+blue "Äitienpäivä" on second sunday in may
+blue "Snellmanin päivä" on 12 may
+blue "Kaatuneiden muistopäivä" on third sunday in may
+
+blue "Puolustusvoimien lippujuhla" on 4 june
+blue "Juhannuspäivä" weekend on saturday after 20 june
+
+blue "Eino Leinon päivä" on 6 july
+blue "Unikeonpäivä" on 27 july
+
+blue "Kansainvälinen lasten päivä" on 7 october
+blue "Aleksis Kiven päivä" on 10 october
+blue "YK:n päivä" on 24 october
+cyan "Kesäaika päättyy (-1)" on last sunday in october
+
+red "Pyhäinpäivä" weekend on first saturday in november
+blue "Svenska dagen" on 6 november
+blue "Isänpäivä" on second sunday in november
+
+red "1. adventtisunnuntai" on sunday before 24 december minus 21 days
+red "2. adventtisunnuntai" on sunday before 24 december minus 14 days
+red "3. adventtisunnuntai" on sunday before 24 december minus 7 days
+red "4. adventtisunnuntai" on sunday before 24 december
+blue "Itsenäisyyspäivä" weekend on 6 december
+red "Joulupäivä" weekend on 25 december
+red "Tapaninpäivä" weekend on 26 december
+blue "Viattomien lasten päivä" on 28 december
diff --git a/libkholidays/holidays/holiday_fr b/libkholidays/holidays/holiday_fr
new file mode 100644
index 000000000..f46d21685
--- /dev/null
+++ b/libkholidays/holidays/holiday_fr
@@ -0,0 +1,29 @@
+:
+: French holiday file. Copy to ~/.holiday
+:
+: en vert les saisons
+: en bleu (texte) et rouge (jour) les jours ferie's
+: en cyan d'autres fetes non ferie'es ou dimanche
+: Je suis pas sur pour les fetes des peres et des meres
+:
+: Author: Jean-Claude Giese <giese@loria.fr>
+:
+blue "Jour de l'An" weekend on 1.1.
+cyan "Epiphanie" on first sunday in january
+green "Printemps" on 20.3.
+blue "Pâques" weekend on easter length 2 days
+blue "Pentecôte" weekend on easter plus 49 days length 2 days
+blue "Ascension" weekend on easter plus 39 days
+blue "Fête du travail" weekend on 1.5.
+blue "Armistice 1945" weekend on 8.5.
+green "Eté" on 21.6.
+blue "Fête Nationale" weekend on 14.7.
+blue "Assomption" weekend on 15.8.
+cyan "Fête des mères" on last sunday in may
+cyan "Fête des pères" on third sunday in june
+green "Automne" on 23.9.
+blue "Toussaint" weekend on 1.11.
+blue "Armistice 1918" weekend on 11.11.
+green "Hiver" on 21.12.
+blue "Noël" weekend on 25.12.
+cyan "St Sylvestre" on 31.12.
diff --git a/libkholidays/holidays/holiday_frswiss b/libkholidays/holidays/holiday_frswiss
new file mode 100644
index 000000000..79c1380cd
--- /dev/null
+++ b/libkholidays/holidays/holiday_frswiss
@@ -0,0 +1,17 @@
+:
+: Swiss holiday file. Copy to ~/.holiday
+: Use this as a starting point, some holidays are missing, and some listed
+: here are largely irrelevant.
+:
+: Author: Christian Iseli
+:
+red "Nouvel-An" weekend on 1/1
+red "Vendredi Saint" weekend on easter minus 2 days
+red "Paques" weekend on easter
+red "Ascension" weekend on easter plus 39 days
+red "Pentecote" weekend on easter plus 49 days
+red "L. de Pentecote" weekend on easter plus 50 days
+red "Noel" weekend on 12/25
+red "Premier Aout" weekend on august 1
+red "Jeune Federal" weekend third sunday in september
+red "Lundi du Jeune" weekend third sunday in september plus 1 day
diff --git a/libkholidays/holidays/holiday_gb b/libkholidays/holidays/holiday_gb
new file mode 100644
index 000000000..0347f8dc5
--- /dev/null
+++ b/libkholidays/holidays/holiday_gb
@@ -0,0 +1,14 @@
+:
+: England & Wales holiday file. Copy to ~/.holiday
+:
+: Author: Peter Lord <plord@uel.co.uk>
+:
+"New Years Day" red on 1/1
+"Easter Sunday" red on easter
+"Good Friday" red on easter minus 2
+"Easter Monday" red on easter plus 1
+"May Day" red on first monday in may
+"Spring Bank Holiday" red on last monday in may
+"Summer Bank Holiday" red on last monday in august
+"Christmas Day" red on 12/25
+"Boxing Day" red on 12/26
diff --git a/libkholidays/holidays/holiday_gr b/libkholidays/holidays/holiday_gr
new file mode 100644
index 000000000..80257850f
--- /dev/null
+++ b/libkholidays/holidays/holiday_gr
@@ -0,0 +1,309 @@
+:
+: Greek holiday file.
+:
+: Author: capthookb (praktoreio2002@yahoo.gr)
+:
+: "weekend" or "red" indicate a "proper" holiday (i.e. you do not work)
+: Other colours (black, green, yellow, blue, magenta, cyan, white)
+: can be used to distinguish between minor anniversaries or not-so-real
+: holidays, when you go working anyway.
+: "small" holidays are not as "invasive" in the month view in KOrganizer,
+: and do not take as much space.
+
+: Ονομαστικές εορτές
+
+small black "Βασίλης, Βασιλική, Βασιλεία, Βίβιαν" on 1.1
+small black "Συλβέστρος" on 2.1
+small black "Θεώνη" on 5.1
+small black "Άγια Θεοφάνεια (Αργία)" on 6.1
+small black "Φώτης, Φωτεινή, Θεοφάνης, Θεοφανία, Φανή, Ιορδάνης, Θεανώ, Ουρανία, Θεοπούλα" on 6.1
+small black "Ιωάννης, Ιωάννα, Πρόδρομος" on 7.1
+small black "Αγάθων, Δομινίκη, Παρθένα, Κύρος" on 8.1
+small black "Θεοδόσης, Θεοδοσία" on 11.1
+small black "Τατιάνα, Τατιανή" on 12.1
+small black "Αντώνης, Αντωνία" on 17.1
+small black "Αθανάσιος, Αθανασία, Κύριλλος" on 18.1
+small black "Μακάριος" on 19.1
+small black "Ευθύμης, Ευθυμία, Φαβιανός" on 20.1
+small black "Αγνή, Μάξιμος, Νεόφυτος, Πάτροκλος" on 21.1
+small black "Τιμόθεος, Αναστάσιος, Αναστασία" on 22.1
+small black "Αγαθάγγελος" on 23.1
+small black "Ξένη, Φίλωνας, Ζωσιμάς" on 24.1
+small black "Γρηγόρης, Γρηγορία, Μαργαρίτα" on 25.1
+small black "Ξενοφών" on 26.1
+small black "Χάρις, Παλλάδιος" on 28.1
+small black "Μαύρος, Χρυσή, Τριών Ιεραρχών (Σχολική Αργία)" on 30.1
+small black "Ευδοξία, Κύρος" on 31.1
+small black "Τρύφωνας" on 1.2
+small black "Υπαπαντή" on 2.2
+small black "Σταμάτ-ης/ία, Συμεώ-ν/νή, Σιμώνη, Ασημάκης, Ασημίνα, Μαλαματή" on 3.2
+small black "Ισίδωρος, Ιάσιμος, Ιασίμη" on 4.2
+small black "Αγαθή" on 5.2
+small black "Φώτης" on 6.2
+small black "Παρθένιος, Παρθενία" on 7.2
+small black "Ζαχαρίας, Ζαχαρούλα" on 8.2
+small black "Μάρκελος, Νικηφόρος, Νίκη" on 9.2
+small black "Χαράλαμπος, Χαραλαμπία, Χαρίκλεια, Χαρίλαος, Χαρούλα" on 10.2
+small black "Βλάσης, Βλασία, Θοδωρής, Θοδώρα, Αυγή " on 11.2
+small black "Μελέτης, Πλωτίνος" on 12.2
+small black "Πρίσκιλλα" on 13.2
+small black "Βαλεντίνος, Βαλεντίνη, Παγκόσμια Ημέρα Ερωτευμένων" on 14.2
+small black "Ευσέβιος, Ευσεβία" on 15.2
+small black "Πάμφιλος, Παμφίλη, Σέλευκος, Σελεύκη" on 16.2
+small black "Λέων, Αγαπητός" on 18.2
+small black "Φιλοθέη, Χλόη" on 19.2
+small black "Ανθούσα" on 22.2
+small black "Πολύκαρπος" on 23.2
+small black "Πορφύρης, Φωτεινή" on 26.2
+small black "Μαριάννα, Ασκληπιός" on 28.2
+small black "Ευδοκία, Χαρίσιος" on 1.3
+small black "Ευθαλία" on 2.3
+small black "Κλεόνικος, Κλεονίκη" on 3.3
+small black "Αρχέλαος, Eυλόγιος" on 5.3
+small black "Ησύχιος" on 6.3
+small black "Ευγένιος, Ευγενία" on 7.3
+small black "Ερμής, Θεοφύλακτος, Παγκόσμια Ημέρα της Γυναίκας" on 8.3
+small black "Σμάραγδος, Σμαράγδα, Ηλιάνα, Λεόντιος, Λεοντία, Λυσίμαχος Λυσιμαχη" on 9.3
+small black "Ξάνθος, Ξανθούλα, Σαράντης Σαραντούλα, Φιλοκτήμων" on 9.3
+small black "Θεόδωρος Θεοδώρα, Θώδος, Θώδη, Θαλλής, Θάλεια, Σωφρόνιος, Σωφρονία" on 11.3
+small black "Λωξάντρα, Ρωξάνη, Oρθοδόξης," on 12.3
+small black "Λέανδρος" on 13.3
+small black "Βενέδικτος, Βενεδίκτη" on 14.3
+small black "Αγάπιος" on 15.3
+small black "Χριστόδουλος, Ιουλιανός" on 16.3
+small black "Αλέξιος, Αλεξία" on 17.3
+small black "Χρύσανθος, Χρυσάνθη" on 19.3
+small black "Δρόσος, Δροσούλα" on 22.3
+small black "Ευαγγελισμός της Θεοτόκου " on 25.3
+small black "Ευάγγελος, Ευαγγελία" on 25.3
+small black "Πούλιος, Σύλας, Σύλια" on 26.3
+small black "Λυδία, Μακεδόνιος, Μακεδονούλα" on 27.3
+small black "Ευτύχιος, Ευτυχία" on 6.4
+small black "Ιωσήφ, Ιωσηφίνα" on 9.4
+small black "Δημοσθένης, Ηρακλής, Μιλτιάδης, Περικλής, Σοφοκλής, Επαμεινώνδας" on 10.4
+small black "Όμηρος, Πελοπίδας, Παρμενίων, Πολύβιος, Αναξιμένης, Φοιλοποίμην, Φίλης" on 10.4
+small black "Αρίσταρχος, Θωμαΐς" on 14.4
+small black "Λεωνίδας, Λάζαρος" on 15.4
+small black "Βάϊος, Βάϊα, Δάφνη, Γαλήνη, Χιονία" on 16.4
+small black "Ναθαναήλ, Νέαρχος, Νιάρχος" on 22.4
+small black "Αναστάσιος, Αναστασία, Λάμπρος, Λαμπρινή, Πασχάλης " on 23.4
+small black "Γεώργιος, Γεωργία, Ελισάβετ, Αχιλλέας" on 24.4
+small black "Μάρκος, Νίκη, Ραφαήλ" on 25.4
+small black "Ζωή, Πηγή" on 28.4
+small black "Ιάσωνας" on 29.4
+small black "Ιάκωβος, Θωμάς, Θωμαή, Ασημίνα" on 30.4
+weekend "Ιερεμίας" on 1.5
+small black "Έσπερος, Εσπέρια" on 2.5
+small black "Ροδόπη" on 3.5
+small black "Ειρήνη, Eιρηναίος, Ευφραίμ" on 5.5
+small black "Μυροφόρα" on 7.5
+small black "Θεολόγος" on 8.5
+small black "Χριστόφορος, Ησαΐας" on 9.5
+small black "Σίμων" on 10.5
+small black "Aρμόδιος,Μεθόδιος, Ολυμπία" on 11.5
+small black "Επιφάνειος" on 12.5
+small black "Γλυκερία" on 13.5
+small black "Γιορτή της Μητέρας, Αριστοτέλης" on 14.5
+small black "Καλή" on 15.5
+small black "Ανδρόνικος, Ανδρονίκη, Ιουνία" on 17.5
+small black "Ιουλία, Γαλάτεια" on 18.5
+small black "Θεόκτιστος, Μαγδαληνή, Πατρίκιος" on 19.5
+small black "Λυδία" on 20.5
+small black "Κωνσταντίνος, Κωνσταντίνα, Ελένη" on 21.5
+small black "Αιμίλιος, Αιμιλία, Έμυ" on 22.5
+small black "Μαρκιανή" on 24.5
+small black "Θεοδοσία" on 29.5
+small black "Πύρρος, Νεφέλη, Ιουστίνος, Ανάληψη" on 1.6
+small black "Νικηφόρος, Μαρίνος" on 2.6
+small black "Υπάτιος, Υπατία" on 3.6
+small black "Μάρθα" on 4.6
+small black "Aπόλλων, Δωρόθεος, Δωροθέα, Σελήνη, Νίκανδρος" on 5.6
+small black "Καλλιόπη" on 8.6
+small black "Ροδάνθη" on 9.6
+small black "Βαρθολομαίος, Βαρνάβας" on 11.6
+small black "Ονούφριος, Ζήνων,Κορίνα, Αγίου Πνεύματος" on 12.6
+small black "Ελισαίος" on 14.6
+small black "Αυγουστίνος, Αυγούστα, Ιερώνυμος, Μόνικα, Ορτανσία" on 15.6
+small black "Γιορτή του πατέρα" on 16.6
+small black "Έρασμος, Ερασμία, Aγίων Πάντων" on 18.6
+small black "Παΐσιος, Ζωσιμάς, Ζήσης" on 19.6
+small black "Ευσέβιος, Ευσεβία" on 22.6
+small black "Αριστοκλής" on 23.6
+small black "Φεβρωνία, Έρωτας" on 25.6
+small black "Γερμανός" on 28.6
+small black "Πέτρος, Πέτρα, Παύλος, Παυλίνα" on 29.6
+small black "Απόστολος, Αποστολία, Μελίτων" on 30.6
+small black "Αργύρης, Αργυρώ, Κοσμάς, Δαμιανός, Ανάργυρος" on 1.7
+small black "Υάκινθος, Ζουμπουλία" on 3.7
+small black "Λουκία" on 4.7
+small black "Λυκίας, Λύκιος, Λυκία, " on 6.7
+small black "Κυριακή" on 7.7
+small black "Θεόφιλος, Προκόπιος" on 8.7
+small black "Ευφημία, Όλγα" on 11.7
+small black "Βερονίκη, Βερενίκη " on 12.7
+small black "Σάρα" on 13.7
+small black "Ακύλας, Νικόδημος" on 14.7
+small black "Βλαδίμηρος, Ιουλίττα, Κήρυκος" on 15.7
+small black "Μαρίνα" on 17.7
+small black "Αιμίλιος, Αιμιλία" on 18.7
+small black "Ηλίας, Ηλιάνα" on 20.7
+small black "Μαγδαληνή, Μαρκέλλα, Μαριλένα" on 22.7
+small black "Φωκάς" on 23.7
+small black "Αθηναγόρας" on 24.7
+small black "Άννα, Ολυμπία" on 25.7
+small black "Παρασκευή, Παρασκευάς, Έρση" on 26.7
+small black "Παντελής" on 27.7
+small black "Ειρήνη, Χρυσοβαλάντης, Βαλάντης, Χρυσοβαλάντου, Ακάκιος" on 28.7
+small black "Καλλίνικος" on 29.7
+small black "Ανδρόνικος, Ανδρονίκη" on 30.7
+small black "Ιωσήφ, Ιωσηφίνα" on 31.7
+small black "Μάρκελος" on 1.8
+small black "Σωτήρης, Σωτηρία, Ευμορφία, Έμμυ, Μορφούλα" on 6.8
+small black "Αστέριος, Αστερία" on 7.8
+small black "Τριαντάφυλλος, Τριανταφυλλιά" on 8.8
+small black "Ρωμανός" on 9.8
+small black "Λαυρέντης, Λαυρεντία, Ευλαμπία, Ιππόλυτος, Ηρώ " on 10.8
+weekend "Κοίμηση της Θεοτόκου (Αργία)" on 15.8
+weekend "Μαρία, Μάριος, Παναγιώτης, Παναγιώτα, Δέσποινα, Θεοτόκης" on 15.8
+small black "Γεράσιμος, Αλκιβιάδης, Διομήδης, Σαράντης" on 16.8
+small black "Λευκοθέα, Μύρων, Μίρκα" on 17.8
+small black "Φλώρα" on 18.8
+small black "Σαμουήλ, Θεοχάρης" on 20.8
+small black "Aγαθόνικος" on 22.8
+small black "Κοσμάς" on 24.8
+small black "Βαρθολομαίος, Τίτος" on 25.8
+small black "Ναταλία, Ανδριανός, Ανδριανή" on 26.8
+small black "Φανούριος, Φανουρία, Αρκαδία" on 27.8
+small black "Θεοπίστη" on 29.8
+small black "Αλέξανδρος" on 30.8
+small black "Αδαμάντιος, Αδαμαντία, Αθηνά, Αντιγόνη, Ασπασία, Αφροδίτη, Δωδώνη" on 1.9
+small black "Ελπινίκη, Ερασμία, Ερατώ, Ευτέρπη, Θάλεια, Θεανώ, Καλλίστη, Κλειώ, Κλεονίκη" on 1.9
+small black "Κλεοπάτρα, Κοραλία, Μαργαρίτα, Μαριάνθη, Μελέτιος, Μελπομένη, Ουρανία" on 1.9
+small black "Πανδώρα, Πηνελόπη, Πολυμνία, Πολυνίκη, Σαπφώ, Συμεών, Τερψιχόρη, Χάιδω" on 1.9
+small black "Άνθιμος, Πολύδωρος, Φοίβη" on 3.9
+small black "Ερμιόνη, Μωυσής" on 4.9
+small black "Ζαχαρίας" on 5.9
+small black "Κασσιανή, Σώζων" on 7.9
+small black "Ιωακείμ" on 9.9
+small black "Εράστη, Εράστος, Μητροδώρα, Πουλχερία" on 10.9
+small black "Ευανθία" on 11.9
+small black "Αριστείδης, Κορνήλιος" on 13.9
+small black "Σταύρος, Σταυρούλα" on 14.9
+small black "Νικήτας, Βησσαρίων" on 15.9
+small black "Ευφημία" on 16.9
+small black "Σοφία, Ελπίδα, Αγάπη, Πίστη, Σόνια" on 17.9
+small black "Αριάδνη" on 18.9
+small black "Ευστάθιος, Ευσταθία" on 20.9
+small black "Ίωνας" on 21.9
+small black "Φωκάς, Ζωγραφιά" on 22.9
+small black "Πολυξένη, Ξανθίππη, Ξάνθιππος" on 23.9
+small black "Θέκλα, Μυρσίνη, Μυρτώ" on 24.9
+small black "Ευφροσύνη" on 25.9
+small black "Ζήνων" on 27.9
+small black "Κυριάκος, Κυριακή" on 29.9
+small black "Θηρεσία" on 1.10
+small black "Κυπριανός" on 2.10
+small black "Διονύσης, Διονυσία" on 3.10
+small black "Ιερόθεος, Φραγκίσκος" on 4.10
+small black "Χαριτινή" on 5.10
+small black "Σέργιος, Πολυχρόνης, Χρόνης" on 7.10
+small black "Πελαγία" on 8.10
+small black "Ευλάμπιος, Ευλαμπία" on 10.10
+small black "Ανδρομάχη, Ανδρόμαχος" on 12.10
+small black "Αγαθονίκη, Φλωρέντιος, Φλωρεντία" on 13.10
+small black "Λουκιανός" on 15.10
+small black "Λουκάς" on 18.10
+small black "Γεράσιμος, Αρτέμιος" on 20.10
+small black "Σωκράτης, Χριστόδουλος, Όυρσουλα" on 21.10
+small black "Αβέρκιος" on 22.10
+small black "Ιάκωβος" on 23.10
+small black "Χρυσάφης" on 25.10
+small black "Δημήτριος, Δήμητρα, Δανάη" on 26.10
+small black "Νέστορας" on 27.10
+small black "Ζηνοβία, Κλεόπας, Μαρκιανός" on 30.10
+small black "Αριστόβουλος" on 31.10
+small black "Αργύρης, Αργυρώ, Κοσμάς, Δαμιανός, Ανάργυρος" on 1.11
+small black "Αφθόνιος, Αφθονία" on 2.11
+small black "Ιωαννίκη" on 4.11
+small black "Λίνος" on 5.11
+small black "Λεονάρδος" on 6.11
+small black "Αθηνόδωρος" on 7.11
+small black "Σταμάτιος, Σταματία, Μιχάλης, Γαβριήλ, Γαβριέλα" on 8.11
+small black "Ταξιάρχης, Άγγελος, Αγγελική, Ματίνα, Σεραφείμ" on 8.11
+small black "Νεκτάριος, Νεκταρία" on 9.11
+small black "Ορέστης" on 10.11
+small black "Μηνάς, Mήνα, Βίκτωρ, Βικτωρία" on 11.11
+small black "Χρυσόστομος" on 13.11
+small black "Φίλιππος" on 14.11
+small black "Ματθαίος, Ιφιγένεια" on 16.11
+small black "Πλάτωνας" on 18.11
+small black "Μαρία, Μάριος" on 21.11
+small black "Φιλήμων" on 22.11
+small black "Μερώπη" on 23.11
+small black "Κατερίνα, Μερκούριος" on 25.11
+small black "Στέλιος, Στέλλα, Στέργιος" on 26.11
+small black "Φαίδρα" on 29.11
+small black "Ανδρέας, Ανδριάνα" on 30.11
+small black "Θεόκλητος, Ιακώβ" on 1.12
+small black "Βαρβάρα, Δαμασκηνός" on 4.12
+small black "Σάββας, Σαββούλα, Διογένης" on 5.12
+small black "Νίκος, Νικολέττα" on 6.12
+small black "Αμβρόσιος" on 7.12
+small black "Άννα" on 9.12
+small black "Ααρών, Αδάμ, Δαυίδ, Δανάη, Εύα, Ισαάκ, Ιώβ, Ραχήλ, Ρουμπίνη" on 11.12
+small black "Σπύρος, Σπυριδούλα" on 12.12
+small black "Ευστράτιος, Λουκάς, Λουκία, Άρης" on 13.12
+small black "Ελευθέριος, Ελευθερία, Ανθή, Σύλβια" on 15.12
+small black "Διονύσης, Διονυσία, Δανιήλ, Ρεβέκα, Σεβαστιανός, Σεβαστή" on 17.12
+small black "Ααρών, Αδάμ, Ισαάκ, Ραχήλ, Σάρα" on 17.12
+small black "Αγλαΐα" on 19.12
+small black "Ιγνάτιος" on 20.12
+small black "Θεμιστοκλής, Ιουλία" on 21.12
+small black "Αναστασία" on 22.12
+small black "Ευγένιος, Ευγενία" on 24.12
+small black "Χρήστος, Χριστίνα, Χρύσα" on 25.12
+weekend "Σύναξις Θεοτόκου (Αργία)" on 26.12
+weekend "Μανώλης, Εμμανουέλα, Δαβίδ" on 26.12
+small black "Στέφανος, Στεφανία" on 27.12
+small black "Δόμνα" on 28.12
+small black "Ιωσήφ" on 30.12
+weekend "Χριστούγεννα (Αργία)" on 25.12
+
+
+: Αργίες - Επέτειοι
+weekend "Πρωτοχρονιά (Αργία)" on 1.1
+weekend "Πρωτομαγιά (Αργία)" on 1.5
+weekend "Επέτειος του ΟΧΙ (Αργία)" 28.10
+weekend "Επέτειος της επανάστασης του 1821 (Αργία)" on 25.3
+small black "Εξέγερση του Πολυτεχνείου (Σχολική Αργία)" on 17.11
+
+: Κινητές εορτές
+
+small black "Τελώνου και Φαρισαίου - Αρχή Τριωδίου" on pascha minus 70 days
+small black "Του Ασώτου" on pascha minus 63 days
+small black "Τσικνοπέμπτη" on pascha minus 59 days
+small black "Κυριακή των Απόκρεω" on pascha minus 56 days
+small black "Τυροφάγου" on pascha minus 49 days
+small black "Καθαρή Δευτέρα (Αργία)" on pascha minus 48 days
+small black "Θεόδωρος, Θεοδώρα, Δώρα, Θώδης, Θώδος, Δώρης" on pascha minus 43 days
+small black "Κυριακή της Ορθοδοξίας" on pascha minus 42 days
+small black "Σάββατο του Λαζάρου" on pascha minus 8 days
+small black "Κυριακή των Βαΐων" on pascha minus 7 days
+small black "Μεγάλη Δευτέρα" on pascha minus 6 days
+small black "Μεγάλη Τρίτη" on pascha minus 5 days
+small black "Μεγάλη Τετάρτη" on pascha minus 4 days
+small black "Μεγάλη Πέμπτη" on pascha minus 3 days
+weekend "Μεγάλη Παρασκευή (Αργία)" on pascha minus 2 days
+weekend "Μεγάλο Σάββατο" on pascha minus 1 days
+weekend "Το Άγιον Πάσχα" on pascha
+weekend "Δευτέρα του Πάσχα (Αργία)" on pascha plus 1 days
+small black "Πηγή, Ζήσης, Ζησούλα, Ζήσιμος, Ζωή, Ζώης" on pascha plus 5 days
+small black "Του Θωμά" on pascha plus 7 days
+small black "Ανάληψη του Χριστού" on pascha plus 39 days
+small black "Πεντηκοστή" on pascha plus 49 days
+small black "Αγ. Πνεύματος" on pascha plus 50 days
+small black "Αγ. Πάντων" on pascha plus 56 days
+
+: Αλλαγή ώρας
+small black "Αλλαγή ώρας (1 ώρα πίσω)" on last sunday in october
+small black "Αλλαγή ώρας (1 ώρα μπροστά) " on last sunday in march
diff --git a/libkholidays/holidays/holiday_gt b/libkholidays/holidays/holiday_gt
new file mode 100644
index 000000000..844367cef
--- /dev/null
+++ b/libkholidays/holidays/holiday_gt
@@ -0,0 +1,35 @@
+:
+: Fichero holiday_guatemala. Cópialo a ~/.holiday
+: Modifica este fichero borrando y añadiendo lo que te parezca.
+:
+: Fiestas
+:
+red "Año nuevo" red on january 1
+red "Reyes" red on january 6
+red "Trabajo" red on march 19
+red "Ejército" red on may 1
+red "Virgen de la Asunción" red on august 15
+red "Independencia" red on september 15
+red "Revolucion de 1944" red on october 20
+red "Todos los Santos" red on november 1
+red "Nochebuena" red on december 24
+red "Navidad" red on december 25
+red "Fin de año" red on december 31
+:
+: Relacionados con la pascua
+:
+small "Jueves Santo" weekend on easter minus 3 days
+small "Viernes Santo" weekend on easter minus 2 days
+small "Pascua" weekend on easter
+small "Miércoles de ceniza" on easter minus 46 days
+small "Pentecostes" weekend on easter plus 49 days
+small "Ascension" on easter plus 39 days
+small "Trinidad" on easter plus 46 days
+small "Corpus Christi" on easter plus 60 days
+:
+: Estaciones
+:
+"Llega la Primavera" on march 20
+"Llega el Verano" on june 21
+"Llega el Otoño" on september 23
+"Llega el Invierno" on december 22
diff --git a/libkholidays/holidays/holiday_hu b/libkholidays/holidays/holiday_hu
new file mode 100644
index 000000000..0cdb5f14b
--- /dev/null
+++ b/libkholidays/holidays/holiday_hu
@@ -0,0 +1,26 @@
+:
+: Hungarian holidays
+: Kelemen Péter <fuji@heureka.inf.elte.hu>
+: Last modified on Jul 21 1997
+:
+: public holidays
+"Újév" weekend on 1/1
+"Nemzeti ünnep" weekend on 3/15
+"Húsvét" weekend on easter length 2 days
+"Pünkösd" weekend on easter plus 49 length 2 days
+"Munka ünnepe" weekend on 5/1
+"Szt. István, az államalapítás ünnepe" weekend on 8/20
+"Nemzeti ünnep" weekend on 10/23
+"Karácsony" weekend on 12/25 length 2 days
+
+: other events
+small "Vízkereszt" on 1/6
+small "Valentin" on 2/14
+small "Nônap" on 3/8
+small "Anyák napja" on first sunday in may
+small "Gyermeknap" on last sunday in may
+small "Szentivánéj" on 6/24
+small "Halottak napja" black on 10/31
+small "Mindenszentek napja" on 11/1
+small "Mikulás" on 12/6
+small "Szilveszter" on 12/31
diff --git a/libkholidays/holidays/holiday_ie b/libkholidays/holidays/holiday_ie
new file mode 100644
index 000000000..f489f9600
--- /dev/null
+++ b/libkholidays/holidays/holiday_ie
@@ -0,0 +1,16 @@
+:
+: Holiday file for Ireland.
+:
+: Author: CP Hennessy <CP.Hennessy@iname.com>
+:
+"New Years Day" red on 1/1
+"St Patricks Day (religious)" red on 3/17
+"Easter Sunday" red on easter
+"Good Friday" red on easter minus 2
+"Easter Monday" red on easter plus 1
+"May Day" red on first monday in may
+"Spring Bank Holiday" red on first monday in june
+"Summer Bank Holiday" red on first monday in august
+"October Bank Holiday" red on last monday in october
+"Christmas Day" red on 12/25
+"St Stephens Day" red on 12/26
diff --git a/libkholidays/holidays/holiday_il b/libkholidays/holidays/holiday_il
new file mode 100644
index 000000000..11243724e
--- /dev/null
+++ b/libkholidays/holidays/holiday_il
@@ -0,0 +1,72 @@
+:
+: Israeli holidays file for Korganizer
+: Author: Jonathan Singer (jsinger@leeta.net), 13/01/02
+: Author: Lior Chen <sliorc@t2.technion.ac.il>, 21/03/01
+:
+: (Note that these holidays are only relevant for the current year).
+:
+
+small "Fast: 10th of Tevet" on 5.1.01
+small "Tu BiShvat" on 8.02.01
+small "Fast: Ester" on 8.03.01
+small "Purim" on 9.3.01
+small "Passover" on 8.4.01
+small "Chol Hamoed" on 9.4.01 length 5
+small "2nd Passover" on 14.4.01
+small "Holocaust Rememberance day" on 19.4.01
+small "Memorial day for the IDF Soldiers" on 25.4.01
+small "Independence day" on 26.4.01
+small "Lag BaOmer" on 11.5.01
+small "Jerusalem day" on 21.5.01
+small "Shavuot" on 28.5.01
+small "Fast: 17th of Tamuz" on 08.07.01
+small "Fast: 9th of Av" on 29.07.01
+small "Rosh Hashana" on 18.9.01 length 2
+small "Fast: Gdalya" on 20.9.01
+small "Yom Kippur" on 27.9.01
+small "Succot" on 2.10.01
+small "Chol Hamoed Succot" on 3.10.01 length 6
+small "Simchat Torah" on 9.10.01
+
+small "Tu B'Shvat" on 28.01.02
+small "Fast: Esther" on 25.2.02
+small "Purim" on 26.2.02
+small "Passover" on 28.3.02
+small "Chol Hamoed" on 29.3.02 length 5
+small "2nd Passover" on 3.4.02
+small "Holocaust Remembrance day" on 9.4.02
+small "Memorial day for the IDF Soldiers" on 16.4.02
+small "Independence Day" on 17.4.02
+small "Lag BaOmer" on 30.4.02
+small "Jerusalem Day" on 10.5.02
+small "Shavuot" on 17.5.02
+small "Fast: 17th of Tamuz" on 27.6.02
+small "Fast: 9th of Av" on 18.07.02
+small "Rosh Hashana" on 7.9.02 length 2
+small "Fast: Gedalia" on 9.9.02
+small "Yom Kippur" on 16.9.02
+small "Succot" on 21.9.02
+small "Chol Hamoed Succot" on 22.9.02 length 6
+small "Simchat Torah" on 28.9.02
+small "Fast: 10th of Tevet" on 15.12.02
+
+small "Tu B'Shvat" on 18.01.03
+small "Fast: Esther" on 17.03.03
+small "Purim" on 18.3.03
+small "Passover" on 17.4.03
+small "Chol Hamoed" on 18.4.03 length 5
+small "2nd Passover" on 23.4.03
+small "Holocaust Remembrance day" on 29.4.03
+small "Memorial day for the IDF Soldiers" on 6.5.03
+small "Independence Day" on 7.5.03
+small "Lag BaOmer" on 20.5.03
+small "Jerusalem Day" on 30.5.03
+small "Shavuot" on 6.6.03
+small "Fast: 17th of Tamuz" on 17.07.03
+small "Fast: 9th of Av" on 7.08.03
+small "Rosh Hashana" on 27.9.03 length 2
+small "Fast: Gedalia" on 29.9.03
+small "Yom Kippur" on 6.10.03
+small "Succot" on 11.10.03
+small "Chol Hamoed Succot" on 12.10.03 length 6
+small "Simchat Torah" on 18.10.03
diff --git a/libkholidays/holidays/holiday_is b/libkholidays/holidays/holiday_is
new file mode 100644
index 000000000..a8312c612
--- /dev/null
+++ b/libkholidays/holidays/holiday_is
@@ -0,0 +1,60 @@
+:
+: ICELAND holiday file. Copy to ~/.holiday
+:
+: Author: Thorarinn R. Einarsson <thori@mindspring.com>
+:
+: Last updated on Feb. 3, 1999, by TRE.
+:
+: Special Icelandic dates
+:
+small blue "Fullveldisdagurinn" weekend on december 1
+small blue "Lýðveldisdagurinn" weekend on june 17
+small blue "Sumardagurinn fyrsti" weekend on thursday after april 18
+small blue "Frídagur verslunarmanna" weekend on monday after july 31
+small blue "Frídagur verkamanna" weekend on may 1
+small "Sjómannadagurinn" on sunday after may 31
+small "Jónsmessa" on june 24
+small "Hundadagar byrja" on july 13
+small "Hundadagar enda" on august 23
+
+: USA and World dates
+small "Þakkargjörðardagurinn (BNA)" on fourth thursday in november
+small "Alþjóðlegi ljóðadagurinn" on october 15
+small "Dagur Sameinuðu Þjóðanna" on october 24
+small "Halloween" on october 31
+small "Wright bræðra dagur" on december 17
+small "Valentínusardagur" on february 14
+small "St. Patrick dagur" on march 17
+
+: Christmas
+small "1. í Aðventu" weekend on sunday before december 25 minus 21
+small "2. í Aðventu" weekend on sunday before december 25 minus 14
+small "3. í Aðventu" weekend on sunday before december 25 minus 7
+small "4. í Aðventu" weekend on sunday before december 25
+small "Þorláksmessa" on december 23
+small blue "Aðfangadagur" weekend on december 24
+small blue "Jóladagur" weekend on december 25
+small blue "Annar í jólum" weekend on december 26
+small blue "Gamlársdagur" weekend on december 31
+small blue "Nýjársdagur" weekend on january 1
+
+: Easter related
+small "Pálmasunnudagur" weekend on easter minus 7 days
+small "Skírdagur" weekend on easter minus 3 days
+small "Föstudagurinn langi" weekend on easter minus 2 days
+small "Páskadagur" weekend on easter
+small "Annar í Páskum" weekend on easter plus 1 day
+small "Bolludagur" on easter minus 48 days
+small "Sprengidagur" on easter minus 47 days
+small "Öskudagur" on easter minus 46 days
+small "Hvítasunna" weekend on easter plus 49 days
+
+:small "Uppstigningardagur" on easter plus 40 days
+:small "Trinity" on easter plus 46 day
+:small "Corpus Christi" on easter plus 53 days
+
+: Seasons
+small "Vorjafndægur" on march 22
+small "Sumar sólstöður" on june 22
+small "Haustjafndægur" on september 22
+small "Vetrarsólstöður" on december 22
diff --git a/libkholidays/holidays/holiday_it b/libkholidays/holidays/holiday_it
new file mode 100644
index 000000000..2428122a4
--- /dev/null
+++ b/libkholidays/holidays/holiday_it
@@ -0,0 +1,64 @@
+:
+: Italian holiday file.
+: by Riccardo Scateni (riccardo@crs4.it)
+: Updated and maintained by the Italian l10n team (kde-i18n-it@kde.org)
+:
+: "weekend" or "red" indicate a "proper" holiday (i.e. you do not work)
+: Other colours (black, green, yellow, blue, magenta, cyan, white)
+: can be used to distinguish between minor anniversaries or not-so-real
+: holidays, when you go working anyway.
+: "small" holidays are not as "invasive" in the month view in KOrganizer,
+: and do not take as much space.
+
+: Religious holidays (default color for non-weekends: black)
+
+weekend "Epifania" on 6.1
+small black "San Giuseppe" on 19.3
+small black "Giovedì Grasso" on easter minus 52 days
+small black "Martedì Grasso" on easter minus 47 days
+small black "Mercoledì delle Ceneri" on easter minus 46 days
+small black "Prima di Quaresima" on easter minus 42 days
+small black "Seconda di Quaresima" on easter minus 35 days
+small black "Terza di Quaresima" on easter minus 28 days
+small black "Quarta di Quaresima" on easter minus 21 days
+small black "Quinta di Quaresima" on easter minus 14 days
+small black "Domenica delle Palme" on easter minus 7 days
+weekend "Pasqua" on easter
+weekend "Lunedì dell'Angelo" on easter plus 1 day
+small black "Ascensione" on easter plus 42 days
+small black "Pentecoste" on easter plus 49 days
+small black "Santissima Trinità" on easter plus 56 days
+small black "Corpus Domini" on easter plus 63 days
+small black "Sacro Cuore di Gesù" on easter plus 68 days
+small black "Santi Pietro e Paolo" on 29.6
+small black "San Francesco" on 4.10
+weekend "Ognissanti" on 1.11
+small black "Defunti" on 2.11
+weekend "Immacolata Concezione" on 8.12
+small black "Prima d'avvento" on sunday before 24 december minus 21 days
+small black "Seconda d'avvento" on sunday before 24 december minus 14 days
+small black "Terza d'avvento" on sunday before 24 december minus 7 days
+small black "Quarta d'avvento" on sunday before 24 december
+weekend "Natale" on 25.12
+weekend "Santo Stefano" on 26.12
+small black "San Silvestro" on 31.12
+
+: Lay holidays: 1.1 and 15.8 are also religious holidays.
+: (default color for non-weekends: green)
+
+weekend "Capodanno" on 1.1
+small green "Giornata della Memoria" on 27.1
+small green "Giornata del Ricordo" on 10.2
+small green "Festa della donna" on 8.3
+weekend "Anniversario della Liberazione" on 25.4
+weekend "Festa del Lavoro" on 1.5
+weekend "Festa della Repubblica" on 2.6
+weekend "Ferragosto" on 15.8
+small green "Festa dell'Unità nazionale" on 4.11
+
+
+: Daylight savings (blue)
+
+blue "Passaggio all'ora legale" on last sunday in march
+blue "Passaggio all'ora solare" on last sunday in october
+
diff --git a/libkholidays/holidays/holiday_jp b/libkholidays/holidays/holiday_jp
new file mode 100644
index 000000000..eadb6da2c
--- /dev/null
+++ b/libkholidays/holidays/holiday_jp
@@ -0,0 +1,80 @@
+:
+: Japanese holiday file. Copy to ~/.holiday
+: Author: Toyohiro Asukai <toyohiro@ksmplus.com>
+: Last modified on Nov 16 2004
+:
+: National Holidays. (English Messages)
+:small "New Year's Day" weekend on 1/1
+:small "Coming of Age" weekend on second monday in january
+:small "National Foundation Day" weekend on 2/11
+:small "Vernal Equinox Day" weekend on 3/20/2005
+:small "Vernal Equinox Day" weekend on 3/21/2006
+:small "Vernal Equinox Day" weekend on 3/21/2007
+:small "Vernal Equinox Day" weekend on 3/20/2008
+:small "Vernal Equinox Day" weekend on 3/20/2009
+:small "Vernal Equinox Day" weekend on 3/21/2010
+:small "Greenery Day" weekend on 4/29
+:small "Constitution Day" weekend on 5/3
+:small "Holiday" weekend on 5/4
+:small "Children's Day" weekend on 5/5
+:small "Oceans' Day" weekend on third monday in july
+:small "Respect for Senior Citizens Day" weekend on third monday in september
+:small "Autumnal Equinox Day" weekend on 9/23
+:small "Sports Day" weekend on second monday in october
+:small "Culture Day" weekend on 11/3
+:small "Labor Thanksgiving Day" weekend on 11/23
+:small "The Emperor's Birthday" weekend on 12/23
+
+: National Holidays. (Japanese and English messages)
+small "元旦(New Year's Day)" weekend on 1/1
+small "成人の日(Coming of Age)" weekend on second monday in january
+small "建国記念日(National Foundation Day)" weekend on 2/11
+small "春分の日(Vernal Equinox Day)" weekend on 3/20/2005
+small "春分の日(Vernal Equinox Day)" weekend on 3/21/2006
+small "春分の日(Vernal Equinox Day)" weekend on 3/21/2007
+small "春分の日(Vernal Equinox Day)" weekend on 3/20/2008
+small "春分の日(Vernal Equinox Day)" weekend on 3/20/2009
+small "春分の日(Vernal Equinox Day)" weekend on 3/21/2010
+small "みどりの日(Greenery Day)" weekend on 4/29
+small "憲法記念日(Constitution Day)" weekend on 5/3
+small "休日(Holiday)" weekend on 5/4
+small "こどもの日(Children's Day)" weekend on 5/5
+small "海の日(Oceans' Day)" weekend on third monday in july
+small "敬老の日(Respect for Senior Citizens Day)" weekend on third monday in september
+small "秋分の日(Autumnal Equinox Day)" weekend on 9/23
+small "体育の日(Sports Day)" weekend on second monday in october
+small "文化の日(Culture Day)" weekend on 11/3
+small "勤労感謝の日(Labor Thanksgiving Day)" weekend on 11/23
+small "天皇誕生日(The Emperor's Birthday)" weekend on 12/23
+
+: If a "National Holiday" is on Sunday,the following day
+: shall be a substitute holiday.
+:small "Substitute holiday" weekend on 3/21/2005
+:small "Substitute holiday" weekend on 1/2/2006
+:small "Substitute holiday" weekend on 2/12/2007
+:small "Substitute holiday" weekend on 4/30/2007
+:small "Substitute holiday" weekend on 9/24/2007
+:small "Substitute holiday" weekend on 12/24/2007
+:small "Substitute holiday" weekend on 11/24/2008
+:small "Substitute holiday" weekend on 3/22/2010
+
+small "振替休日(Substitute holiday)" weekend on 3/21/2005
+small "振替休日(Substitute holiday)" weekend on 1/2/2006
+small "振替休日(Substitute holiday)" weekend on 2/12/2007
+small "振替休日(Substitute holiday)" weekend on 4/30/2007
+small "振替休日(Substitute holiday)" weekend on 9/24/2007
+small "振替休日(Substitute holiday)" weekend on 12/24/2007
+small "振替休日(Substitute holiday)" weekend on 11/24/2008
+small "振替休日(Substitute holiday)" weekend on 3/22/2010
+
+
+: Japanese Events , not National Holidays.
+:small "St. Valentine's Day" on february 14
+:small "Girls' Festival" on march 3
+:small "Buddha's Birthday" on april 8
+:small "May Day" on may 1
+:small "Boys' Festival" on may 5
+:small "Mother's Day" on second sunday in may
+:small "Father's Day" on third sunday in june
+:small "Festival of the Weaver Star" on july 7
+:small "Christmas" on december 25
diff --git a/libkholidays/holidays/holiday_lt b/libkholidays/holidays/holiday_lt
new file mode 100644
index 000000000..14f41c1c4
--- /dev/null
+++ b/libkholidays/holidays/holiday_lt
@@ -0,0 +1,42 @@
+:
+: Lithuanian holiday file. Copy to ~/.holiday
+:
+: Author: Donatas Glodenis <dgvirtual@akl.lt>
+: 12 July 2005 (first version)
+:
+: Valstybinės šventės / National holidays
+: based on the Work Code of the Republic of Lithuania, article no. 162.
+: List accessible at http://lt.wikipedia.org/wiki/Lietuvos_%C5%A1vent%C4%97s
+
+small red "Naujieji metai" weekend on 1/1
+small red "Lietuvos valstybės atkūrimo diena" weekend on 2/16
+small red "Lietuvos nepriklausomybės atkūrimo diena" weekend on 3/11
+small red "Velykos" weekend on easter length 2 days
+small red "Tarptautinė darbo diena" weekend on 5/1
+small red "Motinos diena" on first sunday in may
+small red "Rasos (Joninės)" weekend on 6/24
+small red "Valstybės (Lietuvos karaliaus Mindaugo karūnavimo) diena" weekend on 7/6
+small red "Žolinė (Švč. Mergelės Marijos ėmimo į dangų diena)" weekend on 8/15
+small red "Visų Šventųjų diena" weekend on 11/1
+small red "Kalėdos" weekend on 12/25 length 2 days
+
+: Tautinės bei religinės šventės / folk (green) and religious (cyan) holidays
+: NOT public holidays
+: Sources various
+small cyan "Trys karaliai" cyan on 1/6
+small green "Šv. Valentino diena" green on 2/14
+small green "Užgavėnės" green on easter minus 47 days
+small cyan "Pelenų diena" cyan on easter minus 46 days
+small green "Melagio diena" green on 4/1
+small cyan "Verbų sekmadienis" weekend on easter minus 7 days
+small cyan "Didysis penktadienis" cyan on easter minus 2 days
+small cyan "Sekminės" weekend on easter plus 49 days
+small cyan "Kūčios" cyan on 12/24
+
+: Religiniai sezonai / Religious holiday seasons
+: next is Lent season:
+: small white "Gavėnia" white on easter minus 45 days length 44 days
+
+: next is advent season
+: small white "Adventas" 11/28 length 27 days
+
diff --git a/libkholidays/holidays/holiday_mx b/libkholidays/holidays/holiday_mx
new file mode 100644
index 000000000..c20c561e9
--- /dev/null
+++ b/libkholidays/holidays/holiday_mx
@@ -0,0 +1,32 @@
+:
+: Mexican holiday file
+:
+: Author: edscott <edscott@imp.mx>
+
+small "Año Nuevo" weekend on 1/1
+small "Batalla de Puebla" on may 5
+small "Día de la Revolución" on november 20
+small "Día de los Santos Inocentes" on december 28
+small "Día de Vírgen de Guadalupe" on december 12
+small "Día de la Raza" on october 12
+small "Navidad" on december 25
+small "Día de los Reyes" on january 6
+small "Natalicio de Benito Juárez" on march 21
+small "Día de la expropiación petrolera" on march 18
+small "Día del trabajo" on may 1
+small "Día de la Independencia" on september 16
+small "Domingo de Pascua" on easter
+small "Sábado de Gloria" on easter minus 1
+small "Viérnes Santo" on easter minus 2
+small "Jueves Santo" on easter minus 3
+small "Día de Todos los Santos" on november 1
+small "Día de los Fieles Difuntos" on november 2
+small "Día de la Constitución" on february 5
+small "Día de la Madre" on may 10
+
+: Seasons
+"Equinoxio de primavera" on march 21
+"Solsticio de verano" on june 21
+"Equinoxio de otoño" on september 21
+"Solsticio de invierno" on december 21
+
diff --git a/libkholidays/holidays/holiday_nl b/libkholidays/holidays/holiday_nl
new file mode 100644
index 000000000..23df998e7
--- /dev/null
+++ b/libkholidays/holidays/holiday_nl
@@ -0,0 +1,72 @@
+:
+: Dutch holiday file. Copy to ~/.holiday
+:
+: NOTE: Goede Vrijdag and Bevrijdingsdag are not holidays for
+: everybody, therefore I don't put them in the "weekend" color.
+: Government employees usually have these days off, for other
+: categories it varies. Check with your employer!
+:
+: Also note that if Koninginnedag falls on a Sunday, the official day
+: off is moved to Monday.
+:
+: Author: Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
+:
+small "Nieuwjaar" weekend on 1.1.
+small "Pasen" weekend on easter length 2 days
+small "Hemelvaart" weekend on easter plus 39 days
+small "Pinksteren" weekend on easter plus 49 days length 2 days
+small "Koninginnedag" weekend on 30.4.
+small "Bevrijdingsdag" on 5.5.
+small "Kerstmis" weekend on 25.12. length 2 days
+:
+: Andere feestdagen:
+: Author: Jeroen C. Kessels <jeroenk@cnplss7.cnps.philips.nl>
+:
+small "Driekoningen" on 6.1
+small "Vastenavond" on easter minus 47 days
+small "Aswoensdag" on easter minus 46 days
+small "Palmzondag" on easter minus 7 days
+small "Witte Donderdag" on easter minus 3 days
+small "Goede Vrijdag" on easter minus 2 days
+small "Dodenherdenking" on 4.5
+small "Bevrijdingsdag" on 5.5
+small "Dierendag" on 4.10
+small "Allerheiligen" on 1.11
+small "Allerzielen" on 2.11
+small "Oudjaar" on 31.12
+small "Moederdag" on every second sunday in may
+small "Vaderdag" on every third sunday in june
+:
+: Winter- en zomertijd:
+: Author: Wilbert Berendsen <wbsoft@xs4all.nl>
+:
+blue "Zomertijd" on last sunday in march
+blue "Wintertijd" on last sunday in october
+:
+: Dagen in het kerkelijk jaar
+: Author: Wilbert Berendsen <wbsoft@xs4all.nl>
+:
+: Kopieer dit bestand eventueel onder een andere naam, maar beginnend
+: met 'holiday_' naar ~/.kde/share/apps/korganizer/ en haal op de
+: volgende regels de dubbelepunten weg.
+:small "Eerste advent" on sunday before 3.12
+:small "Tweede advent" on sunday before 10.12
+:small "Derde advent (Gaudete)" on sunday before 17.12
+:small "Vierde advent (Rorate)" on sunday before 24.12
+:small "Septuagesima (zeventigste)" on easter minus 63 days
+:small "Sexagesima (zestigste)" on easter minus 56 days
+:small "Quinquagesima (vijftigste)" on easter minus 49 days
+:small "Invocabit (roept Hij mij aan, begin Veertigdagentijd)" on easter minus 42 days
+:small "Reminiscere (gedenk)" on easter minus 35 days
+:small "Oculi (ogen)" on easter minus 28 days
+:small "Laetare (verheugt u)" on easter minus 21 days
+:small "Judica (doe recht)" on easter minus 14 days
+:small "Quasi modo geniti (als pasgeboren kinderen)" on easter plus 7 days
+:small "Misericordias Domini (trouw van de Heer)" on easter plus 14 days
+:small "Jubilate (juicht)" on easter plus 21 days
+:small "Cantate (zingt)" on easter plus 28 days
+:small "Rogate (bidt)" on easter plus 35 days
+:small "Exaudi (hoor)" on easter plus 42 days
+:small "Trinitatis (drie-eenheid)" on easter plus 56 days
+:small "Hervormingsdag" on 31.10
+:small "Laatste zondag kerkelijk jaar" on sunday before 26.11
diff --git a/libkholidays/holidays/holiday_no b/libkholidays/holidays/holiday_no
new file mode 100644
index 000000000..73b6bdba7
--- /dev/null
+++ b/libkholidays/holidays/holiday_no
@@ -0,0 +1,32 @@
+:
+: Norwegian holiday file. Copy to ~/.holiday for private changes or tip
+: geiri@stud.cs.uit.no if things are missing.
+:
+weekend "1. Nyttårsdag" weekend on 1.1
+black "2. Nyttårsdag" on 2.1
+black "Morsdag" on second sunday in february
+weekend "Søn. før faste" weekend on easter minus 49
+blue "Sommertid" on last sunday in march
+weekend "Skjærtorsdag" weekend on easter minus 3
+weekend "Langfredag" weekend on easter minus 2
+black "Påskeaften" on easter minus 1
+weekend "1. Påskedag" weekend on easter
+weekend "2. Påskedag" weekend on easter plus 1
+black "Pinseaften" on easter plus 48 days
+weekend "1. Pinsedag" weekend on easter plus 49 days
+weekend "2. Pinsedag" weekend on easter plus 50 days
+weekend "Kristi Him.f.dag" weekend on easter plus 39 days
+weekend "Off. høytidsdag" weekend on 1.5
+weekend "Grunnlovsdag" weekend on 17.5
+black "St. Hans" on 23.6
+blue "Vintertid" on last sunday in september
+weekend "Bots & bededag" on last sunday in october
+black "Farsdag" on second sunday in november
+black "1. Advent" on sunday before 23.12 minus 21 days
+black "2. Advent" on sunday before 23.12 minus 14 days
+black "3. Advent" on sunday before 23.12 minus 7 days
+black "4. Advent" on sunday before 23.12
+black "Julaften" on 24.12
+weekend "1. Juledag" weekend on 25.12
+weekend "2. Juledag" weekend on 26.12
+black "Nyttårsaften" on 31.12
diff --git a/libkholidays/holidays/holiday_nz b/libkholidays/holidays/holiday_nz
new file mode 100644
index 000000000..9e82bd696
--- /dev/null
+++ b/libkholidays/holidays/holiday_nz
@@ -0,0 +1,99 @@
+:
+: New Zealand holiday file. Copy to ~/.holiday
+:
+: Author: Miles Leonard-Taylor (m.leonardtaylor@irl.cri.nz)
+: 13 September 2000 (first version)
+: 24 September 2004 (update with spelling corrections)
+: 11 February 2008 (change to daylight-savings rules by government)
+: Thanks to various people for pointing out all my spelling mistakes...
+
+: Holidays as defined by the government's "Holidays Acts, 1981-1991"
+: and the Visits and Ceremonial office of the Department of Internal Affairs
+: and was also at http://www.nzir.dol.govt.nz/rights/leave/dates/2000.html
+: but now located under http://www.ers.dol.govt.nz/holidays_act_2003/dates/
+
+small "Christmas" weekend on december 25
+small "Boxing Day" weekend on december 26
+small "New Year's Day" weekend on january 1
+small "" weekend on january 2
+:
+small "Good Friday" weekend on easter minus 2 days
+small "Easter Sunday" weekend on easter
+small "Easter Monday" weekend on easter plus 1 days
+:
+small "Waitangi Day" weekend on february 6
+small "Anzac Day" weekend on april 25
+small "Queen's Birthday" weekend on first monday in june
+small "Labour Day" weekend on fourth monday in october
+
+: Other useful dates, but NOT public holidays, sources unknown
+small "St. Valentine's Day" on february 14
+small "St. Patrick's Day" on march 17
+small "Mother's Day" on second sunday in may
+small "Father's Day" on first sunday in september
+small "Halloween" on october 31
+small "Guy Fawkes" on november 5
+small "Melbourne Cup" on first tuesday in november
+
+: Daylight Savings Reminders, defined by Internal Affairs
+: see http://www.dia.govt.nz/diawebsite.nsf/wpg_URL/Services-Daylight-Saving-Index?OpenDocument
+small "Clocks Forward" on last sunday in september
+small "Clocks Back" on first sunday in april
+
+: Additional Easter dates and other Solemneties, defined by Catholic Church
+:small "Epiphany on sunday after january 2
+:small "Baptism of Lord" on sunday after january 2 plus 7 days
+:small "Presentation" on february 2
+small "Ash Wednesday" on easter minus 46 days
+:small "Palm Sunday" on easter minus 7 days
+small "Ascension" on easter plus 42 days
+small "Pentecost" weekend on easter plus 49 days
+small "Trinity" on easter plus 56 days
+small "Corpus Christi" on easter plus 63 days
+:small "Sacred Heart" on easter plus 68 days
+:small "John the Baptist" on june 24
+:small "Sts Peter & Paul" on june 29
+:small "Transfiguration" on august 6
+small "Assumption" on august 15
+small "All Saints" on november 1
+:small "All Souls" on november 2
+:small "Christ the King" on sunday before 24.12 minus 28 days
+:small "1. Advent" on sunday before 24.12 minus 21 days
+:small "2. Advent" on sunday before 24.12 minus 14 days
+:small "3. Advent" on sunday before 24.12 minus 7 days
+:small "4. Advent" on sunday before 24.12
+:small "Holy Family" on first sunday after december 26
+
+: Regional Anniversaries
+: Defined at http://www.nzir.dol.govt.nz/rights/leave/dates/2000.html
+: A map may be viewed at http://www.govt.nz/localgov/regionalmap.php3
+: These may not be tagged as holdiays ("weekend") as they are regional
+: NB. "on monday after 19.1" means monday _ON_ _OR_ after 19.1 (inclusive)
+:
+: Region Offical Date How it shifts around each year
+:
+: Auckland 29 January Moves to nearest monday
+small "Auckland Day" on monday after 26 january
+: Taranaki 31 March Moves to 2nd Mon in Mar to miss easter
+small "Taranaki Day" on second monday in march
+: Hawkes' Bay 1 November Moves to Friday before Labour day
+small "Hawkes Bay Day" on fourth monday in october minus 3 days
+: Wellington 22 January Moves to nearest monday
+small "Wellington Day" on monday after 19 january
+: Marlborough 1 November Moves to first monday after Labour day
+small "Marlborough Day" on fourth monday in october plus 7 days
+: Nelson 1 February Moves to nearest monday
+small "Nelson Day" on monday after 29 january
+: Canterbury 16 December Moves to 2nd Fri after 1st Tues in Nov
+small "Canterbury Day" on friday after 11 november
+: Canterbury (South) 16 December Moves to 4th monday in september
+small "S.Canterbury Day" on fourth monday in september
+: Westland 1 December Moves to nearest monday
+small "Westland Day" on monday after 28 november
+: Otago 23 March Moves to nearest monday
+small "Otago Day" on monday after 20 march
+: Southland 17 January Moves to nearest monday
+small "Southland Day" on monday after 14 march
+: Chatham Islands 30 November Moves to nearest monday
+small "Chatham's Day" on monday after 27 november
+
diff --git a/libkholidays/holidays/holiday_pl b/libkholidays/holidays/holiday_pl
new file mode 100644
index 000000000..a892506f0
--- /dev/null
+++ b/libkholidays/holidays/holiday_pl
@@ -0,0 +1,41 @@
+: Polish holidays file ( take one )
+: sob kwi 10 15:47:14 CEST 1999
+: by Krzysztof P. Jasiutowicz <kpjas@promail.pl>
+:
+small "Nowy Rok" weekend on 1.1.
+small "Trzech Króli" on 6.1.
+small "Dzień Babci" on 21.1.
+small "Dzień Dziadka" on 22.1.
+: small "Śledzik" on easter minus 47 days
+small "Popielec" on easter minus 46 days
+small "Wielki Piątek" on easter minus 2 days
+small "Dzień Kobiet" on 8.3.
+small "Niedziela Palmowa" on easter minus 7 days
+small "Wielkanoc" weekend on easter length 2 days
+small "Lany Poniedziałek" weekend on easter plus 1 day
+small "Zielone Świątki" weekend on easter plus 49 days
+small "Boże Ciało" weekend on easter plus 60 days
+small "Święto Pracy" weekend on 1.5.
+small "Dzień Flagi" on 2.5.
+small "Święto Konstytucji" weekend on 3.5.
+small "Wniebowzięcie NMP" weekend on 15.8.
+small "Wszystkich Świętych" weekend on 1.11.
+small "Zaduszki" on 2.11.
+small "Święto Niepodległości" weekend on 11.11.
+small "Wigilia" on 24.12.
+small "Boże Narodzenie" weekend on 25.12. length 2 days
+small "Sylwester" on 31.12.
+
+
+small black "Walentynki" on 14.2.
+small black "Dzień Matki" on 26.5.
+small black "Dzień Dziecka" on 1.6.
+small black "Dzień Ojca" on 23.6.
+small black "Andrzejki" on 30.11.
+small black "Św. Mikołaj" on 6.12.
+
+
+"Początek wiosny" on march 21
+"Początek lata" on june 22
+"Początek jesieni" on september 23
+"Początek zimy" on december 22
diff --git a/libkholidays/holidays/holiday_pt b/libkholidays/holidays/holiday_pt
new file mode 100644
index 000000000..2f567e5a1
--- /dev/null
+++ b/libkholidays/holidays/holiday_pt
@@ -0,0 +1,349 @@
+:
+: Portugal holiday file. Copy to ~/.holiday
+:
+: Author: moitinho@civil.ist.utl.pt
+:
+: Informação legal em: http://www.infocid.pt/infocid/0_116.htm
+:
+: Feriados obrigatórios
+:
+"Ano Novo" on january 1
+"6ª feira santa" on easter minus 2 days
+"25 de Abril" on april 25
+"1º de Maio" on may 1
+"Corpo de Deus" on easter plus 60 days
+"10 de Junho" on june 10
+"Assunção" on august 15
+"República" on october 5
+"Todos os Santos" on november 1
+"Restauração" on december 1
+"Nª Senhora Conceição" on december 8
+"Natal" on december 25
+:
+: Datas relacionadas com a Páscoa
+:
+"Carnaval" on easter minus 50 days length 4 days
+"4ª feira de cinzas" on easter minus 46 days
+"Páscoa" on easter
+"Pentecostes" weekend on easter plus 49 days
+:"Ascension" on easter plus 40 days
+:"Trinity" on easter plus 46 days
+:
+: Estações
+:
+"Primavera" on march 22
+"Verão" on june 22
+"Outono" on september 22
+"Inverno" on december 22
+:
+: Feriados municipais
+: http://www.viautarquica.pt/autarnet/feriados.htm
+:
+: Desmarcar aqueles que considerar relevantes
+:
+: "Abrantes" on june 14
+: "Águeda" on 1.&#170; easter plus 50 days
+: "Aguiar da Beira" on june 24
+: "Alandroal" on easter plus 8 days
+: "Albergaria-a-Velha" on third sunday in august plus 1 day
+: "Albufeira" on august 20
+: "Alcácer do Sal" on june 24
+: "Alcanena" on easter plus 40 days
+: "Alcobaça" on august 20
+: "Alcochete" on june 24
+: "Alcoutim" on second friday in september
+: "Alenquer" on easter plus 40 days
+: "Alfândega da Fé" on june 29
+: "Alijó" on november 11
+: "Aljezur" on august 29
+: "Aljustrel" on june 13
+: "Almada" on june 24
+: "Almeida" on july 2
+: "Almeirim" on easter plus 40 days
+: "Almodôvar" on april 17
+: "Alpiarça" on april 2
+: "Alter do Chão" on easter plus 40 days
+: "Alvaiázere" on june 13
+: "Alvito" on easter plus 40 days
+: "Amadora" on september 11
+: "Amarante" on july 8
+: "Amares" on june 13
+: "Anadia" on easter plus 40 days
+: "Angra do Heroísmo" on june 24
+: "Ansião" on easter plus 40 days
+: "Arcos de Valdevez" on july 11
+: "Arganil" on september 7
+: "Armamar" on june 24
+: "Arouca" on may 2
+: "Arraiolos" on easter plus 40 days
+: "Arronches" on june 24
+: "Arruda dos Vinhos" on easter plus 40 days
+: "Aveiro" on may 12
+: "Avis" on easter plus 1 day
+: "Azambuja" on easter plus 40 days
+: "Baião" on august 24
+: "Barcelos" on may 3
+: "Barrancos" on august 28
+: "Barreiro" on june 28
+: "Batalha" on august 14
+: "Beja" on easter plus 40 days
+: "Belmonte" on april 26
+: "Benavente" on easter plus 40 days
+: "Bombarral" on june 29
+: "Borba" on easter plus 1 day
+: "Boticas" on november 6
+: "Braga" on june 24
+: "Bragança" on august 22
+: "Cabeceiras de Basto" on september 29
+: "Cadaval" on january 13
+: "Caldas da Rainha" on may 15
+: "Caminha" on easter plus 1 day
+: "Calheta (Açores)" on june 24
+: "Calheta (Madeira)" on november 25
+: "Câmara de Lobos" on october 16
+: "Campo Maior" on easter plus 1 day
+: "Cantanhede" on july 25
+: "Carrazeda de Ansiães" on last friday in august
+: "Carregal do Sal" on third monday in july
+: "Cartaxo" on easter plus 40 days
+: "Cascais" on june 13
+: "Castanheira de Pêra" on july 4
+: "Castelo Branco" on easter plus 16 days
+: "Castelo de Paiva" on june 24
+: "Castelo de Vide" on easter plus 1 day
+: "Castro Daire" on june 29
+: "Castro Marim" on june 24
+: "Castro Verde" on june 29
+: "Celorico da Beira" on may 23
+: "Celorico de Basto" on july 25
+: "Chamusca" on easter plus 40 days
+: "Chaves" on july 8
+: "Cinfães" on june 24
+: "Coimbra" on july 4
+: "Condeixa-a-Nova" on july 24
+: "Constância" on easter plus 1 day
+: "Coruche" on august 17
+: "Corvo" on june 20
+: "Covilhã" on october 20
+: "Crato" on easter plus 1 day
+: "Cuba" on easter plus 1 day
+: "Elvas" on january 14
+: "Entroncamento" on november 24
+: "Espinho" on june 16
+: "Esposende" on august 19
+: "Estarreja" on june 13
+: "Estremoz" on easter plus 40 days
+: "Évora" on june 29
+: "Fafe" on may 16
+: "Faro" on september 7
+: "Felgueiras" on june 29
+: "Ferreira do Alentejo" on march 5
+: "Ferreira do Zêzere" on june 13
+: "Figueira de Castelo Rodrigo" on july 7
+: "Figueira da Foz" on june 24
+: "Figueiró dos Vinhos" on june 24
+: "Fornos de Algodres" on september 29
+: "Freixo de Espada à Cinta" on easter plus 1 day
+: "Fronteira" on april 6
+: "Funchal" on august 21
+: "Fundão" on september 15
+: "Gavião" on november 23
+: "Góis" on last tuesday in july
+: "Golegã" on easter plus 40 days
+: "Gondomar" on first sunday in october plus 1 day
+: "Gouveia" on second sunday in august plus 1 day
+: "Grândola" on october 22
+: "Guarda" on november 26
+: "Guimarães" on june 24
+: "Horta" on june 24
+: "Idanha-a-Nova" on easter plus 15 days
+: "Ílhavo" on easter plus 1 day
+: : .... "Lajes das Flores" on segunda-feira após o 3. fim de semana de Julho ??
+: "Lajes das Flores" on third sunday in july plus 1 day
+: "Lajes do Pico" on june 29
+: "Lagoa (Açores)" on april 11
+: "Lagoa (Algarve)" on september 8
+: "Lagos" on october 27
+: "Lamego" on september 8
+: "Leiria" on may 22
+: "Lisboa" on june 13
+: "Loulé" on easter plus 40 days
+: "Loures" on june 26
+: "Lourinhã" on june 24
+: "Lousã" on june 24
+: "Lousada" on last monday in july
+: "Mação" on easter plus 1 day
+: "Macedo de Cavaleiros" on june 29
+: "Machico" on october 9
+: "Madalena" on july 22
+: "Mafra" on easter plus 40 days
+: "Maia" on second sunday in july plus 1 day
+: "Mangualde" on september 8
+: "Manteigas" on march 4
+: "Marco de Canaveses" on september 8
+: "Marinha Grande" on easter plus 40 days
+: "Marvão" on september 8
+: "Matosinhos" on easter plus 51 days
+: "Mealhada" on easter plus 40 days
+: "Meda" on november 11
+: "Melgaço" on easter plus 40 days
+: "Mértola" on june 24
+: "Mesão Frio" on november 30
+: "Mira" on june 25
+: "Miranda do Corvo" on june 1
+: "Miranda do Douro" on july 10
+: "Mirandela" on may 25
+: "Mogadouro" on october 15
+: "Moimenta da Beira" on june 24
+: "Moita" on second sunday in september plus 2 days
+: "Monção" on easter plus 60 days
+: "Monchique" on easter plus 40 days
+: "Mondim de Basto" on july 25
+: "Monforte" on easter plus 8 days
+: "Montalegre" on june 9
+: "Montemor-o-Novo" on march 8
+: "Montemor-o-Velho" on september 8
+: "Montijo" on june 29
+: "Mora" on easter plus 1 day
+: "Mortágua" on easter plus 40 days
+: "Moura" on june 24
+: "Mourão" on february 2
+: "Murça" on may 8
+: "Murtosa" on september 8
+: "Nazaré" on september 8
+: "Nelas" on june 24
+: "Nisa" on easter plus 1 day
+: "Nordeste" on july 18
+: "Óbidos" on january 11
+: "Odemira" on september 8
+: "Oeiras" on june 7
+: "Oleiros" on second sunday in august plus 1 day
+: "Olhão" on june 16
+: "Oliveira de Azeméis" on second monday in august
+: "Oliveira de Frades" on october 7
+: "Oliveira do Bairro" on easter plus 40 days
+: "Oliveira do Hospital" on october 7
+: "Ourém" on june 20
+: "Ourique" on september 8
+: "Ovar" on july 25
+: "Paços de Ferreira" on november 6
+: "Palmela" on june 1
+: "Pampilhosa da Serra" on april 10
+: "Paredes de Coura" on august 10
+: "Paredes" on third sunday in july plus 1 day
+: "Pedrógão Grande" on july 24
+: "Penacova" on july 17
+: "Penafiel" on november 11
+: "Penalva do Castelo" on august 25
+: "Penamacor" on easter plus 1 day
+: "Penedono" on august 29
+: "Penela" on september 29
+: "Peniche" on first sunday in august plus 1 day
+: "Peso da Régua" on august 16
+: "Pinhel" on august 25
+: "Pombal" on november 11
+: : .... "Ponta Delgada" on segunda-feira do Senhor Santo Cristo em Maio ???
+: "Ponta do Sol" on september 8
+: "Ponte da Barca" on august 24
+: "Ponte de Lima" on september 20
+: "Ponte de Sor" on easter plus 1 day
+: "Portalegre" on may 23
+: "Portel" on easter plus 1 day
+: "Portimão" on june 24
+: "Porto" on june 24
+: "Porto Moniz" on july 22
+: "Porto de Mós" on june 29
+: "Porto Santo" on june 24
+: "Póvoa do Varzim" on june 29
+: "Póvoa de Lanhoso" on march 19
+: "Povoação" on easter plus 61 days
+: "Proença-a-Nova" on june 13
+: "Redondo" on easter plus 1 day
+: "Reguengos de Monsaraz" on june 13
+: "Resende" on september 29
+: "Ribeira Brava" on june 29
+: "Ribeira Grande" on june 29
+: "Ribeira de Pena" on august 16
+: "Rio Maior" on november 6
+: "São Brás de Alportel" on june 1
+: "São João da Madeira" on october 11
+: "São João da Pesqueira" on june 24
+: "São Pedro do Sul" on june 29
+: "São Roque do Pico" on august 16
+: "Sabrosa" on september 8
+: "Sabugal" on easter plus 8 days
+: "Salvaterra de Magos" on easter plus 40 days
+: "Santa Comba Dão" on easter plus 40 days
+: "Santa Cruz" on january 15
+: "Santa Cruz das Flores" on june 24
+: "Santa Cruz da Graciosa" on june 24
+: "Santa Maria da Feira" on january 20
+: "Santa Marta de Penaguião" on january 13
+: "Santana" on may 25
+: "Santarém" on march 19
+: "Santiago do Cacém" on july 25
+: "Santo Tirso" on july 11
+: "São Vicente" on january 22
+: "Sardoal" on september 22
+: "Sátão" on august 20
+: "Seia" on july 3
+: "Seixal" on july 29
+: "Sernancelhe" on may 3
+: "Serpa" on easter plus 2 days
+: "Sertã" on june 24
+: "Sesimbra" on may 4
+: "Setúbal" on september 15
+: "Sever do Vouga" on sepetember 21
+: "Silves" on september 3
+: "Sines" on november 24
+: "Sintra" on june 29
+: "Sobral de Monte Agraço" on easter plus 40 days
+: "Soure" on september 21
+: "Sousel" on easter plus 1 day
+: "Tábua" on april 10
+: "Tabuaço" on june 24
+: "Tarouca" on september 29
+: "Tavira" on june 24
+: "Terras de Bouro" on june 24
+: "Tomar" on march 1
+: "Tondela" on september 16
+: "Torre de Moncorvo" on march 19
+: "Torres Novas" on easter plus 40 days
+: "Torres Vedras" on november 11
+: "Trancoso" on may 29
+: "Vagos" on easter plus 50 days
+: "Vale de Cambra" on june 13
+: "Valença" on september 18
+: "Valongo" on june 24
+: "Valpaços" on november 6
+: "Velas" on april 23
+: "Vendas Novas" on september 7
+: "Viana do Alentejo" on january 13
+: "Viana do Castelo" on august 20
+: "Vidigueira" on easter plus 40 days
+: "Vieira do Minho" on first saturday in october plus 2 days
+: "Vila do Bispo" on september 20
+: "Vila do Conde" on june 24
+: "Vila Franca do Campo" on june 24
+: "Vila do Porto" on june 24
+: "Vila da Praia da Vitória" on june 20
+: "Vila do Rei" on september 19
+: "Vila Flor" on august 24
+: "Vila Franca de Xira" on easter plus 40 days
+: "Vila Nova da Barquinha" on june 13
+: "Vila Nova de Foz Côa" on may 21
+: "Vila Nova de Cerveira" on october 1
+: "Vila Nova de Famalicão" on june 13
+: "Vila Nova de Gaia" on june 24
+: "Vila Nova de Paiva" on march 2
+: "Vila Nova de Poiares" on january 13
+: "Vila Pouca de Aguiar" on june 22
+: "Vila Real" on june 13
+: "Vila Real de Santo António" on may 13
+: "Vila Velha de Ródão" on fourth sunday in august plus 1 day
+: "Vila Verde" on june 13
+: "Vila Viçosa" on august 16
+: "Vimioso" on august 10
+: "Vinhais" on may 20
+: "Viseu" on september 21
+: "Vouzela" on may 14
diff --git a/libkholidays/holidays/holiday_py b/libkholidays/holidays/holiday_py
new file mode 100644
index 000000000..3fc947352
--- /dev/null
+++ b/libkholidays/holidays/holiday_py
@@ -0,0 +1,25 @@
+:
+: Fichero holiday_paraguay.
+: Creado por Carlos Raúl Perasso <carlosrp@pla.net.py>
+:
+: Feriados Inamovibles
+:
+red "Año nuevo" red on january 1
+red "Independencia" red on may 15
+red "Virgen de Caacupé" red on december 8
+red "Navidad" red on december 25
+:
+: Feriados que tendrían que pasar al siguiente lunes si caen entre martes y viernes
+: (No se como establecerlo para korganizer)
+:
+red "Día de los Heroes" red on march 1
+red "Trabajo" red on may 1
+red "Paz del Chaco" red on june 12
+red "Asunción" red on august 15
+red "Batalla de Boquerón" red on september 29
+:
+: Feriados relacionados a la Pascua
+:
+red "Jueves Santo" red on easter minus 3 days
+red "Viernes Santo" red on easter minus 2 days
+:
diff --git a/libkholidays/holidays/holiday_quebec b/libkholidays/holidays/holiday_quebec
new file mode 100644
index 000000000..076577da3
--- /dev/null
+++ b/libkholidays/holidays/holiday_quebec
@@ -0,0 +1,19 @@
+:
+: Quebec holiday file. Copy to ~/.holiday
+:
+: Author: Gildas Perrot <perrot@grbb.polymtl.ca>
+:
+small "Jour de l'An" weekend on january 1
+small "St Valentin" on february 14
+small "Vendredi Saint" weekend on easter minus 2 days
+small "Paques" weekend on easter
+small "Lundi de Paques" weekend on easter plus 1 day
+small "Fetes des Meres" on second sunday in may
+small "Jour de la Reine (Fete de Dollard)" weekend on monday before may 24
+small "Fetes des Peres" on third sunday in june
+small "St-Jean Baptiste" on june 24
+small "Fete de la Confederation" weekend on july 1
+small "Jour du Travail" weekend on first monday in september
+small "Action de Graces" weekend on second monday in october
+small "Jour du Souvenir (Armistice 1918)" weekend on november 11
+small "Noel" weekend on december 25
diff --git a/libkholidays/holidays/holiday_ro b/libkholidays/holidays/holiday_ro
new file mode 100644
index 000000000..c8276f3c1
--- /dev/null
+++ b/libkholidays/holidays/holiday_ro
@@ -0,0 +1,21 @@
+:
+: Romanian holiday file. Copy to ~/.holiday
+:
+: Author: Claudiu Costin <claudiuc@kde.org>
+:
+small "Anul nou" on 1.1.
+small "Sărbătoarea unirii" on 24.1
+small "Ziua mamei" on 8.3
+small "Ziua copilului" on 1.6
+small "Ziua naţională" on 1.12
+small "Ziua Revoluţiei" on 22.12
+red "Crăciunul" weekend on 25.12
+small "Ziua muncii" on 1.5
+
+
+: relativ la Paşte
+small "Floriile" on easter minus 6 days
+red "Paştele" weekend on easter
+small "Înălţarea Domnului" on easter plus 40 days
+small "Rusalii" on easter plus 49 days
+
diff --git a/libkholidays/holidays/holiday_ru b/libkholidays/holidays/holiday_ru
new file mode 100644
index 000000000..5ea6cc7c6
--- /dev/null
+++ b/libkholidays/holidays/holiday_ru
@@ -0,0 +1,111 @@
+:
+: Russian holiday file. Copy to ~/.holiday
+:
+: Author: Andrey Cherepanov <sibskull@mail.ru>, September 2006.
+:
+
+: Official holidays
+red "Новогодние каникулы" on 1.1
+red "Новогодние каникулы" on 2.1
+red "Новогодние каникулы" on 3.1
+red "Новогодние каникулы" on 4.1
+red "Новогодние каникулы" on 5.1
+red "Рождество Христово" on 7.1
+red "День защитника Отечества" on 23.2
+red "Международный женский день" on 8.3
+red "Праздник Весны и Труда" on 1.5
+red "День Победы" on 9.5
+red "День России" on 12.6
+red "День народного единства" on 4.11
+
+: Other holidays
+blue "День работника прокуратуры Российской Федерации" on 12.1
+blue "День российской печати" on 13.1
+blue "День инженерных войск" on 21.1
+blue "День российского студенчества" on 25.1
+blue "День снятия блокады города Ленинграда (1944 год)" on 27.1
+blue "Сталинградская битва (1943 год)" on 2.2
+blue "День российской науки" on 8.2
+blue "День дипломатического работника" on 10.2
+blue "День работников геодезии и картографии" on second sunday in march
+blue "День работников торговли, бытового обслуживания населения и ЖКХ" on third sunday in march
+blue "День внутренних войск МВД" on 27.3
+blue "День специалиста юридической службы в Вооружённых Силах" on 29.3
+blue "День единения народов" on 2.4
+blue "День сотрудников военных комиссариатов" on 8.4
+blue "День геолога" on first sunday in april
+blue "День космонавтики" on 12.4
+blue "День войск противовоздушной обороны" on second sunday in april
+blue "День специалиста по радиоэлектронной борьбе" on 15.4
+blue "Ледовое побоище (1242 год)" on 18.4
+blue "День памяти погибших в радиационных авариях и катастрофах" on 26.4
+blue "День пожарной охраны" on 30.4
+blue "День радио, праздник работников всех отраслей связи" on 7.5
+blue "День химика" on last sunday in may
+blue "День славянской письменности и культуры" on 24.5
+blue "Общероссийский День библиотек" on 27.5
+blue "День пограничника" on 28.5
+blue "Пушкинский день России" on 6.6
+blue "День социального работника" on 8.6
+blue "День работников текстильной и лёгкой промышленности" on second sunday in june
+blue "День медицинского работника" on third sunday in june
+blue "День изобретателя и рационализатора" on last saturday in june
+blue "День памяти и скорби" on 22.6
+blue "День молодёжи" on 27.6
+blue "День работников морского и речного флота" on first sunday in july
+blue "Полтавская битва (1709 год)" on 10.7
+blue "День рыбака" on second sunday in july
+blue "День российской почты" on second sunday in july
+blue "День металлурга" on third sunday in july
+blue "День Военно-Морского Флота" on last sunday in july
+blue "День Тыла Вооружённых Сил Российской Федерации" on 1.8
+blue "День Воздушно-десантных войск" on 2.8
+blue "День железнодорожника" on first sunday in august
+blue "День Железнодорожных войск Российской Федерации" on 6.8
+blue "День победы у мыса Гангут (1714 год)" on 9.8
+blue "День Военно-воздушных сил" on 12.8
+blue "День физкультурника" on second saturday in august
+blue "День строителя" on second sunday in august
+blue "День Воздушного Флота России" on third sunday in august
+blue "День Государственного флага Российской Федерации" on 22.8
+blue "Курская битва (1943 год)" on 23.8
+blue "День шахтёра" on last sunday in august
+blue "День кино" on 27.8
+blue "День знаний" on 1.9
+blue "День российской гвардии" on 2.9
+blue "День солидарности в борьбе с терроризмом" on 3.9
+blue "День специалиста по ядерному обеспечению" on 4.9
+blue "День работников нефтяной и газовой промышленности" on first sunday in september
+blue "Бородинское сражение (1812 год)" on 8.9
+blue "День победы у мыса Тендра (1790 год)" on 11.9
+blue "День танкиста" on second sunday in september
+blue "Куликовская битва (1380 год)" on 21.9
+blue "День работников леса" on third sunday in september
+blue "День работника атомной промышленности" on 28.9
+blue "День машиностроителя" on last sunday in september
+blue "День пожилых людей" on 1.10
+blue "День Сухопутных войск" on 1.10
+blue "День Космических войск" on 4.10
+blue "День учителя" on 5.10
+blue "День военного связиста" on 20.10
+blue "День подразделений специального назначения" on 24.10
+blue "День таможенника Российской Федерации" on 25.10
+blue "День работника сельского хозяйства и перерабатывающей промышленности" on second sunday in october
+blue "День работников дорожного хозяйства" on third sunday in october
+blue "День работников автомобильного транспорта" on last sunday in october
+blue "День памяти жертв политических репрессий" on 30.10
+blue "День военного разведчика" on 5.11
+blue "Октябрьская революция 1917 года" on 7.11
+blue "День милиции" on 10.11
+blue "День войск радиационной, химической и биологической защиты" on 13.11
+blue "День ракетных войск и артиллерии" on 19.11
+blue "День работника налоговых органов Российской Федерации" on 21.11
+blue "День матери" on last sunday in november
+blue "День победы у мыса Синоп (1853 год)" on 1.12
+blue "Битва под Москвой (1941 год)" on 5.12
+blue "День Конституции Российской Федерации" on 12.12
+blue "День Ракетных войск стратегического назначения" on 17.12
+blue "День работника органов безопасности Российской Федерации" on 20.12
+blue "День энергетика" on 22.12
+blue "День взятия крепости Измаил (1790 год)" on 24.12
+blue "День спасателя Российской Федерации" on 27.12
diff --git a/libkholidays/holidays/holiday_se b/libkholidays/holidays/holiday_se
new file mode 100644
index 000000000..244eaf385
--- /dev/null
+++ b/libkholidays/holidays/holiday_se
@@ -0,0 +1,37 @@
+:
+: Swedish holiday file.
+:
+weekend "Nyårsdagen" weekend on 1.1
+black "Trett.d.afton" black on 5.1
+weekend "Trett.d. Jul" weekend on 6.1
+black "Alla hjärtans dag" on 14.2
+black "Fettisdagen" on easter minus 47 days
+black "Askonsdagen" on easter minus 46 days
+blue "Sommartid" on last sunday in march
+black "Skärtorsdagen" black on easter minus 3
+weekend "Långfredagen" weekend on easter minus 2
+black "Påskafton" black on easter minus 1
+weekend "Påskdagen" weekend on easter
+weekend "Annandag påsk" weekend on easter plus 1
+black "Pingstafton" black on easter plus 48 days
+weekend "Pingstdagen" weekend on easter plus 49 days
+:Before 2005
+:weekend "Annandag Pingst" weekend on easter plus 50 days
+black "Annandag Pingst" black on easter plus 50 days
+weekend "Kristi Him.f." weekend on easter plus 39 days
+weekend "Första Maj" weekend on 1.5
+:Before 2005
+:black "Nationaldagen" black on 6.6
+weekend "Nationaldagen" weekend on 6.6
+black "Midsommarafton" black on friday before 25.6
+weekend "Midsommardagen" weekend on saturday before 26.6
+blue "Vintertid" on last sunday in october
+weekend "Alla helgons dag" weekend on first sunday in november minus 1
+black "1. Advent" on sunday before 24.12 minus 21 days
+black "2. Advent" on sunday before 24.12 minus 14 days
+black "3. Advent" on sunday before 24.12 minus 7 days
+black "Julafton" black on 24.12
+black "4. Advent" on sunday before 24.12
+weekend "Juldagen" weekend on 25.12
+weekend "Annandag Jul" weekend on 26.12
+black "Nyårsafton" on 31.12
diff --git a/libkholidays/holidays/holiday_si b/libkholidays/holidays/holiday_si
new file mode 100644
index 000000000..41ef91370
--- /dev/null
+++ b/libkholidays/holidays/holiday_si
@@ -0,0 +1,22 @@
+: $Id$
+: $Source$
+: SLOVENIAN HOLIDAY FILE.
+: by Roman Maurer <roman.maurer@hermes.si>
+:
+: Source of information:
+: Aleš Košir: Slovenščina in računalniki
+: <http://nl.ijs.si/GNUsl/tex/tslovene/slolang/>
+:
+small "Novo leto" on 1.1. length 2 days
+small "Slovenski kulturni praznik" on 8.2.
+small "Velika noč" weekend on easter
+small "Velikonočni ponedeljek" weekend on easter plus 1 day
+small "Dan upora proti okupatorju" on 27.4.
+small "Praznik dela" on 1.5. length 2 days
+small "Binkošti" weekend on easter plus 49 days
+small "Dan državnosti" on 25.6.
+small "Marijino vnebovzetje" on 15.8.
+small "Dan reformacije" on 31.10.
+small "Dan spomina na mrtve" on 1.11.
+small "Božič" on 25.12.
+small "Dan samostojnosti" on 26.12.
diff --git a/libkholidays/holidays/holiday_sk b/libkholidays/holidays/holiday_sk
new file mode 100644
index 000000000..c468b258f
--- /dev/null
+++ b/libkholidays/holidays/holiday_sk
@@ -0,0 +1,29 @@
+:
+: Slovak holiday file. Copy to ~/.holiday
+: Author: Michal Vančo <michal.vanco@gmail.com>
+:
+small "Nový rok" weekend on 1.1.
+small "Deň vzniku SR" weekend on 1.1.
+small "Traja králi" weekend on 6.1.
+small "Medzinárodný deň žien" on 8.3.
+: Veľká noc patrí niekde sem
+small "Veľký piatok" weekend on easter minus 2
+small "Veľkonočná nedeľa" weekend on easter
+small "Veľkonočný pondelok" weekend on easter plus 1
+small "Deň učiteľov" on 28.4.
+small "Sviatok práce" weekend on 1.5.
+small "Deň víťazstva nad fašizmom" weekend on 8.5.
+small "Deň matiek" on 13.5.
+small "Medzinárodný deň detí" on 1.6.
+small "Deň otcov" on 17.6.
+small "Sviatok sv. Cyrila a Metoda" weekend on 5.7.
+small "Výročie SNP" weekend on 29.8.
+small "Deň Ústavy SR" weekend on 1.9.
+small "Sedembolestná Panna Mária" weekend on 15.9.
+small "Sviatok všetkých svätých" weekend on 1.11.
+small "Pamiatka zosnulých" on 2.11.
+small "Deň boja za slobodu a demokraciu" weekend on 17.11.
+small "Štedrý deň" weekend on 24.12.
+small "1. sviatok vianočný" weekend on 25.12.
+small "2. sviatok vianočný" weekend on 26.12.
+
diff --git a/libkholidays/holidays/holiday_th b/libkholidays/holidays/holiday_th
new file mode 100644
index 000000000..da97605ce
--- /dev/null
+++ b/libkholidays/holidays/holiday_th
@@ -0,0 +1,30 @@
+:
+: Thailand holiday file. Copy to ~/.holiday
+: Use this as a starting point, These are the Official holidays.
+: Chineese New Year along with most other Chineese holidays are also
+: widely celebrated but not included here.
+:
+:
+: Author: Gerald Williams <gwilli@samart.co.th>
+:
+black "New Year" on January 1
+red "Makha Bucha Day" on February 11
+black "Chakri Day" on April 6
+black "Songkran Festival" weekend on April 13
+black "Coranation Day" on May 5
+black "Ploughing Ceremony" on May 8
+red "Visakha Bucha Day" on May 10
+black "Mid Year Day" on July 1
+red "Asarnha Bucha Day" on July 8
+red "Khao Phansa Day" on July 9
+black "H.M.The Queens B'day" on August 12
+black "Chulalongkorn Day" on October 23
+black "H.M. The King's B'day" on December 5
+black "Constitution Day" on December 10
+black "New Years Eve" on December 31
+
+
+: Seasons (Basically only three)
+green "Hot season Begins" on march 1
+green "Rainy season Begins" on june 1
+green "Cool season Begins" on november 1
diff --git a/libkholidays/holidays/holiday_ua b/libkholidays/holidays/holiday_ua
new file mode 100644
index 000000000..6e8361073
--- /dev/null
+++ b/libkholidays/holidays/holiday_ua
@@ -0,0 +1,118 @@
+:
+: Ukrainian holiday file. Copy to ~/.holiday
+:
+: Authors: Andriy Gapon <avg@icyb.net.ua>, April 2007.
+: Oleg Ivashchenko <ol_iva@i.ua>, October 2006.
+:
+
+: Official holidays
+small "Новий Рік" weekend on 1.1
+small "Різдво Христове" weekend on 7.1
+small "8 Березня - Міжнародний Жіночий День" weekend on 8.3
+small "Великдень" weekend on pascha
+small "1 Травня - День Праці" weekend on 1.5 length 2 days
+small "День Перемоги" weekend on 9.5
+small "Трійця" weekend on pascha plus 49 days
+small "День Конституції України" weekend on 28.6
+small "День Незалежності України" weekend on 24.8
+
+: Other holidays
+blue "Хрещення" on 19.1
+blue "День соборності України" on 22.1
+blue "День пам’яті Крутів" on 29.1
+blue "День працівників пожежної охорони" on 29.1
+blue "День вшанування учасників бойових дій на території інших держав" on 15.2
+blue "День захисника Вітчизни" on 23.2
+blue "День землевпорядника" on second saturday in march
+blue "День працівників житлово-комунального господарства і побутового обслуговування населення" on third sunday in march
+blue "Всеукраїнський день працівників культури та аматорів народного мистецтва" on 23.3
+blue "Всеукраїнський день боротьби із захворюванням на туберкульоз" on 24.3
+blue "День Служби безпеки України" on 25.3
+blue "День внутрішніх військ Міністерства внутрішніх справ України" on 26.3
+blue "День геолога" on first sunday in april
+blue "День працівників ракетно-космічної галузі України" on 12.4
+blue "День пам'яток історії та культури" on 18.4
+blue "День довкілля" on third saturday in april
+blue "День охорони праці" on 28.4
+blue "День матері" on second sunday in may
+blue "День банківських працівників" on 20.5
+blue "День науки" on third saturday in may
+blue "День Європи" on third saturday in may
+blue "День працівників видавництв, поліграфії і книгорозповсюдження" on last saturday in may
+blue "День хіміка" on last sunday in may
+blue "Міжнародний день миротворців Організації Об'єднаних Націй" on 29.5
+blue "День слов'янської писемності і культури" 24.5
+blue "День прикордонника" on 28.5
+blue "День захисту дітей" on 1.6
+blue "День журналіста" on 6.6
+blue "День працівників місцевої промисловості" on first sunday in june
+blue "День працівників водного господарства" on first sunday in june
+blue "День працівників легкої промисловості" on second sunday in june
+blue "День медичного працівника" on third sunday in june
+blue "День скорботи і вшанування пам'яті жертв війни в Україні" on 22.6
+blue "День державної служби" on 23.6
+blue "День митної служби України" on 25.6
+blue "День молоді" on last sunday in june
+blue "День архітектури України" on 1.7
+blue "День працівника державної податкової служби України" on 2.7
+blue "День Військ Протиповітряної оборони" on first sunday in july
+blue "День Військово-Морських Сил" on first sunday in july
+blue "День працівників морського та річкового флоту" on first sunday in july
+blue "День рибалки" on second sunday in july
+blue "День бухгалтера" on 16.7
+blue "День працівників металургійної та гірничодобувної промисловості" on third sunday in july
+blue "День працівників торгівлі" on last sunday in july
+blue "День аеромобільних військ" on 2.8
+blue "День військ зв'язку" on 8.8
+blue "День будівельника" on second sunday in august
+blue "День працівників ветеринарної медицини" on second sunday in august
+blue "День пасічника" on 19.8
+blue "День Державного Прапора України" on 23.8
+blue "День авіації" on last saturday in august
+blue "День шахтаря" on last sunday in august
+blue "День підприємця" on first sunday in september
+blue "День фізичної культури і спорту" on second saturday in september
+blue "День танкістів" on second sunday in september
+blue "День працівників нафтової, газової та нафтопереробної промисловості" on second sunday in september
+blue "День українського кіно" on second saturday in september
+blue "День працівників цивільного захисту" on 17.9
+blue "День миру" on 21.9
+blue "День партизанської слави" on 22.9
+blue "День фармацевтичного працівника" on third saturday in september
+blue "День винахідника і раціоналізатора" on third saturday in september
+blue "День працівника лісу" on third sunday in september
+blue "День машинобудівника" on fourth sunday in september
+blue "День туризму" on 27.9
+blue "Всеукраїнський день бібліотек" on 30.9
+blue "День працівників освіти" on first sunday in october
+blue "День юриста" on 8.10
+blue "День працівників стандартизації та метрології" on 10.10
+blue "День працівників державної санітарно-епідеміологічної служби" on second sunday in october
+blue "День художника" on second sunday in october
+blue "День Українського козацтва" on 14.10
+blue "День працівників харчової промисловості" on third sunday in october
+blue "День автомобіліста і дорожника" on last sunday in october
+blue "День інженерних військ" on 3.11
+blue "День ракетних військ і артилерії" on 3.11
+blue "День залізничника" on 4.11
+blue "День працівника соціальної сфери" on first sunday in november
+blue "День української писемності та мови" on 9.11
+blue "День працівників радіо, телебачення та зв'язку" on 16.11
+blue "День студента" on 17.11
+blue "День працівників гідрометеорологічної служби" on 19.11
+blue "День скловиробника" on 19.11
+blue "День Свободи" on 22.11
+blue "День працівників сільського господарства" on third sunday in november
+blue "День пам'яті жертв голодоморів та політичних репресій" on fourth saturday in november
+blue "День працівників прокуратури" on 1.12
+blue "День працівників статистики" on 5.12
+blue "День Збройних Сил України" on 6.12
+blue "День місцевого самоврядування" on 7.12
+blue "День Сухопутних військ України" on 12.12
+blue "День вшанування учасників ліквідації наслідків аварії на Чорнобильській АЕС" on 14.12
+blue "День працівників суду" on 15.12
+blue "День адвокатури" on 19.12
+blue "День міліції" on 20.12
+blue "День працівників дипломатичної служби" on 22.12
+blue "День енергетика" on 22.12
+blue "День працівників архівних установ" on 24.12
diff --git a/libkholidays/holidays/holiday_us b/libkholidays/holidays/holiday_us
new file mode 100644
index 000000000..f0962f105
--- /dev/null
+++ b/libkholidays/holidays/holiday_us
@@ -0,0 +1,54 @@
+:
+: US holiday file. Copy to ~/.holiday
+: Use this as a starting point, some holidays are missing, and some listed
+: here are largely irrelevant.
+:
+: Author: Ron Harichandran <harichan@cee.msu.edu>
+:
+: Federal holidays
+small "New Year's Day" weekend on 1/1
+small "Martin Luther King's Birthday" weekend on third monday in january
+small "President's Day" weekend on third monday in february
+small "Memorial Day" weekend on last monday in may
+small "Independence Day" weekend on july 4
+small "Labor Day" weekend on first monday in september
+small "Columbus Day" weekend on second monday in october
+small "Veterans Day" weekend on november 11
+small "Thanksgiving" weekend on fourth thursday in november
+small "Christmas Day" weekend on december 25
+
+:
+: more holidays from Jeff Buhrt <jeff@amesbvap.ci.in.ameritech.com>
+:
+small "Groundhog Day" on february 2
+small "Lincoln's Birthday" on february 12
+small "St. Valentine's Day" on february 14
+small "Susan B. Anthony's Day" on february 15
+small "St. Patrick's Day" on march 17
+small "Arbor Day" on last friday in april
+small "Loyalty Day" on may 1
+small "Mother's Day" on second sunday in may
+small "Armed Forces Day" on third saturday in may
+: small "Victoria Day" on monday in may and 18 thru 24
+small "Father's Day" on third sunday in june
+small "Citizenship Day" on september 17
+small "Child Health Day" on first monday in september
+small "World Poetry Day" on october 15
+small "United Nations' Day" on october 24
+small "Halloween" on october 31
+small "Bill of Rights' Day" on december 15
+small "Wright Brothers' Day" on december 17
+
+: Easter related
+small "Easter" weekend on easter
+small "Ash Wednesday" on easter minus 46 days
+small "Pentecost" weekend on easter plus 49 days
+small "Ascension" on easter plus 40 days
+small "Trinity" on easter plus 46 days
+small "Corpus Christi" on easter plus 53 days
+
+: Seasons (are these really hardcoded or calculated?)
+"Spring Begins" on march 22
+"Summer Begins" on june 22
+"Fall Begins" on september 22
+"Winter Begins" on december 22
diff --git a/libkholidays/holidays/holiday_uy b/libkholidays/holidays/holiday_uy
new file mode 100644
index 000000000..56b0128ff
--- /dev/null
+++ b/libkholidays/holidays/holiday_uy
@@ -0,0 +1,39 @@
+: KOrganizer Uruguayan holiday file.
+:
+: Pablo R Hoffman <prh@montevideo.com.uy>
+:
+: $Id$
+: --------------------------------------------------------------------------
+:
+: NOTA: Los feriados que se corren para los lunes son arbitrarios y los
+: elije el gobierno uruguayo cada año. Por lo tanto aqui estan listados
+: unicamente las fechas originales (sin correr).
+:
+: Feriados no laborables
+:
+small "Año nuevo" on 1 january
+small "Jura de la constituación" on 18 july
+small "Declaratoria de Independencia" on 25 august
+small "Día del Trabajo" on 1 may
+small "Día de los difuntos" on 2 november
+small "Navidad" on 25 december
+:
+: Feriados laborables
+:
+small "Día de Reyes" on 6 january
+small "Desembarco 33 Orientales" on 19 april
+small "Batalla de las Piedras" on 18 may
+small "Natalicio de Artigas" on 19 june
+small "Día de las Américas" on 18 october
+:
+: Semana de turismo
+:
+small "Domingo de Pascua" on easter
+small "Sábado de gloria" on easter minus 1 day
+small "Viernes santo" on easter minus 2 days
+small "Jueves santo" on easter minus 3 days
+:
+: Carnaval ( cada año es diferente )
+:
+small "Carnaval" on easter minus 48 days
+small "Carnaval" on easter minus 47 days
diff --git a/libkholidays/holidays/holiday_za b/libkholidays/holidays/holiday_za
new file mode 100644
index 000000000..5fe5aeaf9
--- /dev/null
+++ b/libkholidays/holidays/holiday_za
@@ -0,0 +1,17 @@
+:
+: South African holiday file. Copy to ~/.holiday
+:
+: Author: Anton Keyter
+:
+red "New Year's Day" on january 1 shift to monday if sunday
+red "Human Rights Day" on march 21 shift to monday if sunday
+red "Good Friday" on easter minus 2 day
+red "Family Day" on easter plus 1 day
+red "Freedom Day" on april 27 shift to monday if sunday
+red "Workers Day" on may 1 shift to monday if sunday
+red "Youth Day" on june 16 shift to monday if sunday
+red "National Women's Day" on august 9 shift to monday if sunday
+red "Heritage Day" on september 24 shift to monday if sunday
+red "Day of Reconsiliation" on december 16 shift to monday if sunday
+red "Christmas Day" on december 25 shift to monday if sunday
+red "Day of Goodwill" on december 26 shift to monday if sunday
diff --git a/libkholidays/kholidays.cpp b/libkholidays/kholidays.cpp
new file mode 100644
index 000000000..9bb5c1013
--- /dev/null
+++ b/libkholidays/kholidays.cpp
@@ -0,0 +1,148 @@
+/*
+ This file is part of KOrganizer.
+ Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include <qfile.h>
+#include <kapplication.h>
+#include <kstandarddirs.h>
+#include <kdebug.h>
+
+#include "kholidays.h"
+#include "kholidays_version.h"
+
+extern "C" {
+ char *parse_holidays( const char *, int year, short force );
+ /** \internal */
+ struct holiday {
+ char *string; /* name of holiday, 0=not a holiday */
+ int color; /* color code, see scanholiday.lex */
+ unsigned short dup; /* reference count */
+ holiday *next; /* single-linked list if more than one holida appears on a given date */
+ };
+ extern struct holiday holidays[366];
+}
+
+QStringList KHolidays::locations()
+{
+ QStringList files =
+ KGlobal::dirs()->findAllResources( "data", "libkholidays/" + generateFileName( "*" ),
+ false, true );
+ QStringList locs;
+
+ QStringList::ConstIterator it;
+ for ( it = files.begin(); it != files.end(); ++it )
+ locs.append( (*it).mid((*it).findRev('_') + 1) );
+
+ return locs;
+}
+
+QString KHolidays::fileForLocation( const QString &location )
+{
+ return locate( "data", "libkholidays/" + generateFileName( location ) );
+}
+
+QString KHolidays::userPath( bool create )
+{
+ return KGlobal::dirs()->saveLocation( "data", "libkholidays/", create );
+}
+
+QString KHolidays::generateFileName( const QString &location )
+{
+ return "holiday_" + location;
+}
+
+
+
+
+KHolidays::KHolidays( const QString& location )
+ : mLocation( location )
+{
+ mHolidayFile = fileForLocation( location );
+
+ mYearLast = 0;
+}
+
+KHolidays::~KHolidays()
+{
+}
+
+QString KHolidays::location() const
+{
+ return mLocation;
+}
+
+QString KHolidays::shortText( const QDate &date )
+{
+ QValueList<KHoliday> lst = getHolidays( date );
+ if ( !lst.isEmpty() )
+ return lst.first().text;
+ else return QString::null;
+}
+
+bool KHolidays::parseFile( const QDate &date )
+{
+// kdDebug()<<"KHolidays::parseFile( date=" << date << ")"<<endl;
+ int lastYear = 0; //current year less 1900
+
+ if ( mHolidayFile.isNull() || mHolidayFile.isEmpty() || date.isNull() || !date.isValid() )
+ return false;
+
+ if ( ( date.year() != mYearLast ) || ( mYearLast == 0 ) ) {
+// kdDebug()<<kdBacktrace();
+ mYearLast = date.year();
+ lastYear = date.year() - 1900; // silly parse_year takes 2 digit year...
+ parse_holidays( QFile::encodeName( mHolidayFile ), lastYear, 1 );
+ }
+
+ return true;
+}
+
+QString KHolidays::getHoliday( const QDate &date )
+{
+ QValueList<KHoliday> lst = getHolidays( date );
+ if ( !lst.isEmpty() )
+ return lst.first().text;
+ else return QString::null;
+}
+
+QValueList<KHoliday> KHolidays::getHolidays( const QDate &date )
+{
+ QValueList<KHoliday> list;
+ if ( !parseFile( date ) ) return list;
+ struct holiday *hd = &holidays[date.dayOfYear()-1];
+ while ( hd ) {
+ if ( hd->string ) {
+ KHoliday holiday;
+ holiday.text = QString::fromUtf8( hd->string );
+ holiday.shortText = holiday.text;
+ holiday.Category = (hd->color == 2/*red*/) || (hd->color == 9/*weekend*/) ? HOLIDAY : WORKDAY;
+ list.append( holiday );
+ }
+ hd = hd->next;
+ }
+ return list;
+}
+
+int KHolidays::category( const QDate &date )
+{
+ if ( !parseFile(date) ) return WORKDAY;
+
+ return (holidays[date.dayOfYear()-1].color == 2/*red*/) ||
+ (holidays[date.dayOfYear()-1].color == 9/*weekend*/) ? HOLIDAY : WORKDAY;
+}
diff --git a/libkholidays/kholidays.h b/libkholidays/kholidays.h
new file mode 100644
index 000000000..2a5b9a8cd
--- /dev/null
+++ b/libkholidays/kholidays.h
@@ -0,0 +1,80 @@
+/*
+ This file is part of KOrganizer.
+ Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+#ifndef KHOLIDAYS_HOLIDAYS_H
+#define KHOLIDAYS_HOLIDAYS_H
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qdatetime.h>
+#include <qvaluelist.h>
+
+#include <kdepimmacros.h>
+
+struct KHoliday {
+ QString text;
+ QString shortText;
+ int Category;
+};
+
+class KDE_EXPORT KHolidays {
+ public:
+ /**
+ Return a list of all available locations which have a holiday definition.
+ One of these can then be passed to the constructor for a new KHolidays
+ object.
+ */
+ static QStringList locations();
+ /**
+ Return the file name for the holiday file of the given location.
+ */
+ static QString fileForLocation( const QString &location );
+ /**
+ Return the directory for user-specific holiday files (i.e. somewhere below
+ $KDEDIR/share/apps/). Don't automatically create that path by default.
+ */
+ static QString userPath( bool create = false );
+ /**
+ Generate the filename (without the path) for a given region.
+ */
+ static QString generateFileName( const QString &location );
+
+ KHolidays( const QString& location );
+ ~KHolidays();
+
+ /// return the location with which this object was constructed
+ QString location() const;
+
+ QValueList<KHoliday> getHolidays( const QDate& );
+
+ KDE_DEPRECATED QString shortText( const QDate& );
+ KDE_DEPRECATED QString getHoliday( const QDate& );
+
+ enum { WORKDAY, HOLIDAY };
+ KDE_DEPRECATED int category( const QDate& );
+
+ private:
+ bool parseFile( const QDate& );
+
+ QString mLocation; // location string used to determine holidays file
+ QString mHolidayFile; // name of file containing holiday data
+ int mYearLast; // save off the last year we have seen
+};
+
+#endif
diff --git a/libkholidays/kholidays_version.h b/libkholidays/kholidays_version.h
new file mode 100644
index 000000000..a36f42033
--- /dev/null
+++ b/libkholidays/kholidays_version.h
@@ -0,0 +1,47 @@
+/*
+ This file is part of libkholidays.
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+
+#ifndef KHOLIDAYS_KHOLIDAYS_VERSION_H
+#define KHOLIDAYS_KHOLIDAYS_VERSION_H
+
+#define LIBKHOLIDAYS_VERSION_STRING "1.0.0"
+#define LIBKHOLIDAYS_VERSION_MAJOR 1
+#define LIBKHOLIDAYS_VERSION_MINOR 0
+#define LIBKHOLIDAYS_VERSION_RELEASE 0
+
+#define LIBKHOLIDAYS_VERSION \
+ KDE_MAKE_VERSION(LIBKHOLIDAYS_VERSION_MAJOR,\
+ LIBKHOLIDAYS_VERSION_MINOR,\
+ LIBKHOLIDAYS_VERSION_RELEASE)
+
+#define LIBKHOLIDAYS_IS_VERSION(a,b,c) \
+ ( LIBKHOLIDAYS_VERSION >= KDE_MAKE_VERSION(a,b,c) )
+
+#endif
diff --git a/libkholidays/lunarphase.cpp b/libkholidays/lunarphase.cpp
new file mode 100644
index 000000000..56f5fbe51
--- /dev/null
+++ b/libkholidays/lunarphase.cpp
@@ -0,0 +1,291 @@
+/*
+ This file is part of libkholidays.
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ Copyright (c) 1989, 1993
+ The Regents of the University of California. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+
+#include "config.h"
+
+#include <kglobal.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+#include "lunarphase.h"
+
+LunarPhase::LunarPhase( Hemisphere hemisphere )
+{
+ mHemisphere = hemisphere;
+}
+
+LunarPhase::~LunarPhase()
+{
+}
+
+void LunarPhase::setHemisphere( Hemisphere hemisphere )
+{
+ mHemisphere = hemisphere;
+}
+
+LunarPhase::Hemisphere LunarPhase::hemisphere() const
+{
+ return( mHemisphere );
+}
+
+QString LunarPhase::hemisphereStr() const
+{
+ return hemisphereName( mHemisphere );
+}
+
+QString LunarPhase::hemisphereName( LunarPhase::Hemisphere hemisphere )
+{
+ switch( hemisphere ) {
+ case Northern:
+ default:
+ return( i18n( "Northern" ) );
+ break;
+ case Southern:
+ return( i18n( "Southern" ) );
+ break;
+ }
+}
+
+QString LunarPhase::phaseStr( const QDate &date ) const
+{
+ return phaseName( phase( date ) );
+}
+
+QString LunarPhase::phaseName( LunarPhase::Phase phase )
+{
+ switch ( phase ) {
+ case New:
+ return( i18n( "New Moon" ) );
+ break;
+ case Full:
+ return( i18n( "Full Moon" ) );
+ break;
+ case FirstQ:
+ return( i18n( "First Quarter Moon" ) );
+ break;
+ case LastQ:
+ return( i18n( "Last Quarter Moon" ) );
+ break;
+ default:
+ case None:
+ return( QString::null );
+ break;
+ }
+}
+
+LunarPhase::Phase LunarPhase::phase( const QDate &date ) const
+{
+ Phase retPhase = None;
+
+ // compute percent-full for the middle of today and yesterday.
+ QTime noontime( 12, 0, 0 );
+ QDateTime today( date, noontime );
+ double todayPer = percentFull( today.toTime_t() );
+ QDateTime yesterday( date.addDays(-1), noontime );
+ double yesterdayPer = percentFull( yesterday.toTime_t() );
+
+ if ( ( todayPer < 0.50 ) && ( yesterdayPer > 0.50 ) ) {
+ retPhase = New;
+ } else if ( ( todayPer > 99.50 ) && ( yesterdayPer < 99.50 ) ) {
+ retPhase = Full;
+ } else {
+ // compute percent-full for the start of today.
+ QTime sqt( 0, 0, 0 );
+ QDateTime start( date, sqt );
+ double startPer = percentFull( start.toTime_t() );
+ // compute percent-full for the end of today.
+ QTime eqt( 23, 59, 59 );
+ QDateTime end( date, eqt );
+ double endPer = percentFull( end.toTime_t() );
+
+ if ( ( startPer <= 50 ) && ( endPer > 50 ) ) {
+ if ( mHemisphere == Northern ) {
+ retPhase = FirstQ;
+ } else {
+ retPhase = LastQ;
+ }
+ }
+ if ( ( endPer <= 50 ) && ( startPer > 50 ) ) {
+ if ( mHemisphere == Northern ) {
+ retPhase = LastQ;
+ } else {
+ retPhase = FirstQ;
+ }
+ }
+ // Note: if you want to support crescent and gibbous phases then please
+ // read the source for the original BSD 'pom' program.
+ }
+ return( retPhase );
+}
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software posted to USENET.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/*
+ * Phase of the Moon. Calculates the current phase of the moon.
+ * Based on routines from `Practical Astronomy with Your Calculator',
+ * by Duffett-Smith. Comments give the section from the book that
+ * particular piece of code was adapted from.
+ *
+ * -- Keith E. Brandt VIII 1984
+ *
+ * Updated to the Third Edition of Duffett-Smith's book, Paul Janzen, IX 1998
+ *
+ */
+
+
+#include <ctype.h>
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#include <math.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
+
+#ifndef PI
+#define PI 3.14159265358979323846
+#endif
+
+/*
+ * The EPOCH in the third edition of the book is 1990 Jan 0.0 TDT.
+ * In this program, we do not bother to correct for the differences
+ * between UTC (as shown by the UNIX clock) and TDT. (TDT = TAI + 32.184s;
+ * TAI-UTC = 32s in Jan 1999.)
+ */
+#define EPOCH_MINUS_1970 (20 * 365 + 5 - 1) /* 20 years, 5 leaps, back 1 day to Jan 0 */
+#define EPSILONg 279.403303 /* solar ecliptic long at EPOCH */
+#define RHOg 282.768422 /* solar ecliptic long of perigee at EPOCH */
+#define ECCEN 0.016713 /* solar orbit eccentricity */
+#define lzero 318.351648 /* lunar mean long at EPOCH */
+#define Pzero 36.340410 /* lunar mean long of perigee at EPOCH */
+#define Nzero 318.510107 /* lunar mean long of node at EPOCH */
+
+/*
+ * percentFull --
+ * return phase of the moon as a percentage of full
+ */
+double LunarPhase::percentFull( uint tmpt ) const
+{
+ double N, Msol, Ec, LambdaSol, l, Mm, Ev, Ac, A3, Mmprime;
+ double A4, lprime, V, ldprime, D, Nm;
+
+ double days;
+ days = ( tmpt - EPOCH_MINUS_1970 * 86400 ) / 86400.0;
+
+ N = 360 * days / 365.242191; /* sec 46 #3 */
+ adj360(&N);
+ Msol = N + EPSILONg - RHOg; /* sec 46 #4 */
+ adj360(&Msol);
+ Ec = 360 / PI * ECCEN * sin(degreesToRadians(Msol)); /* sec 46 #5 */
+ LambdaSol = N + Ec + EPSILONg; /* sec 46 #6 */
+ adj360(&LambdaSol);
+ l = 13.1763966 * days + lzero; /* sec 65 #4 */
+ adj360(&l);
+ Mm = l - (0.1114041 * days) - Pzero; /* sec 65 #5 */
+ adj360(&Mm);
+ Nm = Nzero - (0.0529539 * days); /* sec 65 #6 */
+ adj360(&Nm);
+ Ev = 1.2739 * sin(degreesToRadians(2*(l - LambdaSol) - Mm)); /* sec 65 #7 */
+ Ac = 0.1858 * sin(degreesToRadians(Msol)); /* sec 65 #8 */
+ A3 = 0.37 * sin(degreesToRadians(Msol));
+ Mmprime = Mm + Ev - Ac - A3; /* sec 65 #9 */
+ Ec = 6.2886 * sin(degreesToRadians(Mmprime)); /* sec 65 #10 */
+ A4 = 0.214 * sin(degreesToRadians(2 * Mmprime)); /* sec 65 #11 */
+ lprime = l + Ev + Ec - Ac + A4; /* sec 65 #12 */
+ V = 0.6583 * sin(degreesToRadians(2 * (lprime - LambdaSol))); /* sec 65 #13 */
+ ldprime = lprime + V; /* sec 65 #14 */
+ D = ldprime - LambdaSol; /* sec 67 #2 */
+ return(50.0 * (1 - cos(degreesToRadians(D)))); /* sec 67 #3 */
+}
+
+/*
+ * degreesToRadians --
+ * convert degrees to radians
+ */
+double LunarPhase::degreesToRadians( double degree ) const
+{
+ return( degree * PI / 180 );
+}
+
+/*
+ * adj360 --
+ * adjust value so 0 <= degree <= 360
+ */
+void LunarPhase::adj360( double *degree ) const
+{
+ for( ;; )
+ if( *degree < 0 )
+ *degree += 360;
+ else if( *degree > 360 )
+ *degree -= 360;
+ else
+ break;
+}
diff --git a/libkholidays/lunarphase.h b/libkholidays/lunarphase.h
new file mode 100644
index 000000000..9cae39ec3
--- /dev/null
+++ b/libkholidays/lunarphase.h
@@ -0,0 +1,150 @@
+/*
+ This file is part of libkholidays.
+ Copyright (c) 2004 Allen Winter <winter@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+
+#ifndef KHOLIDAYS_LUNARPHASE_H
+#define KHOLIDAYS_LUNARPHASE_H
+
+/**
+ Represents and manages a Lunar Phase
+
+ A Lunar Phase can be one of the following:
+
+ + "new": the moon is not visible; or traditionally: first visible
+ crescent of the Moon. For religious purposes, the new
+ month begins when the first crescent moon can be seen.
+ Thus, it is impossible to be certain in advance of when
+ months will begin; in particular, the exact date on which
+ Ramadan will begin is not known in advance. In Saudi Arabia,
+ observers are sent up in airplanes if the weather is cloudy
+ when the new moon is expected.
+ + "first quarter": the right 50% of the moon is visible.
+ + "full": the moon is fully visible.
+ + "last quarter": the left 50% of the moon is visible.
+
+ A very good description of the lunar phases can be read at the Wikipedia,
+ http://en.wikipedia.org/wiki/Lunar_phase
+
+ In the southern hemisphere the order of the phases is reversed.
+ So, to be accurate we need to know the hemisphere.
+
+ Note that crescent and gibbous phases are not currently supported.
+*/
+
+#include <qstring.h>
+#include <qdatetime.h>
+
+#include <time.h>
+
+class LunarPhase
+{
+ public:
+ enum Phase { New, FirstQ, LastQ, Full, None };
+ enum Hemisphere { Northern, Southern };
+
+ LunarPhase( Hemisphere hemisphere = Northern );
+ ~LunarPhase();
+
+ /**
+ Return the lunar phase for the specified Gregorian date.
+ The enum 'None' is returned if one of the supported phases
+ does not occur on the date.
+
+ @param date compute the lunar phase for the specified Gregorian date.
+ */
+ Phase phase( const QDate &date ) const;
+
+ /**
+ Return the lunar phase as a text string for the specified date.
+ A null string is returned if one of the supported phases does
+ not occur on the date.
+
+ @param date compute the lunar phase for the specified Gregorian date.
+ */
+ QString phaseStr( const QDate &date ) const;
+
+ /**
+ Set the hemisphere.
+
+ @param hemisphere Hemisphere
+ */
+ void setHemisphere( Hemisphere hemisphere = Northern );
+
+ /**
+ Return the hemisphere.
+ */
+ Hemisphere hemisphere() const;
+
+ /**
+ Return hemisphere as a clear text string.
+ */
+ QString hemisphereStr() const;
+
+ /**
+ Return the string representation of hemisphere.
+ */
+ static QString hemisphereName( Hemisphere hemisphere );
+
+ /**
+ Return the string representation of phase.
+
+ @param phase the lunar phase.
+ */
+ static QString phaseName( Phase phase );
+
+private:
+ /**
+ Return the phase of the moon as a percentage of full
+
+ @param t is the time since the Epoch, measured in seconds.
+
+ @return the percent fullness [0,100] of the moon.
+ */
+ double percentFull( uint t ) const;
+ /**
+ Convert degrees to radians.
+
+ @param degree degrees to convert.
+
+ @return degrees in radians.
+ */
+ double degreesToRadians( double degree ) const;
+ /**
+ Adjust value so that 0 <= degree <= 360.
+
+ @param degree a pointer to the degree value.
+ */
+ void adj360( double *degree ) const;
+
+ Hemisphere mHemisphere;
+};
+
+#endif
+
+
diff --git a/libkholidays/parseholiday.c b/libkholidays/parseholiday.c
new file mode 100644
index 000000000..c215515e5
--- /dev/null
+++ b/libkholidays/parseholiday.c
@@ -0,0 +1,2653 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "2.3"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 0
+
+/* Using locations. */
+#define YYLSP_NEEDED 0
+
+/* Substitute the variable and function names. */
+#define yyparse kcalparse
+#define yylex kcallex
+#define yyerror kcalerror
+#define yylval kcallval
+#define yychar kcalchar
+#define yydebug kcaldebug
+#define yynerrs kcalnerrs
+
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ NUMBER = 258,
+ MONTH = 259,
+ WDAY = 260,
+ COLOR = 261,
+ STRING = 262,
+ IN = 263,
+ PLUS = 264,
+ MINUS = 265,
+ SMALL = 266,
+ CYEAR = 267,
+ LEAPYEAR = 268,
+ SHIFT = 269,
+ IF = 270,
+ LENGTH = 271,
+ EASTER = 272,
+ EQ = 273,
+ NE = 274,
+ LE = 275,
+ GE = 276,
+ LT = 277,
+ GT = 278,
+ PASCHA = 279,
+ OR = 280,
+ AND = 281,
+ UMINUS = 282
+ };
+#endif
+/* Tokens. */
+#define NUMBER 258
+#define MONTH 259
+#define WDAY 260
+#define COLOR 261
+#define STRING 262
+#define IN 263
+#define PLUS 264
+#define MINUS 265
+#define SMALL 266
+#define CYEAR 267
+#define LEAPYEAR 268
+#define SHIFT 269
+#define IF 270
+#define LENGTH 271
+#define EASTER 272
+#define EQ 273
+#define NE 274
+#define LE 275
+#define GE 276
+#define LT 277
+#define GT 278
+#define PASCHA 279
+#define OR 280
+#define AND 281
+#define UMINUS 282
+
+
+
+
+/* Copy the first part of user declarations. */
+#line 1 "parseholiday.y"
+
+/*
+ * deals with the holiday file. A yacc parser is used to parse the file.
+ * All the holidays of the specified year are calculated at once and stored
+ * in two arrays that have one entry for each day of the year. The day
+ * drawing routines just use the julian date to index into these arrays.
+ * There are two arrays because holidays can be printed either on a full
+ * line under the day number, or as a small line to the right of the day
+ * number. It's convenient to have both.
+ *
+ * parse_holidays(year, force) read the holiday file and evaluate
+ * all the holiday definitions for
+ * <year>. Sets holiday and sm_holiday
+ * arrays. If force is set, re-eval even
+ * if year is the same as last time.
+ *
+ * Taken from plan by Thomas Driemeyer <thomas@bitrot.de>
+ * Adapted for use in KOrganizer by Preston Brown <pbrown@kde.org> and
+ * Reinhold Kainhofer <reinhold@kainhofer.com>
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+#include <stdlib.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+
+#include <limits.h>
+
+/*** Macro definitions and constants ***/
+/*
+ * Before you mail and complain that the following macro is incorrect,
+ * please consider that this is one of the main battlegrounds of the
+ * Annual Usenet Flame Wars. 2000 is a leap year. Just trust me on this :-)
+ */
+
+#define ISLEAPYEAR(y) !((y)&3)
+#define JULIAN(m,d) (monthbegin[m] + (d)-1+((m)>1 && ISLEAPYEAR(parse_year)))
+#define LAST 999
+#define ANY 0
+#define BEFORE -1
+#define AFTER -2
+/**** Public forward declarations ****/
+char *parse_holidays(const char *holidays, int year, short force);
+
+/**** Private forward declarations ****/
+extern int kcallex(void); /* external lexical analyzer */
+static void kcalerror(const char *s);
+static time_t date_to_time(int day, int month, int year,
+ int *wkday, int *julian, int *weeknum);
+static time_t tm_to_time(struct tm *tm);
+static int day_from_name(char *str);
+static int day_from_easter(void);
+static int day_from_monthday(int month, int day);
+static int day_from_wday(int day, int wday, int num);
+static void monthday_from_day(int day, int *m, int *d, int *y);
+static int calc_easter(int year);
+static int calc_pascha(int year);
+static void setliteraldate(int month, int day, int off, int *ddup);
+static void seteaster(int off, int length, int pascha);
+static void setdate(int month, int day, int year, int off, int conditionaloff, int length);
+static void setwday(int num, int wday, int month, int off, int length);
+static void setdoff(int wday, int rel, int month, int day,
+ int year, int off, int length);
+/*** Variables and structures ***/
+static int m, d, y;
+int kcallineno; /* current line # being parsed */
+FILE *kcalin; /* file currently being processed */
+int yacc_small; /* small string or on its own line? */
+int yacc_stringcolor; /* color of holiday name text, 1..8 */
+char *yacc_string; /* holiday name text */
+int yacc_daycolor; /* color of day number, 1..8 */
+char *progname; /* argv[0] */
+int parse_year = -1; /* year being parsed, 0=1970..99=2069*/
+static const char *filename; /* holiday filename */
+static char errormsg[PATH_MAX+200];/* error message if any, or "" */
+static int easter_julian; /* julian date of Easter Sunday */
+static int pascha_julian; /* julian date of Pascha Sunday */
+static char *holiday_name; /* strdup'd yacc_string */
+short monthlen[12] = { 31, 28, 31, 30,
+ 31, 30, 31, 31,
+ 30, 31, 30, 31 };
+short monthbegin[12] = { 0, 31, 59, 90,
+ 120, 151, 181,
+ 212, 243, 273,
+ 304, 334 };
+
+/* struct holiday;*/
+struct holiday {
+ char *string; /* name of holiday, 0=not a holiday */
+ int color;
+ unsigned short dup; /* reference count */
+ struct holiday *next;
+};
+
+struct holiday holidays[366]; /* info for each day, separate for */
+/*struct holiday sm_holiday[366];*/ /* full-line texts under, and small */
+ /* texts next to day number */
+static int initialized=0;
+
+
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 111 "parseholiday.y"
+{ int ival; char *sval; }
+/* Line 193 of yacc.c. */
+#line 270 "parseholiday.c"
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations. */
+
+
+/* Line 216 of yacc.c. */
+#line 283 "parseholiday.c"
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(msgid) msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(e) ((void) (e))
+#else
+# define YYUSE(e) /* empty */
+#endif
+
+/* Identity function, used to suppress warnings about constant conditions. */
+#ifndef lint
+# define YYID(n) (n)
+#else
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int i)
+#else
+static int
+YYID (i)
+ int i;
+#endif
+{
+ return i;
+}
+#endif
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined _STDLIB_H \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yytype_int16 yyss;
+ YYSTYPE yyvs;
+ };
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack, Stack, yysize); \
+ Stack = &yyptr->Stack; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (YYID (0))
+
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 2
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 278
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 41
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 16
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 70
+/* YYNRULES -- Number of states. */
+#define YYNSTATES 132
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 282
+
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 32, 2, 2, 2, 31, 2, 2,
+ 39, 40, 29, 28, 2, 27, 36, 30, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 35, 2,
+ 2, 2, 2, 34, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 37, 2, 38, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 33
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const yytype_uint8 yyprhs[] =
+{
+ 0, 0, 3, 4, 5, 13, 14, 16, 17, 19,
+ 23, 27, 32, 36, 41, 48, 54, 55, 58, 61,
+ 62, 67, 68, 70, 74, 75, 78, 82, 87, 93,
+ 97, 103, 106, 110, 113, 117, 122, 124, 126, 128,
+ 132, 137, 141, 144, 147, 151, 156, 158, 160, 162,
+ 166, 170, 174, 178, 182, 186, 190, 194, 198, 202,
+ 206, 210, 214, 220, 223, 227, 231, 233, 235, 238,
+ 240
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yytype_int8 yyrhs[] =
+{
+ 42, 0, -1, -1, -1, 42, 44, 45, 7, 45,
+ 43, 46, -1, -1, 11, -1, -1, 6, -1, 17,
+ 47, 50, -1, 24, 47, 50, -1, 51, 47, 48,
+ 50, -1, 5, 47, 50, -1, 55, 5, 47, 50,
+ -1, 55, 5, 8, 53, 47, 50, -1, 5, 55,
+ 51, 47, 50, -1, -1, 9, 54, -1, 10, 54,
+ -1, -1, 14, 49, 15, 49, -1, -1, 5, -1,
+ 5, 25, 49, -1, -1, 16, 54, -1, 55, 36,
+ 53, -1, 55, 36, 53, 36, -1, 55, 36, 53,
+ 36, 54, -1, 53, 30, 55, -1, 53, 30, 55,
+ 30, 55, -1, 4, 55, -1, 4, 55, 55, -1,
+ 55, 4, -1, 55, 4, 55, -1, 55, 36, 4,
+ 55, -1, 55, -1, 7, -1, 17, -1, 55, 36,
+ 53, -1, 55, 36, 53, 36, -1, 53, 30, 55,
+ -1, 55, 4, -1, 4, 55, -1, 5, 55, 55,
+ -1, 55, 5, 8, 53, -1, 4, -1, 55, -1,
+ 55, -1, 54, 25, 54, -1, 54, 26, 54, -1,
+ 54, 18, 54, -1, 54, 19, 54, -1, 54, 20,
+ 54, -1, 54, 21, 54, -1, 54, 22, 54, -1,
+ 54, 23, 54, -1, 54, 28, 54, -1, 54, 27,
+ 54, -1, 54, 29, 54, -1, 54, 30, 54, -1,
+ 54, 31, 54, -1, 54, 34, 54, 35, 54, -1,
+ 32, 54, -1, 37, 52, 38, -1, 39, 54, 40,
+ -1, 56, -1, 3, -1, 27, 3, -1, 12, -1,
+ 13, 55, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+static const yytype_uint8 yyrline[] =
+{
+ 0, 130, 130, 131, 131, 137, 138, 141, 142, 145,
+ 146, 147, 148, 149, 150, 151, 154, 155, 156, 159,
+ 160, 163, 164, 165, 168, 169, 172, 173, 174, 175,
+ 176, 177, 178, 179, 180, 181, 182, 186, 187, 188,
+ 190, 192, 194, 196, 198, 200, 206, 206, 208, 209,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ 220, 221, 222, 223, 224, 227, 228, 231, 232, 233,
+ 234
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "NUMBER", "MONTH", "WDAY", "COLOR",
+ "STRING", "IN", "PLUS", "MINUS", "SMALL", "CYEAR", "LEAPYEAR", "SHIFT",
+ "IF", "LENGTH", "EASTER", "EQ", "NE", "LE", "GE", "LT", "GT", "PASCHA",
+ "OR", "AND", "'-'", "'+'", "'*'", "'/'", "'%'", "'!'", "UMINUS", "'?'",
+ "':'", "'.'", "'['", "']'", "'('", "')'", "$accept", "list", "@1",
+ "small", "color", "entry", "offset", "conditionaloffset",
+ "wdaycondition", "length", "date", "reldate", "month", "expr", "pexpr",
+ "number", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
+static const yytype_uint16 yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 45, 43, 42,
+ 47, 37, 33, 282, 63, 58, 46, 91, 93, 40,
+ 41
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 41, 42, 43, 42, 44, 44, 45, 45, 46,
+ 46, 46, 46, 46, 46, 46, 47, 47, 47, 48,
+ 48, 49, 49, 49, 50, 50, 51, 51, 51, 51,
+ 51, 51, 51, 51, 51, 51, 51, 52, 52, 52,
+ 52, 52, 52, 52, 52, 52, 53, 53, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 55, 55, 56, 56, 56,
+ 56
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 0, 0, 7, 0, 1, 0, 1, 3,
+ 3, 4, 3, 4, 6, 5, 0, 2, 2, 0,
+ 4, 0, 1, 3, 0, 2, 3, 4, 5, 3,
+ 5, 2, 3, 2, 3, 4, 1, 1, 1, 3,
+ 4, 3, 2, 2, 3, 4, 1, 1, 1, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 5, 2, 3, 3, 1, 1, 2, 1,
+ 2
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 2, 5, 1, 6, 7, 8, 0, 7, 3, 0,
+ 67, 46, 16, 69, 0, 16, 16, 0, 0, 4,
+ 16, 0, 36, 66, 31, 0, 0, 24, 0, 70,
+ 24, 24, 68, 0, 0, 0, 48, 19, 0, 33,
+ 16, 0, 32, 17, 18, 0, 12, 16, 36, 9,
+ 10, 63, 46, 0, 37, 38, 0, 0, 47, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 65, 21, 24, 29, 34, 0, 24,
+ 46, 26, 47, 25, 24, 43, 0, 64, 0, 42,
+ 0, 0, 51, 52, 53, 54, 55, 56, 49, 50,
+ 58, 57, 59, 60, 61, 0, 22, 0, 11, 0,
+ 46, 16, 13, 35, 27, 15, 44, 41, 0, 39,
+ 0, 21, 21, 30, 24, 28, 45, 40, 62, 23,
+ 20, 14
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
+{
+ -1, 1, 9, 4, 6, 19, 27, 75, 107, 46,
+ 20, 56, 21, 35, 36, 23
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -88
+static const yytype_int16 yypact[] =
+{
+ -88, 10, -88, -88, -5, -88, -3, -5, -88, 103,
+ -88, 122, 36, -88, 122, 13, 13, 11, 15, -88,
+ 13, -14, 32, -88, 122, 15, 15, 4, 125, -88,
+ 4, 4, -88, 15, 119, 169, -88, 12, 122, 122,
+ 145, 144, -88, 210, 210, 15, -88, 13, 37, -88,
+ -88, 19, 122, 122, -88, -88, 17, 1, 2, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, -88, 52, 4, 29, -88, 147, 4,
+ 122, 28, -88, 210, 4, -88, 122, -88, 122, -88,
+ 58, 147, 244, 244, 244, 244, 244, 244, 227, 244,
+ 83, 83, 19, 19, 19, 192, 47, 61, -88, 122,
+ -88, 13, -88, -88, 15, -88, -88, -88, 147, 42,
+ 15, 52, 52, -88, 4, 210, -88, -88, -88, -88,
+ -88, -88
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] =
+{
+ -88, -88, -88, -88, 73, -88, -7, -88, -87, -19,
+ 53, -88, -17, 25, -9, -88
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If zero, do what YYDEFACT says.
+ If YYTABLE_NINF, syntax error. */
+#define YYTABLE_NINF -48
+static const yytype_int16 yytable[] =
+{
+ 22, 5, 24, 28, 7, 29, 89, 90, 30, 31,
+ 2, 49, 50, 37, 32, 42, 38, 57, 10, 48,
+ 45, 3, 25, 26, 81, 58, 74, 13, 14, 76,
+ 77, 88, 82, 79, 129, 130, 39, 40, 91, 10,
+ 84, 39, 17, 85, 86, 25, 26, 33, 13, 14,
+ 43, 44, 34, 72, 18, 87, 108, 106, 51, 109,
+ 112, 111, -47, 17, 114, 115, 118, -47, 41, 82,
+ 83, 113, 121, 41, 119, 18, 122, 116, 127, 117,
+ 8, 47, 82, 0, 92, 93, 94, 95, 96, 97,
+ 98, 99, 100, 101, 102, 103, 104, 105, 0, 0,
+ 123, 126, 0, 0, 124, 131, 10, 11, 12, 82,
+ 0, 0, 69, 70, 71, 13, 14, 72, 0, 0,
+ 15, 0, 10, 52, 53, 10, 54, 16, 10, 11,
+ 17, 13, 14, 0, 13, 14, 55, 13, 14, 125,
+ 0, 0, 18, 0, 0, 128, 17, 10, 80, 17,
+ 10, 110, 17, 78, 25, 26, 13, 14, 18, 13,
+ 14, 18, 0, 0, 18, 0, 0, 0, 0, 0,
+ 0, 17, 0, 0, 17, 0, 0, 0, 0, 0,
+ 0, 0, 0, 18, 0, 0, 18, 59, 60, 61,
+ 62, 63, 64, 0, 65, 66, 67, 68, 69, 70,
+ 71, 0, 0, 72, 0, 0, 0, 0, 0, 73,
+ 59, 60, 61, 62, 63, 64, 0, 65, 66, 67,
+ 68, 69, 70, 71, 0, 0, 72, 120, 59, 60,
+ 61, 62, 63, 64, 0, 65, 66, 67, 68, 69,
+ 70, 71, 0, 0, 72, 59, 60, 61, 62, 63,
+ 64, 0, 0, 66, 67, 68, 69, 70, 71, 0,
+ 0, 72, 59, 60, 61, 62, 63, 64, 0, 0,
+ 0, 67, 68, 69, 70, 71, 0, 0, 72
+};
+
+static const yytype_int8 yycheck[] =
+{
+ 9, 6, 11, 12, 7, 14, 4, 5, 15, 16,
+ 0, 30, 31, 20, 3, 24, 30, 34, 3, 28,
+ 16, 11, 9, 10, 41, 34, 14, 12, 13, 38,
+ 39, 30, 41, 40, 121, 122, 4, 5, 36, 3,
+ 47, 4, 27, 52, 53, 9, 10, 32, 12, 13,
+ 25, 26, 37, 34, 39, 38, 75, 5, 33, 30,
+ 79, 78, 30, 27, 36, 84, 8, 30, 36, 78,
+ 45, 80, 25, 36, 91, 39, 15, 86, 36, 88,
+ 7, 28, 91, -1, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, -1, -1,
+ 109, 118, -1, -1, 111, 124, 3, 4, 5, 118,
+ -1, -1, 29, 30, 31, 12, 13, 34, -1, -1,
+ 17, -1, 3, 4, 5, 3, 7, 24, 3, 4,
+ 27, 12, 13, -1, 12, 13, 17, 12, 13, 114,
+ -1, -1, 39, -1, -1, 120, 27, 3, 4, 27,
+ 3, 4, 27, 8, 9, 10, 12, 13, 39, 12,
+ 13, 39, -1, -1, 39, -1, -1, -1, -1, -1,
+ -1, 27, -1, -1, 27, -1, -1, -1, -1, -1,
+ -1, -1, -1, 39, -1, -1, 39, 18, 19, 20,
+ 21, 22, 23, -1, 25, 26, 27, 28, 29, 30,
+ 31, -1, -1, 34, -1, -1, -1, -1, -1, 40,
+ 18, 19, 20, 21, 22, 23, -1, 25, 26, 27,
+ 28, 29, 30, 31, -1, -1, 34, 35, 18, 19,
+ 20, 21, 22, 23, -1, 25, 26, 27, 28, 29,
+ 30, 31, -1, -1, 34, 18, 19, 20, 21, 22,
+ 23, -1, -1, 26, 27, 28, 29, 30, 31, -1,
+ -1, 34, 18, 19, 20, 21, 22, 23, -1, -1,
+ -1, 27, 28, 29, 30, 31, -1, -1, 34
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] =
+{
+ 0, 42, 0, 11, 44, 6, 45, 7, 45, 43,
+ 3, 4, 5, 12, 13, 17, 24, 27, 39, 46,
+ 51, 53, 55, 56, 55, 9, 10, 47, 55, 55,
+ 47, 47, 3, 32, 37, 54, 55, 47, 30, 4,
+ 5, 36, 55, 54, 54, 16, 50, 51, 55, 50,
+ 50, 54, 4, 5, 7, 17, 52, 53, 55, 18,
+ 19, 20, 21, 22, 23, 25, 26, 27, 28, 29,
+ 30, 31, 34, 40, 14, 48, 55, 55, 8, 47,
+ 4, 53, 55, 54, 47, 55, 55, 38, 30, 4,
+ 5, 36, 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 5, 49, 50, 30,
+ 4, 53, 50, 55, 36, 50, 55, 55, 8, 53,
+ 35, 25, 15, 55, 47, 54, 53, 36, 54, 49,
+ 49, 50
+};
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+
+#define YYFAIL goto yyerrlab
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ yytoken = YYTRANSLATE (yychar); \
+ YYPOPSTACK (1); \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (YYID (0))
+
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (YYID (N)) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (YYID (0))
+#endif
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+ This macro was not mandated originally: define only if we know
+ we won't break user code: when these are the locations we know. */
+
+#ifndef YY_LOCATION_PRINT
+# if YYLTYPE_IS_TRIVIAL
+# define YY_LOCATION_PRINT(File, Loc) \
+ fprintf (File, "%d.%d-%d.%d", \
+ (Loc).first_line, (Loc).first_column, \
+ (Loc).last_line, (Loc).last_column)
+# else
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments. */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (YYID (0))
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (YYID (0))
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
+{
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+ YYUSE (yyoutput);
+# endif
+ switch (yytype)
+ {
+ default:
+ break;
+ }
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
+{
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+ YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+#else
+static void
+yy_stack_print (bottom, top)
+ yytype_int16 *bottom;
+ yytype_int16 *top;
+#endif
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (; bottom <= top; ++bottom)
+ YYFPRINTF (stderr, " %d", *bottom);
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (YYID (0))
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+ YYSTYPE *yyvsp;
+ int yyrule;
+#endif
+{
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ unsigned long int yylno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ fprintf (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
+ fprintf (stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static YYSIZE_T
+yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+ const char *yystr;
+#endif
+{
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+#endif
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return yystrlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into YYRESULT an error message about the unexpected token
+ YYCHAR while in state YYSTATE. Return the number of bytes copied,
+ including the terminating null byte. If YYRESULT is null, do not
+ copy anything; just return the number of bytes that would be
+ copied. As a special case, return 0 if an ordinary "syntax error"
+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
+ size calculation. */
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
+{
+ int yyn = yypact[yystate];
+
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+ return 0;
+ else
+ {
+ int yytype = YYTRANSLATE (yychar);
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ int yysize_overflow = 0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ int yyx;
+
+# if 0
+ /* This is so xgettext sees the translatable formats that are
+ constructed on the fly. */
+ YY_("syntax error, unexpected %s");
+ YY_("syntax error, unexpected %s, expecting %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+# endif
+ char *yyfmt;
+ char const *yyf;
+ static char const yyunexpected[] = "syntax error, unexpected %s";
+ static char const yyexpecting[] = ", expecting %s";
+ static char const yyor[] = " or %s";
+ char yyformat[sizeof yyunexpected
+ + sizeof yyexpecting - 1
+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+ * (sizeof yyor - 1))];
+ char const *yyprefix = yyexpecting;
+
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yycount = 1;
+
+ yyarg[0] = yytname[yytype];
+ yyfmt = yystpcpy (yyformat, yyunexpected);
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ yyformat[sizeof yyunexpected - 1] = '\0';
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+ yyfmt = yystpcpy (yyfmt, yyprefix);
+ yyprefix = yyor;
+ }
+
+ yyf = YY_(yyformat);
+ yysize1 = yysize + yystrlen (yyf);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+
+ if (yysize_overflow)
+ return YYSIZE_MAXIMUM;
+
+ if (yyresult)
+ {
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ char *yyp = yyresult;
+ int yyi = 0;
+ while ((*yyp = *yyf) != '\0')
+ {
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyf += 2;
+ }
+ else
+ {
+ yyp++;
+ yyf++;
+ }
+ }
+ }
+ return yysize;
+ }
+}
+#endif /* YYERROR_VERBOSE */
+
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+#endif
+{
+ YYUSE (yyvaluep);
+
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
+}
+
+
+/* Prevent warnings from -Wmissing-prototypes. */
+
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+/* The look-ahead symbol. */
+int yychar;
+
+/* The semantic value of the look-ahead symbol. */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far. */
+int yynerrs;
+
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
+{
+
+ int yystate;
+ int yyn;
+ int yyresult;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+ /* Look-ahead token as an internal (translated) token number. */
+ int yytoken = 0;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+ /* Three stacks and their tools:
+ `yyss': related to states,
+ `yyvs': related to semantic values,
+ `yyls': related to locations.
+
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss = yyssa;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs = yyvsa;
+ YYSTYPE *yyvsp;
+
+
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+
+ YYSIZE_T yystacksize = YYINITDEPTH;
+
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss);
+ YYSTACK_RELOCATE (yyvs);
+
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+ /* Do appropriate processing given the current state. Read a
+ look-ahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to look-ahead token. */
+ yyn = yypact[yystate];
+ if (yyn == YYPACT_NINF)
+ goto yydefault;
+
+ /* Not known => get a look-ahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = YYLEX;
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yyn == 0 || yyn == YYTABLE_NINF)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the look-ahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ *++yyvsp = yylval;
+
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 3:
+#line 131 "parseholiday.y"
+ { yacc_stringcolor = (yyvsp[(3) - (5)].ival);
+ yacc_string = (yyvsp[(4) - (5)].sval);
+ yacc_daycolor = (yyvsp[(5) - (5)].ival); ;}
+ break;
+
+ case 4:
+#line 134 "parseholiday.y"
+ { free(yacc_string); ;}
+ break;
+
+ case 5:
+#line 137 "parseholiday.y"
+ { yacc_small = 0; ;}
+ break;
+
+ case 6:
+#line 138 "parseholiday.y"
+ { yacc_small = 1; ;}
+ break;
+
+ case 7:
+#line 141 "parseholiday.y"
+ { (yyval.ival) = 0; ;}
+ break;
+
+ case 8:
+#line 142 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;}
+ break;
+
+ case 9:
+#line 145 "parseholiday.y"
+ { seteaster((yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].ival), 0); ;}
+ break;
+
+ case 10:
+#line 146 "parseholiday.y"
+ { seteaster((yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].ival), 1); ;}
+ break;
+
+ case 11:
+#line 147 "parseholiday.y"
+ { setdate( m, d, y, (yyvsp[(2) - (4)].ival), (yyvsp[(3) - (4)].ival), (yyvsp[(4) - (4)].ival));;}
+ break;
+
+ case 12:
+#line 148 "parseholiday.y"
+ { setwday( 0, (yyvsp[(1) - (3)].ival), 0, (yyvsp[(2) - (3)].ival), (yyvsp[(3) - (3)].ival));;}
+ break;
+
+ case 13:
+#line 149 "parseholiday.y"
+ { setwday((yyvsp[(1) - (4)].ival), (yyvsp[(2) - (4)].ival), 0, (yyvsp[(3) - (4)].ival), (yyvsp[(4) - (4)].ival));;}
+ break;
+
+ case 14:
+#line 150 "parseholiday.y"
+ { setwday((yyvsp[(1) - (6)].ival), (yyvsp[(2) - (6)].ival), (yyvsp[(4) - (6)].ival), (yyvsp[(5) - (6)].ival), (yyvsp[(6) - (6)].ival));;}
+ break;
+
+ case 15:
+#line 151 "parseholiday.y"
+ { setdoff((yyvsp[(1) - (5)].ival), (yyvsp[(2) - (5)].ival),m,d,y,(yyvsp[(4) - (5)].ival),(yyvsp[(5) - (5)].ival));;}
+ break;
+
+ case 16:
+#line 154 "parseholiday.y"
+ { (yyval.ival) = 0; ;}
+ break;
+
+ case 17:
+#line 155 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(2) - (2)].ival); ;}
+ break;
+
+ case 18:
+#line 156 "parseholiday.y"
+ { (yyval.ival) = -(yyvsp[(2) - (2)].ival); ;}
+ break;
+
+ case 19:
+#line 159 "parseholiday.y"
+ { (yyval.ival) = 0; ;}
+ break;
+
+ case 20:
+#line 160 "parseholiday.y"
+ { (yyval.ival) = ((yyvsp[(2) - (4)].ival)<<8) | (yyvsp[(4) - (4)].ival);printf("Shift to %i if %i\n", (yyvsp[(2) - (4)].ival), (yyvsp[(4) - (4)].ival)); ;}
+ break;
+
+ case 21:
+#line 163 "parseholiday.y"
+ { (yyval.ival) = 0; ;}
+ break;
+
+ case 22:
+#line 164 "parseholiday.y"
+ { (yyval.ival) = (1<<(yyvsp[(1) - (1)].ival)); ;}
+ break;
+
+ case 23:
+#line 165 "parseholiday.y"
+ { (yyval.ival) = (1<<(yyvsp[(1) - (3)].ival)) | (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 24:
+#line 168 "parseholiday.y"
+ { (yyval.ival) = 1; ;}
+ break;
+
+ case 25:
+#line 169 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(2) - (2)].ival); ;}
+ break;
+
+ case 26:
+#line 172 "parseholiday.y"
+ { m = (yyvsp[(3) - (3)].ival); d = (yyvsp[(1) - (3)].ival); y = 0; ;}
+ break;
+
+ case 27:
+#line 173 "parseholiday.y"
+ { m = (yyvsp[(3) - (4)].ival); d = (yyvsp[(1) - (4)].ival); y = 0; ;}
+ break;
+
+ case 28:
+#line 174 "parseholiday.y"
+ { m = (yyvsp[(3) - (5)].ival); d = (yyvsp[(1) - (5)].ival); y = (yyvsp[(5) - (5)].ival); ;}
+ break;
+
+ case 29:
+#line 175 "parseholiday.y"
+ { m = (yyvsp[(1) - (3)].ival); d = (yyvsp[(3) - (3)].ival); y = 0; ;}
+ break;
+
+ case 30:
+#line 176 "parseholiday.y"
+ { m = (yyvsp[(1) - (5)].ival); d = (yyvsp[(3) - (5)].ival); y = (yyvsp[(5) - (5)].ival); ;}
+ break;
+
+ case 31:
+#line 177 "parseholiday.y"
+ { m = (yyvsp[(1) - (2)].ival); d = (yyvsp[(2) - (2)].ival); y = 0; ;}
+ break;
+
+ case 32:
+#line 178 "parseholiday.y"
+ { m = (yyvsp[(1) - (3)].ival); d = (yyvsp[(2) - (3)].ival); y = (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 33:
+#line 179 "parseholiday.y"
+ { m = (yyvsp[(2) - (2)].ival); d = (yyvsp[(1) - (2)].ival); y = 0; ;}
+ break;
+
+ case 34:
+#line 180 "parseholiday.y"
+ { m = (yyvsp[(2) - (3)].ival); d = (yyvsp[(1) - (3)].ival); y = (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 35:
+#line 181 "parseholiday.y"
+ { m = (yyvsp[(3) - (4)].ival); d = (yyvsp[(1) - (4)].ival); y = (yyvsp[(4) - (4)].ival); ;}
+ break;
+
+ case 36:
+#line 182 "parseholiday.y"
+ { monthday_from_day((yyvsp[(1) - (1)].ival),
+ &m, &d, &y); ;}
+ break;
+
+ case 37:
+#line 186 "parseholiday.y"
+ { (yyval.ival) = day_from_name((yyvsp[(1) - (1)].sval)); ;}
+ break;
+
+ case 38:
+#line 187 "parseholiday.y"
+ { (yyval.ival) = day_from_easter(); ;}
+ break;
+
+ case 39:
+#line 188 "parseholiday.y"
+ { (yyval.ival) = day_from_monthday
+ ((yyvsp[(3) - (3)].ival), (yyvsp[(1) - (3)].ival)); ;}
+ break;
+
+ case 40:
+#line 190 "parseholiday.y"
+ { (yyval.ival) = day_from_monthday
+ ((yyvsp[(3) - (4)].ival), (yyvsp[(1) - (4)].ival)); ;}
+ break;
+
+ case 41:
+#line 192 "parseholiday.y"
+ { (yyval.ival) = day_from_monthday
+ ((yyvsp[(1) - (3)].ival), (yyvsp[(3) - (3)].ival)); ;}
+ break;
+
+ case 42:
+#line 194 "parseholiday.y"
+ { (yyval.ival) = day_from_monthday
+ ((yyvsp[(2) - (2)].ival), (yyvsp[(1) - (2)].ival)); ;}
+ break;
+
+ case 43:
+#line 196 "parseholiday.y"
+ { (yyval.ival) = day_from_monthday
+ ((yyvsp[(1) - (2)].ival), (yyvsp[(2) - (2)].ival)); ;}
+ break;
+
+ case 44:
+#line 198 "parseholiday.y"
+ { (yyval.ival) = day_from_wday((yyvsp[(3) - (3)].ival), (yyvsp[(1) - (3)].ival),
+ (yyvsp[(2) - (3)].ival) == -1 ? -1 : 0); ;}
+ break;
+
+ case 45:
+#line 200 "parseholiday.y"
+ { int day=day_from_monthday((yyvsp[(4) - (4)].ival),1);
+ (yyval.ival) = (yyvsp[(1) - (4)].ival) == 999
+ ? day_from_wday(day+1,(yyvsp[(2) - (4)].ival),-1)
+ : day_from_wday(day,(yyvsp[(2) - (4)].ival),(yyvsp[(1) - (4)].ival)-1);;}
+ break;
+
+ case 48:
+#line 208 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;}
+ break;
+
+ case 49:
+#line 209 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 50:
+#line 210 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 51:
+#line 211 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 52:
+#line 212 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 53:
+#line 213 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 54:
+#line 214 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 55:
+#line 215 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 56:
+#line 216 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 57:
+#line 217 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 58:
+#line 218 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 59:
+#line 219 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;}
+ break;
+
+ case 60:
+#line 220 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(3) - (3)].ival) ? (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival) : 0; ;}
+ break;
+
+ case 61:
+#line 221 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(3) - (3)].ival) ? (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival) : 0; ;}
+ break;
+
+ case 62:
+#line 222 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (5)].ival) ? (yyvsp[(3) - (5)].ival) : (yyvsp[(5) - (5)].ival); ;}
+ break;
+
+ case 63:
+#line 223 "parseholiday.y"
+ { (yyval.ival) = !(yyvsp[(2) - (2)].ival); ;}
+ break;
+
+ case 64:
+#line 224 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;}
+ break;
+
+ case 65:
+#line 227 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;}
+ break;
+
+ case 66:
+#line 228 "parseholiday.y"
+ { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;}
+ break;
+
+ case 68:
+#line 232 "parseholiday.y"
+ { (yyval.ival) = -(yyvsp[(2) - (2)].ival); ;}
+ break;
+
+ case 69:
+#line 233 "parseholiday.y"
+ { (yyval.ival) = parse_year; ;}
+ break;
+
+ case 70:
+#line 234 "parseholiday.y"
+ { (yyval.ival) = !(((yyvsp[(2) - (2)].ival)) & 3); ;}
+ break;
+
+
+/* Line 1267 of yacc.c. */
+#line 1959 "parseholiday.c"
+ default: break;
+ }
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if ! YYERROR_VERBOSE
+ yyerror (YY_("syntax error"));
+#else
+ {
+ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
+ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+ {
+ YYSIZE_T yyalloc = 2 * yysize;
+ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
+ yyalloc = YYSTACK_ALLOC_MAXIMUM;
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yyalloc);
+ if (yymsg)
+ yymsg_alloc = yyalloc;
+ else
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ }
+ }
+
+ if (0 < yysize && yysize <= yymsg_alloc)
+ {
+ (void) yysyntax_error (yymsg, yystate, yychar);
+ yyerror (yymsg);
+ }
+ else
+ {
+ yyerror (YY_("syntax error"));
+ if (yysize != 0)
+ goto yyexhaustedlab;
+ }
+ }
+#endif
+ }
+
+
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse look-ahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse look-ahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (yyn != YYPACT_NINF)
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ *++yyvsp = yylval;
+
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#ifndef yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+ if (yychar != YYEOF && yychar != YYEMPTY)
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp);
+ YYPOPSTACK (1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
+}
+
+
+#line 236 "parseholiday.y"
+
+
+/*** Private Yacc callbacks and helper functions ***/
+static void kcalerror(const char *msg)
+{
+ fprintf(stderr, "%s: %s in line %d of %s\n", progname,
+ msg, kcallineno+1, filename);
+ if (!*errormsg)
+ snprintf(errormsg,sizeof(errormsg),
+ "Problem with holiday file %s:\n%.80s in line %d",
+ filename, msg, kcallineno+1);
+}
+
+static time_t date_to_time(int day, int month, int year,
+ int *wkday, int *julian, int *weeknum)
+{
+ struct tm tm;
+ time_t ttime;
+
+ tm.tm_sec = 0;
+ tm.tm_min = 0;
+ tm.tm_hour = 0;
+ tm.tm_mday = day;
+ tm.tm_mon = month;
+ tm.tm_year = year;
+ ttime = tm_to_time(&tm);
+ if (wkday)
+ *wkday = tm.tm_wday;
+ if (julian)
+ *julian = tm.tm_yday;
+ if (weeknum)
+ *weeknum = 0
+ ? tm.tm_yday / 7
+ : tm.tm_yday ? ((tm.tm_yday - 1) /7) + 1 : 0;
+ return(ttime == -1 || day != tm.tm_mday ? 0 : ttime);
+}
+
+static time_t tm_to_time(struct tm *tm)
+{
+ time_t t; /* return value */
+
+ t = monthbegin[tm->tm_mon] /* full months */
+ + tm->tm_mday-1 /* full days */
+ + (!(tm->tm_year & 3) && tm->tm_mon > 1); /* leap day this year*/
+ tm->tm_yday = t;
+ t += 365 * (tm->tm_year - 70) /* full years */
+ + (tm->tm_year - 69)/4; /* past leap days */
+ tm->tm_wday = (t + 4) % 7;
+
+ t = t*86400 + tm->tm_hour*3600 + tm->tm_min*60 + tm->tm_sec;
+ if (tm->tm_mday > monthlen[tm->tm_mon] +
+ (!(tm->tm_year & 3) && tm->tm_mon == 1))
+ return((time_t)-1);
+ return(t);
+}
+
+/*
+ * set holiday by weekday (monday..sunday). The expression is
+ * "every <num>-th <wday> of <month> plus <off> days". num and month
+ * can be ANY or LAST.
+ */
+
+static void setwday(int num, int wday, int month, int off, int length)
+{
+ int min_month = 0, max_month = 11;
+ int min_num = 0, max_num = 4;
+ int mn, n, dy, l, mlen, wday1;
+ int ddup = 0;
+
+ if (month != ANY)
+ min_month = max_month = month-1;
+ if (month == LAST)
+ min_month = max_month = 11;
+ if (num != ANY)
+ min_num = max_num = num-1;
+
+ holiday_name = yacc_string;
+ for (mn=min_month; mn <= max_month; mn++) {
+ (void)date_to_time(1, mn, parse_year, &wday1, 0, 0);
+ dy = (wday-1 - (wday1-1) +7) % 7 + 1;
+ mlen = monthlen[mn] + (mn==1 && ISLEAPYEAR(parse_year));
+ if (num == LAST)
+ for (l=0; l < length; l++)
+ setliteraldate(mn, dy+28<=mlen ? dy+28 : dy+21,
+ off+l, &ddup);
+ else
+ for (dy+=min_num*7, n=min_num; n <= max_num; n++, dy+=7)
+ if (dy >= 1 && dy <= mlen)
+ for (l=0; l < length; l++)
+ setliteraldate(mn,dy,off+l,&ddup);
+ }
+}
+
+/*
+ * set holiday by weekday (monday..sunday) date offset. The expression is
+ * "every <wday> before/after <date> plus <off> days".
+ * (This routine contributed by Peter Littlefield <plittle@sofkin.ca>)
+ */
+
+static void setdoff(int wday, int rel, int month, int day,
+ int year, int off, int length)
+{
+ int min_month = 0, max_month = 11;
+ int min_day = 1, max_day = 31;
+ int mn, dy, nd, l, wday1;
+ int ddup = 0;
+
+ if (year != ANY) {
+ year %= 100;
+ if (year < 70) year += 100;
+ if (year != parse_year)
+ return;
+ }
+ if (month != ANY)
+ min_month = max_month = month-1;
+ if (month == LAST)
+ min_month = max_month = 11;
+ if (day != ANY)
+ min_day = max_day = day;
+
+ holiday_name = yacc_string;
+ for (mn=min_month; mn <= max_month; mn++)
+ if (day == LAST) {
+ (void)date_to_time(monthlen[mn], mn, parse_year,
+ &wday1, 0, 0);
+ nd = (((wday - wday1 + 7) % 7) -
+ ((rel == BEFORE) ? 7 : 0)) % 7;
+ for (l=0; l < length; l++)
+ setliteraldate(mn,monthlen[mn]+nd, off+l, &ddup);
+ } else
+ for (dy=min_day; dy <= max_day; dy++) {
+ (void)date_to_time(dy, mn, parse_year,
+ &wday1, 0, 0);
+ nd = (((wday - wday1 + 7) % 7) -
+ ((rel == BEFORE) ? 7 : 0)) % 7;
+ for (l=0; l < length; l++)
+ setliteraldate(mn, dy+nd, off+l, &ddup);
+ }
+}
+
+static int conditionalOffset( int day, int month, int year, int cond )
+{
+ int off = 0;
+ int wday = 0;
+ (void)date_to_time( day, month, year, &wday, 0, 0);
+ if ( wday == 0 ) { wday = 7; } /* sunday is 7, not 0 */
+ if ( cond & (1<<wday) ) {
+ /* condition matches -> higher 8 bits contain the possible days to shift to */
+ int to = (cond >> 8);
+ while ( !(to & (1<<((wday+off)%7))) && (off < 8) ) {
+ ++off;
+ }
+ }
+ if ( off >= 8 ) return 0;
+ else return off;
+}
+
+/*
+ * set holiday by date. Ignore holidays in the wrong year. The code is
+ * complicated by expressions such as "any/last/any" (every last day of
+ * the month).
+ */
+
+static void setdate(int month, int day, int year, int off, int conditionaloff, int length)
+{
+ int min_month = 0, max_month = 11;
+ int min_day = 1, max_day = 31;
+ int mn, dy, l;
+ int ddup = 0;
+
+ if (year != ANY) {
+ year %= 100;
+ if (year < 70) year += 100;
+ if (year != parse_year)
+ return;
+ }
+ if (month != ANY)
+ min_month = max_month = month-1;
+ if (month == LAST)
+ min_month = max_month = 11;
+ if (day != ANY)
+ min_day = max_day = day;
+
+ holiday_name = yacc_string;
+ /** TODO: Include the conditionaloff variable. */
+ /** The encoding of the conditional offset is:
+ 8 lower bits: conditions to shift (bit-register, bit 1=mon, ..., bit 7=sun)
+ 8 higher bits: weekday to shift to (bit-register, bit 1=mon, ..., bit 7=sun)
+ */
+ for (mn=min_month; mn <= max_month; mn++) {
+ if (day == LAST) {
+ int newoff = off + conditionalOffset( monthlen[mn], mn, parse_year, conditionaloff );
+ for (l=0; l < length; l++)
+ setliteraldate(mn, monthlen[mn], newoff+l, &ddup);
+ } else {
+ for (dy=min_day; dy <= max_day; dy++) {
+ int newoff = off + conditionalOffset( dy, mn, parse_year, conditionaloff );
+ for (l=0; l < length; l++)
+ setliteraldate(mn, dy, newoff+l, &ddup);
+ }
+ }
+ }
+}
+
+
+/*
+ * After the two routines above have removed ambiguities (ANY) and resolved
+ * weekday specifications, this routine registers the holiday in the holiday
+ * array. There are two of these, for full-line holidays (they take away one
+ * appointment line in the month calendar daybox) and "small" holidays, which
+ * appear next to the day number. If the day is already some other holiday,
+ * add a new item to the singly-linked list and insert the holiday there.
+ * <ddup> is information stored for parse_holidays(), it
+ * will free() the holiday name only if its dup field is 0 (because many
+ * string fields can point to the same string, which was allocated only once
+ * by the lexer, and should therefore only be freed once).
+ */
+
+static void setliteraldate(int month, int day, int off, int *ddup)
+{
+ int julian = JULIAN(month, day) + off;
+ /* struct holiday *hp = yacc_small ? &sm_holiday[julian]
+ : &holiday[julian]; */
+ struct holiday *hp = 0;
+
+ if (julian >= 0 && julian <= 365 ) {
+ hp = &holidays[julian];
+ if ( hp->string ) {
+ while (hp->next) { hp = hp->next; }
+ hp->next = malloc( sizeof(struct holiday)*2 );
+ hp = hp->next;
+ hp->next = 0;
+ }
+ if (!*ddup)
+ holiday_name = strdup(holiday_name);
+ hp->string = holiday_name;
+ hp->color = (yacc_stringcolor == 0) ? yacc_daycolor : yacc_stringcolor;
+ hp->dup = (*ddup)++;
+
+ }
+}
+
+
+/*
+ * set a holiday relative to Easter
+ */
+
+static void seteaster(int off, int length, int pascha /*0=Easter, 1=Pascha*/)
+{
+ int ddup = 0; /* flag for later free() */
+ int julian = (pascha ? pascha_julian : easter_julian) + off;
+ /* struct holiday *hp = yacc_small ? &sm_holiday[julian]
+ : &holidays[julian];*/
+ struct holiday *hp = 0;
+
+ holiday_name = yacc_string;
+ while (length-- > 0) {
+ if (julian >= 0 && julian <= 365 ) {
+ hp = &holidays[julian];
+ if ( hp->string ) {
+ while (hp->next) { hp = hp->next; }
+ hp->next = malloc( sizeof(struct holiday)*2 );
+ hp = hp->next;
+ hp->next = 0;
+ }
+ if (!ddup)
+ holiday_name = strdup(holiday_name);
+ hp->string = holiday_name;
+ hp->color = (yacc_stringcolor == 0) ? yacc_daycolor : yacc_stringcolor;
+ hp->dup = ddup++;
+ }
+ julian++;
+ }
+}
+
+
+/*
+ * calculate Easter Sunday as a julian date. I got this from Armin Liebl
+ * <liebla@informatik.tu-muenchen.de>, who got it from Knuth. I hope I got
+ * all this right...
+ */
+
+static int calc_easter(int year)
+{
+ int golden, cent, grcor, clcor, extra, epact, easter;
+
+ golden = (year/19)*(-19);
+ golden += year+1;
+ cent = year/100+1;
+ grcor = (cent*3)/(-4)+12;
+ clcor = ((cent-18)/(-25)+cent-16)/3;
+ extra = (year*5)/4+grcor-10;
+ epact = golden*11+20+clcor+grcor;
+ epact += (epact/30)*(-30);
+ if (epact<=0)
+ epact += 30;
+ if (epact==25) {
+ if (golden>11)
+ epact += 1;
+ } else {
+ if (epact==24)
+ epact += 1;
+ }
+ easter = epact*(-1)+44;
+ if (easter<21)
+ easter += 30;
+ extra += easter;
+ extra += (extra/7)*(-7);
+ extra *= -1;
+ easter += extra+7;
+ easter += 31+28+!(year&3)-1;
+ return(easter);
+}
+
+
+/*
+ * set a holiday relative to Pascha, which is the Christian Orthodox Easter.
+ * Algorithm provided by Efthimios Mavrogeorgiadis <emav@enl.auth.gr>.
+ * Changed 12.9.99 by Efthimios Mavrogeorgiadis <emav@enl.auth.gr>.
+ */
+
+static int calc_pascha(int year) /* Pascha in which year? */
+{
+ int a = year % 19;
+ int b = (19 * a + 15) % 30;
+ int c = (year + (year - (year % 4))/4 + b) % 7;
+ int dd = b - c;
+ int e = dd-3 - (2 - (year-(year%100))/100 + (year-(year%400))/400);
+ int f = (e - (e % 31))/31;
+ int day = e - 30 * f;
+ return(31 + 28+!(year&3) + 31 + (f ? 30 : 0) + day-1);
+}
+
+
+/*
+ * functions used for [] syntax: (Erwin Hugo Achermann <acherman@inf.ethz.ch>)
+ *
+ * day_from_name (str) gets day from symbolic name
+ * day_from_easter () gets day as easter sunday
+ * day_from_monthday (month, day) gets <day> from <month/day>
+ * day_from_wday (day, wday, num) gets num-th day (wday) after <day> day
+ * monthday_from_day (day, *m, *d, *y) gets month/day/cur_year from <day>
+ */
+
+static int day_from_name(char *str)
+{
+ int i;
+ char *name;
+
+ for (i=0; i < 366; i++) {
+ name = holidays[i].string;
+ if (name && !strcmp(str, name))
+ return(i);
+ }
+ return(-1);
+}
+
+
+static int day_from_easter(void)
+{
+ return(easter_julian);
+}
+
+
+static int day_from_monthday(int month, int day)
+{
+ if (month == 13)
+ return(365 + ISLEAPYEAR(parse_year));
+ return(JULIAN(month - 1, day));
+}
+
+
+static void monthday_from_day(int day, int *mn, int *dy, int *yr)
+{
+ int i, len;
+
+ *yr = parse_year;
+ *mn = 0;
+ *dy = 0;
+ if (day < 0)
+ return;
+ for (i=0; i < 12; i++) {
+ len = monthlen[i] + (i == 1 && ISLEAPYEAR(parse_year));
+ if (day < len) {
+ *mn = i + 1;
+ *dy = day + 1;
+ break;
+ }
+ day -= len;
+ }
+}
+
+
+static int day_from_wday(int day, int wday, int num)
+{
+ int wkday, yday, weeknum;
+
+ (void)date_to_time(1, 0, parse_year, &wkday, &yday, &weeknum);
+ day += (wday - wkday - day + 1001) % 7;
+ day += num * 7;
+ return (day);
+}
+
+static void initialize()
+{
+ register struct holiday *hp;
+ register int dy;
+ initialized = 1;
+ for (hp=holidays, dy=0; dy < 366; dy++, hp++)
+ {
+ hp->color = 0;
+ hp->dup = 0;
+ hp->string = 0;
+ hp->next = 0;
+ }
+}
+
+/*** Public Functions ***/
+/*
+ * parse the holiday text file, and set up the holiday arrays for a year.
+ * If year is -1, re-parse the last year parsed (this is used when the
+ * holiday file changes). If there is a CPP_PATH, check if the executable
+ * really exists, and if so, pipe the holioday files through it.
+ * Return an error message if an error occurred, 0 otherwise.
+ */
+
+char *parse_holidays(const char *holidayfile, int year, short force)
+{
+ register struct holiday *hp;
+ register int dy;
+ short piped = 0;
+ if (!initialized)
+ initialize();
+
+ if (year == parse_year && !force)
+ return(0);
+ if (year < 0)
+ year = parse_year;
+ parse_year = year;
+ easter_julian = calc_easter(year + 1900);
+ pascha_julian = calc_pascha(year + 1900);
+
+ for (hp=holidays, dy=0; dy < 366; dy++, hp++)
+ {
+ hp->color = 0;
+ if (hp->string) {
+ if (!hp->dup )
+ free(hp->string);
+ hp->string = 0;
+ }
+ {
+ struct holiday *nx = hp->next;
+ hp->next = 0;
+ while (nx) {
+ struct holiday *nxtmp;
+ if ( nx->string && !nx->dup ) {
+ free( nx->string );
+ }
+ nxtmp=nx;
+ nx = nxtmp->next;
+ free( nxtmp );
+ }
+ }
+ }
+ /* for (hp=sm_holiday, d=0; d < 366; d++, hp++)
+ if (hp->string) {
+ if (!hp->dup)
+ free(hp->string);
+ hp->string = 0;
+ }*/
+
+ filename = holidayfile;
+ if (access(filename, R_OK)) return(0);
+ kcalin = fopen(filename, "r");
+ if (!kcalin) return(0);
+ *errormsg = 0;
+ kcallineno = 0;
+ kcalparse();
+ if (piped) pclose(kcalin);
+ else fclose(kcalin);
+ if (*errormsg) return(errormsg);
+
+ return(0);
+}
+
diff --git a/libkholidays/parseholiday.h b/libkholidays/parseholiday.h
new file mode 100644
index 000000000..709aa5671
--- /dev/null
+++ b/libkholidays/parseholiday.h
@@ -0,0 +1,112 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ NUMBER = 258,
+ MONTH = 259,
+ WDAY = 260,
+ COLOR = 261,
+ STRING = 262,
+ IN = 263,
+ PLUS = 264,
+ MINUS = 265,
+ SMALL = 266,
+ CYEAR = 267,
+ LEAPYEAR = 268,
+ SHIFT = 269,
+ IF = 270,
+ LENGTH = 271,
+ EASTER = 272,
+ EQ = 273,
+ NE = 274,
+ LE = 275,
+ GE = 276,
+ LT = 277,
+ GT = 278,
+ PASCHA = 279,
+ OR = 280,
+ AND = 281,
+ UMINUS = 282
+ };
+#endif
+/* Tokens. */
+#define NUMBER 258
+#define MONTH 259
+#define WDAY 260
+#define COLOR 261
+#define STRING 262
+#define IN 263
+#define PLUS 264
+#define MINUS 265
+#define SMALL 266
+#define CYEAR 267
+#define LEAPYEAR 268
+#define SHIFT 269
+#define IF 270
+#define LENGTH 271
+#define EASTER 272
+#define EQ 273
+#define NE 274
+#define LE 275
+#define GE 276
+#define LT 277
+#define GT 278
+#define PASCHA 279
+#define OR 280
+#define AND 281
+#define UMINUS 282
+
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 111 "parseholiday.y"
+{ int ival; char *sval; }
+/* Line 1529 of yacc.c. */
+#line 105 "parseholiday.h"
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern YYSTYPE kcallval;
+
diff --git a/libkholidays/parseholiday.y b/libkholidays/parseholiday.y
new file mode 100644
index 000000000..fd03b11d2
--- /dev/null
+++ b/libkholidays/parseholiday.y
@@ -0,0 +1,715 @@
+%{
+/*
+ * deals with the holiday file. A yacc parser is used to parse the file.
+ * All the holidays of the specified year are calculated at once and stored
+ * in two arrays that have one entry for each day of the year. The day
+ * drawing routines just use the julian date to index into these arrays.
+ * There are two arrays because holidays can be printed either on a full
+ * line under the day number, or as a small line to the right of the day
+ * number. It's convenient to have both.
+ *
+ * parse_holidays(year, force) read the holiday file and evaluate
+ * all the holiday definitions for
+ * <year>. Sets holiday and sm_holiday
+ * arrays. If force is set, re-eval even
+ * if year is the same as last time.
+ *
+ * Taken from plan by Thomas Driemeyer <thomas@bitrot.de>
+ * Adapted for use in KOrganizer by Preston Brown <pbrown@kde.org> and
+ * Reinhold Kainhofer <reinhold@kainhofer.com>
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+#include <stdlib.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+
+#include <limits.h>
+
+/*** Macro definitions and constants ***/
+/*
+ * Before you mail and complain that the following macro is incorrect,
+ * please consider that this is one of the main battlegrounds of the
+ * Annual Usenet Flame Wars. 2000 is a leap year. Just trust me on this :-)
+ */
+
+#define ISLEAPYEAR(y) !((y)&3)
+#define JULIAN(m,d) (monthbegin[m] + (d)-1+((m)>1 && ISLEAPYEAR(parse_year)))
+#define LAST 999
+#define ANY 0
+#define BEFORE -1
+#define AFTER -2
+/**** Public forward declarations ****/
+char *parse_holidays(const char *holidays, int year, short force);
+
+/**** Private forward declarations ****/
+extern int kcallex(void); /* external lexical analyzer */
+static void kcalerror(const char *s);
+static time_t date_to_time(int day, int month, int year,
+ int *wkday, int *julian, int *weeknum);
+static time_t tm_to_time(struct tm *tm);
+static int day_from_name(char *str);
+static int day_from_easter(void);
+static int day_from_monthday(int month, int day);
+static int day_from_wday(int day, int wday, int num);
+static void monthday_from_day(int day, int *m, int *d, int *y);
+static int calc_easter(int year);
+static int calc_pascha(int year);
+static void setliteraldate(int month, int day, int off, int *ddup);
+static void seteaster(int off, int length, int pascha);
+static void setdate(int month, int day, int year, int off, int conditionaloff, int length);
+static void setwday(int num, int wday, int month, int off, int length);
+static void setdoff(int wday, int rel, int month, int day,
+ int year, int off, int length);
+/*** Variables and structures ***/
+static int m, d, y;
+int kcallineno; /* current line # being parsed */
+FILE *kcalin; /* file currently being processed */
+int yacc_small; /* small string or on its own line? */
+int yacc_stringcolor; /* color of holiday name text, 1..8 */
+char *yacc_string; /* holiday name text */
+int yacc_daycolor; /* color of day number, 1..8 */
+char *progname; /* argv[0] */
+int parse_year = -1; /* year being parsed, 0=1970..99=2069*/
+static const char *filename; /* holiday filename */
+static char errormsg[PATH_MAX+200];/* error message if any, or "" */
+static int easter_julian; /* julian date of Easter Sunday */
+static int pascha_julian; /* julian date of Pascha Sunday */
+static char *holiday_name; /* strdup'd yacc_string */
+short monthlen[12] = { 31, 28, 31, 30,
+ 31, 30, 31, 31,
+ 30, 31, 30, 31 };
+short monthbegin[12] = { 0, 31, 59, 90,
+ 120, 151, 181,
+ 212, 243, 273,
+ 304, 334 };
+
+/* struct holiday;*/
+struct holiday {
+ char *string; /* name of holiday, 0=not a holiday */
+ int color;
+ unsigned short dup; /* reference count */
+ struct holiday *next;
+};
+
+struct holiday holidays[366]; /* info for each day, separate for */
+/*struct holiday sm_holiday[366];*/ /* full-line texts under, and small */
+ /* texts next to day number */
+static int initialized=0;
+%}
+
+%union { int ival; char *sval; }
+%type <ival> color offset conditionaloffset length expr pexpr number month reldate wdaycondition
+%token <ival> NUMBER MONTH WDAY COLOR
+%token <sval> STRING
+%token IN PLUS MINUS SMALL CYEAR LEAPYEAR SHIFT IF
+%token LENGTH EASTER EQ NE LE GE LT GT PASCHA
+
+%left OR
+%left AND
+%right EQ NE LE GE LT GT
+%left '-' '+'
+%left '*' '/' '%'
+%nonassoc '!'
+%nonassoc UMINUS
+%left '?' ':'
+
+%start list
+
+%%
+list :
+ | list small color STRING color { yacc_stringcolor = $3;
+ yacc_string = $4;
+ yacc_daycolor = $5; }
+ entry { free(yacc_string); }
+ ;
+
+small : { yacc_small = 0; }
+ | SMALL { yacc_small = 1; }
+ ;
+
+ color : { $$ = 0; }
+ | COLOR { $$ = $1; }
+ ;
+
+entry : EASTER offset length { seteaster($2, $3, 0); }
+ | PASCHA offset length { seteaster($2, $3, 1); }
+ | date offset conditionaloffset length { setdate( m, d, y, $2, $3, $4);}
+ | WDAY offset length { setwday( 0, $1, 0, $2, $3);}
+ | pexpr WDAY offset length { setwday($1, $2, 0, $3, $4);}
+ | pexpr WDAY IN month offset length { setwday($1, $2, $4, $5, $6);}
+ | WDAY pexpr date offset length { setdoff($1, $2,m,d,y,$4,$5);}
+ ;
+
+ offset : { $$ = 0; }
+ | PLUS expr { $$ = $2; }
+ | MINUS expr { $$ = -$2; }
+ ;
+
+ conditionaloffset : { $$ = 0; }
+ | SHIFT wdaycondition IF wdaycondition { $$ = ($2<<8) | $4;printf("Shift to %i if %i\n", $2, $4); }
+ ;
+
+ wdaycondition : { $$ = 0; }
+ | WDAY { $$ = (1<<$1); }
+ | WDAY OR wdaycondition { $$ = (1<<$1) | $3; }
+ ;
+
+ length : { $$ = 1; }
+ | LENGTH expr { $$ = $2; }
+ ;
+
+ date : pexpr '.' month { m = $3; d = $1; y = 0; }
+ | pexpr '.' month '.' { m = $3; d = $1; y = 0; }
+ | pexpr '.' month '.' expr { m = $3; d = $1; y = $5; }
+ | month '/' pexpr { m = $1; d = $3; y = 0; }
+ | month '/' pexpr '/' pexpr { m = $1; d = $3; y = $5; }
+ | MONTH pexpr { m = $1; d = $2; y = 0; }
+ | MONTH pexpr pexpr { m = $1; d = $2; y = $3; }
+ | pexpr MONTH { m = $2; d = $1; y = 0; }
+ | pexpr MONTH pexpr { m = $2; d = $1; y = $3; }
+ | pexpr '.' MONTH pexpr { m = $3; d = $1; y = $4; }
+ | pexpr { monthday_from_day($1,
+ &m, &d, &y); }
+ ;
+
+ reldate : STRING { $$ = day_from_name($1); }
+ | EASTER { $$ = day_from_easter(); }
+ | pexpr '.' month { $$ = day_from_monthday
+ ($3, $1); }
+ | pexpr '.' month '.' { $$ = day_from_monthday
+ ($3, $1); }
+ | month '/' pexpr { $$ = day_from_monthday
+ ($1, $3); }
+ | pexpr MONTH { $$ = day_from_monthday
+ ($2, $1); }
+ | MONTH pexpr { $$ = day_from_monthday
+ ($1, $2); }
+ | WDAY pexpr pexpr { $$ = day_from_wday($3, $1,
+ $2 == -1 ? -1 : 0); }
+ | pexpr WDAY IN month { int day=day_from_monthday($4,1);
+ $$ = $1 == 999
+ ? day_from_wday(day+1,$2,-1)
+ : day_from_wday(day,$2,$1-1);}
+ ;
+
+ month : MONTH | pexpr;
+
+ expr : pexpr { $$ = $1; }
+ | expr OR expr { $$ = $1 || $3; }
+ | expr AND expr { $$ = $1 && $3; }
+ | expr EQ expr { $$ = $1 == $3; }
+ | expr NE expr { $$ = $1 != $3; }
+ | expr LE expr { $$ = $1 <= $3; }
+ | expr GE expr { $$ = $1 >= $3; }
+ | expr LT expr { $$ = $1 < $3; }
+ | expr GT expr { $$ = $1 > $3; }
+ | expr '+' expr { $$ = $1 + $3; }
+ | expr '-' expr { $$ = $1 - $3; }
+ | expr '*' expr { $$ = $1 * $3; }
+ | expr '/' expr { $$ = $3 ? $1 / $3 : 0; }
+ | expr '%' expr { $$ = $3 ? $1 % $3 : 0; }
+ | expr '?' expr ':' expr { $$ = $1 ? $3 : $5; }
+ | '!' expr { $$ = !$2; }
+ | '[' reldate ']' { $$ = $2; }
+ ;
+
+ pexpr : '(' expr ')' { $$ = $2; }
+ | number { $$ = $1; }
+ ;
+
+ number : NUMBER
+ | '-' NUMBER %prec UMINUS { $$ = -$2; }
+ | CYEAR { $$ = parse_year; }
+ | LEAPYEAR pexpr { $$ = !(($2) & 3); }
+ ;
+%%
+
+/*** Private Yacc callbacks and helper functions ***/
+static void kcalerror(const char *msg)
+{
+ fprintf(stderr, "%s: %s in line %d of %s\n", progname,
+ msg, kcallineno+1, filename);
+ if (!*errormsg)
+ snprintf(errormsg,sizeof(errormsg),
+ "Problem with holiday file %s:\n%.80s in line %d",
+ filename, msg, kcallineno+1);
+}
+
+static time_t date_to_time(int day, int month, int year,
+ int *wkday, int *julian, int *weeknum)
+{
+ struct tm tm;
+ time_t ttime;
+
+ tm.tm_sec = 0;
+ tm.tm_min = 0;
+ tm.tm_hour = 0;
+ tm.tm_mday = day;
+ tm.tm_mon = month;
+ tm.tm_year = year;
+ ttime = tm_to_time(&tm);
+ if (wkday)
+ *wkday = tm.tm_wday;
+ if (julian)
+ *julian = tm.tm_yday;
+ if (weeknum)
+ *weeknum = 0
+ ? tm.tm_yday / 7
+ : tm.tm_yday ? ((tm.tm_yday - 1) /7) + 1 : 0;
+ return(ttime == -1 || day != tm.tm_mday ? 0 : ttime);
+}
+
+static time_t tm_to_time(struct tm *tm)
+{
+ time_t t; /* return value */
+
+ t = monthbegin[tm->tm_mon] /* full months */
+ + tm->tm_mday-1 /* full days */
+ + (!(tm->tm_year & 3) && tm->tm_mon > 1); /* leap day this year*/
+ tm->tm_yday = t;
+ t += 365 * (tm->tm_year - 70) /* full years */
+ + (tm->tm_year - 69)/4; /* past leap days */
+ tm->tm_wday = (t + 4) % 7;
+
+ t = t*86400 + tm->tm_hour*3600 + tm->tm_min*60 + tm->tm_sec;
+ if (tm->tm_mday > monthlen[tm->tm_mon] +
+ (!(tm->tm_year & 3) && tm->tm_mon == 1))
+ return((time_t)-1);
+ return(t);
+}
+
+/*
+ * set holiday by weekday (monday..sunday). The expression is
+ * "every <num>-th <wday> of <month> plus <off> days". num and month
+ * can be ANY or LAST.
+ */
+
+static void setwday(int num, int wday, int month, int off, int length)
+{
+ int min_month = 0, max_month = 11;
+ int min_num = 0, max_num = 4;
+ int mn, n, dy, l, mlen, wday1;
+ int ddup = 0;
+
+ if (month != ANY)
+ min_month = max_month = month-1;
+ if (month == LAST)
+ min_month = max_month = 11;
+ if (num != ANY)
+ min_num = max_num = num-1;
+
+ holiday_name = yacc_string;
+ for (mn=min_month; mn <= max_month; mn++) {
+ (void)date_to_time(1, mn, parse_year, &wday1, 0, 0);
+ dy = (wday-1 - (wday1-1) +7) % 7 + 1;
+ mlen = monthlen[mn] + (mn==1 && ISLEAPYEAR(parse_year));
+ if (num == LAST)
+ for (l=0; l < length; l++)
+ setliteraldate(mn, dy+28<=mlen ? dy+28 : dy+21,
+ off+l, &ddup);
+ else
+ for (dy+=min_num*7, n=min_num; n <= max_num; n++, dy+=7)
+ if (dy >= 1 && dy <= mlen)
+ for (l=0; l < length; l++)
+ setliteraldate(mn,dy,off+l,&ddup);
+ }
+}
+
+/*
+ * set holiday by weekday (monday..sunday) date offset. The expression is
+ * "every <wday> before/after <date> plus <off> days".
+ * (This routine contributed by Peter Littlefield <plittle@sofkin.ca>)
+ */
+
+static void setdoff(int wday, int rel, int month, int day,
+ int year, int off, int length)
+{
+ int min_month = 0, max_month = 11;
+ int min_day = 1, max_day = 31;
+ int mn, dy, nd, l, wday1;
+ int ddup = 0;
+
+ if (year != ANY) {
+ year %= 100;
+ if (year < 70) year += 100;
+ if (year != parse_year)
+ return;
+ }
+ if (month != ANY)
+ min_month = max_month = month-1;
+ if (month == LAST)
+ min_month = max_month = 11;
+ if (day != ANY)
+ min_day = max_day = day;
+
+ holiday_name = yacc_string;
+ for (mn=min_month; mn <= max_month; mn++)
+ if (day == LAST) {
+ (void)date_to_time(monthlen[mn], mn, parse_year,
+ &wday1, 0, 0);
+ nd = (((wday - wday1 + 7) % 7) -
+ ((rel == BEFORE) ? 7 : 0)) % 7;
+ for (l=0; l < length; l++)
+ setliteraldate(mn,monthlen[mn]+nd, off+l, &ddup);
+ } else
+ for (dy=min_day; dy <= max_day; dy++) {
+ (void)date_to_time(dy, mn, parse_year,
+ &wday1, 0, 0);
+ nd = (((wday - wday1 + 7) % 7) -
+ ((rel == BEFORE) ? 7 : 0)) % 7;
+ for (l=0; l < length; l++)
+ setliteraldate(mn, dy+nd, off+l, &ddup);
+ }
+}
+
+static int conditionalOffset( int day, int month, int year, int cond )
+{
+ int off = 0;
+ int wday = 0;
+ (void)date_to_time( day, month, year, &wday, 0, 0);
+ if ( wday == 0 ) { wday = 7; } /* sunday is 7, not 0 */
+ if ( cond & (1<<wday) ) {
+ /* condition matches -> higher 8 bits contain the possible days to shift to */
+ int to = (cond >> 8);
+ while ( !(to & (1<<((wday+off)%7))) && (off < 8) ) {
+ ++off;
+ }
+ }
+ if ( off >= 8 ) return 0;
+ else return off;
+}
+
+/*
+ * set holiday by date. Ignore holidays in the wrong year. The code is
+ * complicated by expressions such as "any/last/any" (every last day of
+ * the month).
+ */
+
+static void setdate(int month, int day, int year, int off, int conditionaloff, int length)
+{
+ int min_month = 0, max_month = 11;
+ int min_day = 1, max_day = 31;
+ int mn, dy, l;
+ int ddup = 0;
+
+ if (year != ANY) {
+ year %= 100;
+ if (year < 70) year += 100;
+ if (year != parse_year)
+ return;
+ }
+ if (month != ANY)
+ min_month = max_month = month-1;
+ if (month == LAST)
+ min_month = max_month = 11;
+ if (day != ANY)
+ min_day = max_day = day;
+
+ holiday_name = yacc_string;
+ /** TODO: Include the conditionaloff variable. */
+ /** The encoding of the conditional offset is:
+ 8 lower bits: conditions to shift (bit-register, bit 1=mon, ..., bit 7=sun)
+ 8 higher bits: weekday to shift to (bit-register, bit 1=mon, ..., bit 7=sun)
+ */
+ for (mn=min_month; mn <= max_month; mn++) {
+ if (day == LAST) {
+ int newoff = off + conditionalOffset( monthlen[mn], mn, parse_year, conditionaloff );
+ for (l=0; l < length; l++)
+ setliteraldate(mn, monthlen[mn], newoff+l, &ddup);
+ } else {
+ for (dy=min_day; dy <= max_day; dy++) {
+ int newoff = off + conditionalOffset( dy, mn, parse_year, conditionaloff );
+ for (l=0; l < length; l++)
+ setliteraldate(mn, dy, newoff+l, &ddup);
+ }
+ }
+ }
+}
+
+
+/*
+ * After the two routines above have removed ambiguities (ANY) and resolved
+ * weekday specifications, this routine registers the holiday in the holiday
+ * array. There are two of these, for full-line holidays (they take away one
+ * appointment line in the month calendar daybox) and "small" holidays, which
+ * appear next to the day number. If the day is already some other holiday,
+ * add a new item to the singly-linked list and insert the holiday there.
+ * <ddup> is information stored for parse_holidays(), it
+ * will free() the holiday name only if its dup field is 0 (because many
+ * string fields can point to the same string, which was allocated only once
+ * by the lexer, and should therefore only be freed once).
+ */
+
+static void setliteraldate(int month, int day, int off, int *ddup)
+{
+ int julian = JULIAN(month, day) + off;
+ /* struct holiday *hp = yacc_small ? &sm_holiday[julian]
+ : &holiday[julian]; */
+ struct holiday *hp = 0;
+
+ if (julian >= 0 && julian <= 365 ) {
+ hp = &holidays[julian];
+ if ( hp->string ) {
+ while (hp->next) { hp = hp->next; }
+ hp->next = malloc( sizeof(struct holiday)*2 );
+ hp = hp->next;
+ hp->next = 0;
+ }
+ if (!*ddup)
+ holiday_name = strdup(holiday_name);
+ hp->string = holiday_name;
+ hp->color = (yacc_stringcolor == 0) ? yacc_daycolor : yacc_stringcolor;
+ hp->dup = (*ddup)++;
+
+ }
+}
+
+
+/*
+ * set a holiday relative to Easter
+ */
+
+static void seteaster(int off, int length, int pascha /*0=Easter, 1=Pascha*/)
+{
+ int ddup = 0; /* flag for later free() */
+ int julian = (pascha ? pascha_julian : easter_julian) + off;
+ /* struct holiday *hp = yacc_small ? &sm_holiday[julian]
+ : &holidays[julian];*/
+ struct holiday *hp = 0;
+
+ holiday_name = yacc_string;
+ while (length-- > 0) {
+ if (julian >= 0 && julian <= 365 ) {
+ hp = &holidays[julian];
+ if ( hp->string ) {
+ while (hp->next) { hp = hp->next; }
+ hp->next = malloc( sizeof(struct holiday)*2 );
+ hp = hp->next;
+ hp->next = 0;
+ }
+ if (!ddup)
+ holiday_name = strdup(holiday_name);
+ hp->string = holiday_name;
+ hp->color = (yacc_stringcolor == 0) ? yacc_daycolor : yacc_stringcolor;
+ hp->dup = ddup++;
+ }
+ julian++;
+ }
+}
+
+
+/*
+ * calculate Easter Sunday as a julian date. I got this from Armin Liebl
+ * <liebla@informatik.tu-muenchen.de>, who got it from Knuth. I hope I got
+ * all this right...
+ */
+
+static int calc_easter(int year)
+{
+ int golden, cent, grcor, clcor, extra, epact, easter;
+
+ golden = (year/19)*(-19);
+ golden += year+1;
+ cent = year/100+1;
+ grcor = (cent*3)/(-4)+12;
+ clcor = ((cent-18)/(-25)+cent-16)/3;
+ extra = (year*5)/4+grcor-10;
+ epact = golden*11+20+clcor+grcor;
+ epact += (epact/30)*(-30);
+ if (epact<=0)
+ epact += 30;
+ if (epact==25) {
+ if (golden>11)
+ epact += 1;
+ } else {
+ if (epact==24)
+ epact += 1;
+ }
+ easter = epact*(-1)+44;
+ if (easter<21)
+ easter += 30;
+ extra += easter;
+ extra += (extra/7)*(-7);
+ extra *= -1;
+ easter += extra+7;
+ easter += 31+28+!(year&3)-1;
+ return(easter);
+}
+
+
+/*
+ * set a holiday relative to Pascha, which is the Christian Orthodox Easter.
+ * Algorithm provided by Efthimios Mavrogeorgiadis <emav@enl.auth.gr>.
+ * Changed 12.9.99 by Efthimios Mavrogeorgiadis <emav@enl.auth.gr>.
+ */
+
+static int calc_pascha(int year) /* Pascha in which year? */
+{
+ int a = year % 19;
+ int b = (19 * a + 15) % 30;
+ int c = (year + (year - (year % 4))/4 + b) % 7;
+ int dd = b - c;
+ int e = dd-3 - (2 - (year-(year%100))/100 + (year-(year%400))/400);
+ int f = (e - (e % 31))/31;
+ int day = e - 30 * f;
+ return(31 + 28+!(year&3) + 31 + (f ? 30 : 0) + day-1);
+}
+
+
+/*
+ * functions used for [] syntax: (Erwin Hugo Achermann <acherman@inf.ethz.ch>)
+ *
+ * day_from_name (str) gets day from symbolic name
+ * day_from_easter () gets day as easter sunday
+ * day_from_monthday (month, day) gets <day> from <month/day>
+ * day_from_wday (day, wday, num) gets num-th day (wday) after <day> day
+ * monthday_from_day (day, *m, *d, *y) gets month/day/cur_year from <day>
+ */
+
+static int day_from_name(char *str)
+{
+ int i;
+ char *name;
+
+ for (i=0; i < 366; i++) {
+ name = holidays[i].string;
+ if (name && !strcmp(str, name))
+ return(i);
+ }
+ return(-1);
+}
+
+
+static int day_from_easter(void)
+{
+ return(easter_julian);
+}
+
+
+static int day_from_monthday(int month, int day)
+{
+ if (month == 13)
+ return(365 + ISLEAPYEAR(parse_year));
+ return(JULIAN(month - 1, day));
+}
+
+
+static void monthday_from_day(int day, int *mn, int *dy, int *yr)
+{
+ int i, len;
+
+ *yr = parse_year;
+ *mn = 0;
+ *dy = 0;
+ if (day < 0)
+ return;
+ for (i=0; i < 12; i++) {
+ len = monthlen[i] + (i == 1 && ISLEAPYEAR(parse_year));
+ if (day < len) {
+ *mn = i + 1;
+ *dy = day + 1;
+ break;
+ }
+ day -= len;
+ }
+}
+
+
+static int day_from_wday(int day, int wday, int num)
+{
+ int wkday, yday, weeknum;
+
+ (void)date_to_time(1, 0, parse_year, &wkday, &yday, &weeknum);
+ day += (wday - wkday - day + 1001) % 7;
+ day += num * 7;
+ return (day);
+}
+
+static void initialize()
+{
+ register struct holiday *hp;
+ register int dy;
+ initialized = 1;
+ for (hp=holidays, dy=0; dy < 366; dy++, hp++)
+ {
+ hp->color = 0;
+ hp->dup = 0;
+ hp->string = 0;
+ hp->next = 0;
+ }
+}
+
+/*** Public Functions ***/
+/*
+ * parse the holiday text file, and set up the holiday arrays for a year.
+ * If year is -1, re-parse the last year parsed (this is used when the
+ * holiday file changes). If there is a CPP_PATH, check if the executable
+ * really exists, and if so, pipe the holioday files through it.
+ * Return an error message if an error occurred, 0 otherwise.
+ */
+
+char *parse_holidays(const char *holidayfile, int year, short force)
+{
+ register struct holiday *hp;
+ register int dy;
+ short piped = 0;
+ if (!initialized)
+ initialize();
+
+ if (year == parse_year && !force)
+ return(0);
+ if (year < 0)
+ year = parse_year;
+ parse_year = year;
+ easter_julian = calc_easter(year + 1900);
+ pascha_julian = calc_pascha(year + 1900);
+
+ for (hp=holidays, dy=0; dy < 366; dy++, hp++)
+ {
+ hp->color = 0;
+ if (hp->string) {
+ if (!hp->dup )
+ free(hp->string);
+ hp->string = 0;
+ }
+ {
+ struct holiday *nx = hp->next;
+ hp->next = 0;
+ while (nx) {
+ struct holiday *nxtmp;
+ if ( nx->string && !nx->dup ) {
+ free( nx->string );
+ }
+ nxtmp=nx;
+ nx = nxtmp->next;
+ free( nxtmp );
+ }
+ }
+ }
+ /* for (hp=sm_holiday, d=0; d < 366; d++, hp++)
+ if (hp->string) {
+ if (!hp->dup)
+ free(hp->string);
+ hp->string = 0;
+ }*/
+
+ filename = holidayfile;
+ if (access(filename, R_OK)) return(0);
+ kcalin = fopen(filename, "r");
+ if (!kcalin) return(0);
+ *errormsg = 0;
+ kcallineno = 0;
+ kcalparse();
+ if (piped) pclose(kcalin);
+ else fclose(kcalin);
+ if (*errormsg) return(errormsg);
+
+ return(0);
+}
diff --git a/libkholidays/scanholiday.c b/libkholidays/scanholiday.c
new file mode 100644
index 000000000..4ea97560f
--- /dev/null
+++ b/libkholidays/scanholiday.c
@@ -0,0 +1,2037 @@
+#define yy_create_buffer kcal_create_buffer
+#define yy_delete_buffer kcal_delete_buffer
+#define yy_scan_buffer kcal_scan_buffer
+#define yy_scan_string kcal_scan_string
+#define yy_scan_bytes kcal_scan_bytes
+#define yy_flex_debug kcal_flex_debug
+#define yy_init_buffer kcal_init_buffer
+#define yy_flush_buffer kcal_flush_buffer
+#define yy_load_buffer_state kcal_load_buffer_state
+#define yy_switch_to_buffer kcal_switch_to_buffer
+#define yyin kcalin
+#define yyleng kcalleng
+#define yylex kcallex
+#define yyout kcalout
+#define yyrestart kcalrestart
+#define yytext kcaltext
+
+#line 19 "scanholiday.c"
+/* A lexical scanner generated by flex*/
+
+/* Scanner skeleton version:
+ * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+#include <unistd.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator). This
+ * avoids problems with code like:
+ *
+ * if ( condition_holds )
+ * yyless( 5 );
+ * else
+ * do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ *yy_cp = yy_hold_char; \
+ YY_RESTORE_YY_MORE_OFFSET \
+ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* Some routines like yy_flex_realloc() are emitted as static but are
+ not called by all lexers. This generates warnings in some compilers,
+ notably GCC. Arrange to suppress these. */
+#ifdef __GNUC__
+#define YY_MAY_BE_UNUSED __attribute__((unused))
+#else
+#define YY_MAY_BE_UNUSED
+#endif
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+ };
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+
+#define yywrap() 1
+#define YY_SKIP_YYWRAP
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ yytext_ptr = yy_bp; \
+ yyleng = (int) (yy_cp - yy_bp); \
+ yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 69
+#define YY_END_OF_BUFFER 70
+static yyconst short int yy_accept[280] =
+ { 0,
+ 0, 0, 70, 68, 3, 3, 4, 68, 68, 4,
+ 68, 33, 33, 33, 33, 33, 33, 64, 68, 65,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 4, 61, 0, 34, 0, 1, 66, 33, 0, 0,
+ 0, 0, 0, 62, 60, 63, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 41, 40, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 38, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 39, 0, 0, 0, 0, 67, 0,
+
+ 2, 24, 25, 26, 27, 28, 0, 30, 0, 0,
+ 0, 0, 0, 0, 36, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 9, 0, 0, 0, 0, 0, 0, 52,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 55,
+ 57, 37, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 11, 10, 29, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 42, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 45, 0, 32,
+
+ 8, 0, 0, 51, 0, 0, 35, 0, 0, 0,
+ 53, 0, 0, 0, 0, 7, 43, 0, 0, 0,
+ 0, 0, 0, 0, 50, 44, 0, 0, 0, 0,
+ 0, 58, 0, 12, 31, 0, 47, 0, 21, 0,
+ 0, 49, 0, 17, 0, 0, 48, 0, 0, 23,
+ 0, 0, 0, 0, 54, 0, 0, 5, 0, 56,
+ 0, 14, 0, 0, 0, 18, 0, 59, 16, 6,
+ 46, 15, 22, 0, 20, 0, 13, 19, 0
+ } ;
+
+static yyconst int yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 4, 5, 6, 1, 7, 8, 1, 7,
+ 7, 7, 7, 1, 7, 7, 7, 9, 10, 11,
+ 12, 13, 14, 9, 9, 9, 9, 15, 1, 16,
+ 17, 18, 7, 1, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 1, 35, 36, 37, 38, 39, 40, 1, 41, 1,
+ 7, 1, 7, 1, 1, 1, 19, 20, 21, 22,
+
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 1, 35, 36, 37, 38, 39, 40, 1,
+ 41, 1, 1, 42, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst int yy_meta[43] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
+ 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
+ 1, 1
+ } ;
+
+static yyconst short int yy_base[284] =
+ { 0,
+ 0, 292, 306, 308, 308, 308, 288, 299, 300, 308,
+ 294, 34, 265, 17, 15, 18, 263, 282, 281, 280,
+ 28, 33, 255, 38, 39, 41, 260, 35, 46, 50,
+ 52, 261, 49, 53, 270, 63, 54, 65, 269, 249,
+ 287, 308, 284, 308, 285, 308, 308, 86, 250, 264,
+ 263, 258, 257, 308, 308, 308, 245, 240, 245, 254,
+ 254, 71, 258, 235, 254, 238, 250, 252, 69, 233,
+ 243, 246, 308, 308, 236, 45, 231, 83, 78, 234,
+ 233, 225, 226, 308, 226, 223, 238, 222, 84, 231,
+ 238, 224, 79, 308, 232, 85, 227, 91, 308, 250,
+
+ 308, 308, 308, 308, 308, 308, 229, 308, 224, 212,
+ 216, 227, 224, 214, 209, 221, 206, 207, 206, 203,
+ 203, 203, 215, 213, 197, 193, 210, 195, 197, 205,
+ 206, 207, 308, 189, 204, 202, 191, 202, 186, 308,
+ 183, 187, 182, 194, 187, 194, 180, 179, 177, 180,
+ 182, 173, 174, 178, 172, 176, 169, 169, 174, 308,
+ 308, 308, 171, 178, 159, 161, 172, 160, 159, 176,
+ 162, 174, 308, 308, 308, 151, 154, 158, 163, 152,
+ 168, 155, 165, 158, 308, 148, 150, 158, 143, 149,
+ 159, 155, 140, 153, 151, 150, 149, 308, 138, 308,
+
+ 308, 133, 146, 308, 148, 132, 308, 147, 139, 123,
+ 308, 128, 139, 135, 123, 308, 308, 118, 138, 134,
+ 137, 133, 132, 122, 308, 308, 111, 129, 131, 113,
+ 116, 308, 107, 308, 308, 123, 308, 110, 308, 103,
+ 124, 308, 123, 308, 118, 105, 308, 120, 118, 308,
+ 118, 95, 113, 112, 308, 98, 91, 308, 96, 308,
+ 95, 308, 88, 105, 79, 308, 97, 308, 308, 308,
+ 308, 308, 308, 79, 308, 71, 308, 308, 308, 121,
+ 123, 109, 125
+ } ;
+
+static yyconst short int yy_def[284] =
+ { 0,
+ 279, 1, 279, 279, 279, 279, 279, 280, 281, 279,
+ 279, 279, 282, 282, 282, 282, 16, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 283, 279, 280, 279, 281, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 283,
+
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 0, 279,
+ 279, 279, 279
+ } ;
+
+static yyconst short int yy_nxt[351] =
+ { 0,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 10, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 4, 28, 29, 4, 30,
+ 31, 32, 33, 34, 35, 36, 37, 4, 4, 38,
+ 39, 40, 48, 48, 48, 48, 48, 48, 50, 51,
+ 279, 57, 279, 279, 52, 61, 64, 66, 73, 58,
+ 65, 59, 62, 68, 75, 60, 74, 69, 77, 83,
+ 79, 85, 78, 70, 126, 71, 127, 67, 80, 93,
+ 84, 88, 86, 76, 81, 89, 94, 96, 90, 112,
+ 97, 95, 120, 91, 48, 48, 48, 48, 48, 48,
+
+ 92, 129, 131, 121, 142, 147, 150, 151, 113, 153,
+ 48, 278, 132, 277, 130, 276, 148, 143, 133, 275,
+ 154, 43, 43, 45, 45, 100, 100, 274, 273, 272,
+ 271, 270, 269, 268, 267, 266, 265, 264, 263, 262,
+ 261, 260, 259, 258, 257, 256, 255, 254, 253, 252,
+ 251, 250, 249, 103, 248, 247, 246, 245, 244, 243,
+ 242, 241, 240, 239, 105, 238, 237, 236, 235, 234,
+ 233, 232, 231, 230, 229, 228, 104, 227, 226, 225,
+ 224, 223, 222, 221, 220, 219, 218, 217, 216, 215,
+ 214, 213, 212, 211, 210, 209, 102, 106, 208, 207,
+
+ 206, 205, 204, 203, 202, 201, 200, 199, 198, 197,
+ 196, 195, 194, 193, 192, 191, 190, 189, 188, 187,
+ 186, 185, 184, 183, 182, 181, 180, 179, 178, 177,
+ 176, 175, 174, 173, 172, 171, 170, 169, 168, 167,
+ 166, 165, 164, 163, 162, 161, 160, 159, 158, 157,
+ 156, 155, 101, 152, 149, 146, 145, 144, 141, 140,
+ 139, 138, 137, 136, 135, 134, 128, 125, 124, 123,
+ 122, 119, 118, 117, 116, 115, 114, 111, 110, 109,
+ 108, 107, 106, 105, 104, 103, 102, 46, 44, 101,
+ 99, 98, 87, 82, 72, 63, 56, 55, 54, 53,
+
+ 49, 47, 46, 44, 42, 279, 41, 3, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279
+ } ;
+
+static yyconst short int yy_chk[351] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 12, 12, 12, 12, 12, 12, 14, 15,
+ 15, 21, 14, 16, 16, 22, 24, 25, 28, 21,
+ 24, 21, 22, 26, 29, 21, 28, 26, 30, 33,
+ 31, 34, 30, 26, 76, 26, 76, 25, 31, 37,
+ 33, 36, 34, 29, 31, 36, 37, 38, 36, 62,
+ 38, 37, 69, 36, 48, 48, 48, 48, 48, 48,
+
+ 36, 78, 79, 69, 89, 93, 96, 96, 62, 98,
+ 282, 276, 79, 274, 78, 267, 93, 89, 79, 265,
+ 98, 280, 280, 281, 281, 283, 283, 264, 263, 261,
+ 259, 257, 256, 254, 253, 252, 251, 249, 248, 246,
+ 245, 243, 241, 240, 238, 236, 233, 231, 230, 229,
+ 228, 227, 224, 223, 222, 221, 220, 219, 218, 215,
+ 214, 213, 212, 210, 209, 208, 206, 205, 203, 202,
+ 199, 197, 196, 195, 194, 193, 192, 191, 190, 189,
+ 188, 187, 186, 184, 183, 182, 181, 180, 179, 178,
+ 177, 176, 172, 171, 170, 169, 168, 167, 166, 165,
+
+ 164, 163, 159, 158, 157, 156, 155, 154, 153, 152,
+ 151, 150, 149, 148, 147, 146, 145, 144, 143, 142,
+ 141, 139, 138, 137, 136, 135, 134, 132, 131, 130,
+ 129, 128, 127, 126, 125, 124, 123, 122, 121, 120,
+ 119, 118, 117, 116, 115, 114, 113, 112, 111, 110,
+ 109, 107, 100, 97, 95, 92, 91, 90, 88, 87,
+ 86, 85, 83, 82, 81, 80, 77, 75, 72, 71,
+ 70, 68, 67, 66, 65, 64, 63, 61, 60, 59,
+ 58, 57, 53, 52, 51, 50, 49, 45, 43, 41,
+ 40, 39, 35, 32, 27, 23, 20, 19, 18, 17,
+
+ 13, 11, 9, 8, 7, 3, 2, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279
+ } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "scanholiday.lex"
+#define INITIAL 0
+#line 2 "scanholiday.lex"
+#include <string.h>
+#include "parseholiday.h"
+#define YY_NO_UNPUT
+#define YY_MAIN 0
+#define YY_NEVER_INTERACTIVE 1
+#define YY_ALWAYS_INTERACTIVE 0
+#define YY_STACK_USED 0
+#line 568 "scanholiday.c"
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( yy_current_buffer->yy_is_interactive ) \
+ { \
+ int c = '*', n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+ && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ if ( yyleng > 0 ) \
+ yy_current_buffer->yy_at_bol = \
+ (yytext[yyleng - 1] == '\n'); \
+ YY_USER_ACTION
+
+YY_DECL
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp = NULL, *yy_bp = NULL;
+ register int yy_act;
+
+#line 13 "scanholiday.lex"
+
+
+#line 725 "scanholiday.c"
+
+ if ( yy_init )
+ {
+ yy_init = 0;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! yy_start )
+ yy_start = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! yy_current_buffer )
+ yy_current_buffer =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_load_buffer_state();
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = yy_c_buf_p;
+
+ /* Support of yytext. */
+ *yy_cp = yy_hold_char;
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = yy_start;
+ yy_current_state += YY_AT_BOL();
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 280 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_current_state != 279 );
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+
+ YY_DO_BEFORE_ACTION;
+
+
+do_action: /* This label is used only to access EOF actions. */
+
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = yy_hold_char;
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 15 "scanholiday.lex"
+;
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 16 "scanholiday.lex"
+;
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 17 "scanholiday.lex"
+;
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 18 "scanholiday.lex"
+{ return(*kcaltext); }
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 20 "scanholiday.lex"
+{ kcallval.ival = 1; return(MONTH); }
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 21 "scanholiday.lex"
+{ kcallval.ival = 2; return(MONTH); }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 22 "scanholiday.lex"
+{ kcallval.ival = 3; return(MONTH); }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 23 "scanholiday.lex"
+{ kcallval.ival = 4; return(MONTH); }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 24 "scanholiday.lex"
+{ kcallval.ival = 5; return(MONTH); }
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 25 "scanholiday.lex"
+{ kcallval.ival = 6; return(MONTH); }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 26 "scanholiday.lex"
+{ kcallval.ival = 7; return(MONTH); }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 27 "scanholiday.lex"
+{ kcallval.ival = 8; return(MONTH); }
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 28 "scanholiday.lex"
+{ kcallval.ival = 9; return(MONTH); }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 29 "scanholiday.lex"
+{ kcallval.ival = 10; return(MONTH); }
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 30 "scanholiday.lex"
+{ kcallval.ival = 11; return(MONTH); }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 31 "scanholiday.lex"
+{ kcallval.ival = 12; return(MONTH); }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 33 "scanholiday.lex"
+{ kcallval.ival = 1; return(WDAY); }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 34 "scanholiday.lex"
+{ kcallval.ival = 2; return(WDAY); }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 35 "scanholiday.lex"
+{ kcallval.ival = 3; return(WDAY); }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 36 "scanholiday.lex"
+{ kcallval.ival = 4; return(WDAY); }
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 37 "scanholiday.lex"
+{ kcallval.ival = 5; return(WDAY); }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 38 "scanholiday.lex"
+{ kcallval.ival = 6; return(WDAY); }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 39 "scanholiday.lex"
+{ kcallval.ival = 7; return(WDAY); }
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 41 "scanholiday.lex"
+{ kcallval.ival = 1; return(NUMBER); }
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 42 "scanholiday.lex"
+{ kcallval.ival = 2; return(NUMBER); }
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 43 "scanholiday.lex"
+{ kcallval.ival = 3; return(NUMBER); }
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 44 "scanholiday.lex"
+{ kcallval.ival = 4; return(NUMBER); }
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 45 "scanholiday.lex"
+{ kcallval.ival = 5; return(NUMBER); }
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 46 "scanholiday.lex"
+{ kcallval.ival = 999; return(NUMBER); }
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 47 "scanholiday.lex"
+{ kcallval.ival = 0; return(NUMBER); }
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 49 "scanholiday.lex"
+{ kcallval.ival = -1; return(NUMBER); }
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 50 "scanholiday.lex"
+{ kcallval.ival = -2; return(NUMBER); }
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 52 "scanholiday.lex"
+{ kcallval.ival = atoi(kcaltext); return(NUMBER); }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 54 "scanholiday.lex"
+{ kcallval.sval = strdup(kcaltext+1);
+ kcallval.sval[strlen(kcallval.sval)-1] = 0;
+ return(STRING); }
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 58 "scanholiday.lex"
+;
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 59 "scanholiday.lex"
+;
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 60 "scanholiday.lex"
+;
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 61 "scanholiday.lex"
+;
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 62 "scanholiday.lex"
+;
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 63 "scanholiday.lex"
+{ return(IN); }
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 64 "scanholiday.lex"
+{ return(IF); }
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 65 "scanholiday.lex"
+{ return(PLUS); }
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 66 "scanholiday.lex"
+{ return(MINUS); }
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 67 "scanholiday.lex"
+{ return(SMALL); }
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 68 "scanholiday.lex"
+{ return(CYEAR); }
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 69 "scanholiday.lex"
+{ return(LEAPYEAR); }
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 70 "scanholiday.lex"
+{ return(EASTER); }
+ YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 71 "scanholiday.lex"
+{ return(PASCHA); }
+ YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 72 "scanholiday.lex"
+{ return(LENGTH); }
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 73 "scanholiday.lex"
+{ return(SHIFT); }
+ YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 75 "scanholiday.lex"
+{ kcallval.ival = 1; return(COLOR); }
+ YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 76 "scanholiday.lex"
+{ kcallval.ival = 2; return(COLOR); }
+ YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 77 "scanholiday.lex"
+{ kcallval.ival = 3; return(COLOR); }
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 78 "scanholiday.lex"
+{ kcallval.ival = 4; return(COLOR); }
+ YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 79 "scanholiday.lex"
+{ kcallval.ival = 5; return(COLOR); }
+ YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 80 "scanholiday.lex"
+{ kcallval.ival = 6; return(COLOR); }
+ YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 81 "scanholiday.lex"
+{ kcallval.ival = 7; return(COLOR); }
+ YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 82 "scanholiday.lex"
+{ kcallval.ival = 8; return(COLOR); }
+ YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 83 "scanholiday.lex"
+{ kcallval.ival = 9; return(COLOR); }
+ YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 85 "scanholiday.lex"
+{ return(EQ); }
+ YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 86 "scanholiday.lex"
+{ return(NE); }
+ YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 87 "scanholiday.lex"
+{ return(LE); }
+ YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 88 "scanholiday.lex"
+{ return(GE); }
+ YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 89 "scanholiday.lex"
+{ return(LT); }
+ YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 90 "scanholiday.lex"
+{ return(GT); }
+ YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 91 "scanholiday.lex"
+{ return(AND);}
+ YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 92 "scanholiday.lex"
+{ return(OR); }
+ YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 94 "scanholiday.lex"
+{ printf("holiday: bad char: %s \n", kcaltext); }
+ YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 96 "scanholiday.lex"
+ECHO;
+ YY_BREAK
+#line 1152 "scanholiday.c"
+case YY_STATE_EOF(INITIAL):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between yy_current_buffer and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yy_current_buffer->yy_input_file = yyin;
+ yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yy_did_buffer_switch_on_eof = 0;
+
+ if ( yywrap() )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p =
+ yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yy_c_buf_p =
+ &yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+ {
+ register char *dest = yy_current_buffer->yy_ch_buf;
+ register char *source = yytext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( yy_current_buffer->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+ else
+ {
+ int num_to_read =
+ yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = yy_current_buffer;
+
+ int yy_c_buf_p_offset =
+ (int) (yy_c_buf_p - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yy_flex_realloc( (void *) b->yy_ch_buf,
+ b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = yy_current_buffer->yy_buf_size -
+ number_to_move - 1;
+#endif
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+ yy_n_chars, num_to_read );
+
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ if ( yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ yy_current_buffer->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ yy_n_chars += number_to_move;
+ yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+ yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+ yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+ return ret_val;
+ }
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = yy_start;
+ yy_current_state += YY_AT_BOL();
+
+ for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 280 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+ }
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+ {
+ register int yy_is_jam;
+ register char *yy_cp = yy_c_buf_p;
+
+ register YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 280 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 279);
+
+ return yy_is_jam ? 0 : yy_current_state;
+ }
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+ {
+ register char *yy_cp = yy_c_buf_p;
+
+ /* undo effects of setting up yytext */
+ *yy_cp = yy_hold_char;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = yy_n_chars + 2;
+ register char *dest = &yy_current_buffer->yy_ch_buf[
+ yy_current_buffer->yy_buf_size + 2];
+ register char *source =
+ &yy_current_buffer->yy_ch_buf[number_to_move];
+
+ while ( source > yy_current_buffer->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ yy_current_buffer->yy_n_chars =
+ yy_n_chars = yy_current_buffer->yy_buf_size;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+
+ yytext_ptr = yy_bp;
+ yy_hold_char = *yy_cp;
+ yy_c_buf_p = yy_cp;
+ }
+#endif /* ifndef YY_NO_UNPUT */
+
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+ {
+ int c;
+
+ *yy_c_buf_p = yy_hold_char;
+
+ if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ /* This was really a NUL. */
+ *yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = yy_c_buf_p - yytext_ptr;
+ ++yy_c_buf_p;
+
+ switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin );
+
+ /* fall through */
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap() )
+ return EOF;
+
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p = yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
+ *yy_c_buf_p = '\0'; /* preserve yytext */
+ yy_hold_char = *++yy_c_buf_p;
+
+ yy_current_buffer->yy_at_bol = (c == '\n');
+
+ return c;
+ }
+#endif /* YY_NO_INPUT */
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+ {
+ if ( ! yy_current_buffer )
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_init_buffer( yy_current_buffer, input_file );
+ yy_load_buffer_state();
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( yy_current_buffer == new_buffer )
+ return;
+
+ if ( yy_current_buffer )
+ {
+ /* Flush out information for old buffer. */
+ *yy_c_buf_p = yy_hold_char;
+ yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ yy_current_buffer = new_buffer;
+ yy_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ yy_did_buffer_switch_on_eof = 1;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+ {
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+ yyin = yy_current_buffer->yy_input_file;
+ yy_hold_char = *yy_c_buf_p;
+ }
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file );
+
+ return b;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+ {
+ if ( ! b )
+ return;
+
+ if ( b == yy_current_buffer )
+ yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yy_flex_free( (void *) b->yy_ch_buf );
+
+ yy_flex_free( (void *) b );
+ }
+
+
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ yy_flush_buffer( b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+ b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+ b->yy_is_interactive = 0;
+#else
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == yy_current_buffer )
+ yy_load_buffer_state();
+ }
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer( b );
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+ {
+ int len;
+ for ( len = 0; yy_str[len]; ++len )
+ ;
+
+ return yy_scan_bytes( yy_str, len );
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+ {
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) yy_flex_alloc( n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
+
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer( buf, n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+ {
+ if ( yy_start_stack_ptr >= yy_start_stack_depth )
+ {
+ yy_size_t new_size;
+
+ yy_start_stack_depth += YY_START_STACK_INCR;
+ new_size = yy_start_stack_depth * sizeof( int );
+
+ if ( ! yy_start_stack )
+ yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+ else
+ yy_start_stack = (int *) yy_flex_realloc(
+ (void *) yy_start_stack, new_size );
+
+ if ( ! yy_start_stack )
+ YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
+
+ yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+ BEGIN(new_state);
+ }
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+ {
+ if ( --yy_start_stack_ptr < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(yy_start_stack[yy_start_stack_ptr]);
+ }
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+ {
+ return yy_start_stack[yy_start_stack_ptr - 1];
+ }
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+ }
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ yytext[yyleng] = yy_hold_char; \
+ yy_c_buf_p = yytext + n; \
+ yy_hold_char = *yy_c_buf_p; \
+ *yy_c_buf_p = '\0'; \
+ yyleng = n; \
+ } \
+ while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+ }
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+ {
+ return (void *) malloc( size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+ {
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ptr );
+ }
+
+#if YY_MAIN
+int main()
+ {
+ yylex();
+ return 0;
+ }
+#endif
+#line 96 "scanholiday.lex"
+
diff --git a/libkholidays/scanholiday.lex b/libkholidays/scanholiday.lex
new file mode 100644
index 000000000..89de88707
--- /dev/null
+++ b/libkholidays/scanholiday.lex
@@ -0,0 +1,96 @@
+%{
+#include <string.h>
+#include "parseholiday.h"
+#define YY_NO_UNPUT
+%}
+
+%option nomain
+%option noyywrap
+%option never-interactive
+%option noalways-interactive
+%option nostack
+
+%%
+
+#.*\n ;
+^:.*\n ;
+[ \t\r\n] ;
+[-+*/%.!?:()\[\]] { return(*kcaltext); }
+
+january { kcallval.ival = 1; return(MONTH); }
+february { kcallval.ival = 2; return(MONTH); }
+march { kcallval.ival = 3; return(MONTH); }
+april { kcallval.ival = 4; return(MONTH); }
+may { kcallval.ival = 5; return(MONTH); }
+june { kcallval.ival = 6; return(MONTH); }
+july { kcallval.ival = 7; return(MONTH); }
+august { kcallval.ival = 8; return(MONTH); }
+september { kcallval.ival = 9; return(MONTH); }
+october { kcallval.ival = 10; return(MONTH); }
+november { kcallval.ival = 11; return(MONTH); }
+december { kcallval.ival = 12; return(MONTH); }
+
+monday { kcallval.ival = 1; return(WDAY); }
+tuesday { kcallval.ival = 2; return(WDAY); }
+wednesday { kcallval.ival = 3; return(WDAY); }
+thursday { kcallval.ival = 4; return(WDAY); }
+friday { kcallval.ival = 5; return(WDAY); }
+saturday { kcallval.ival = 6; return(WDAY); }
+sunday { kcallval.ival = 7; return(WDAY); }
+
+1st|first { kcallval.ival = 1; return(NUMBER); }
+2nd|second { kcallval.ival = 2; return(NUMBER); }
+3rd|third { kcallval.ival = 3; return(NUMBER); }
+4th|fourth { kcallval.ival = 4; return(NUMBER); }
+5th|fifth { kcallval.ival = 5; return(NUMBER); }
+last { kcallval.ival = 999; return(NUMBER); }
+any { kcallval.ival = 0; return(NUMBER); }
+
+before { kcallval.ival = -1; return(NUMBER); }
+after { kcallval.ival = -2; return(NUMBER); }
+
+[0-9]+ { kcallval.ival = atoi(kcaltext); return(NUMBER); }
+
+\"[^"]*\" { kcallval.sval = strdup(kcaltext+1);
+ kcallval.sval[strlen(kcallval.sval)-1] = 0;
+ return(STRING); }
+
+every ;
+day ;
+days ;
+on ;
+to ;
+in { return(IN); }
+if { return(IF); }
+plus { return(PLUS); }
+minus { return(MINUS); }
+small { return(SMALL); }
+year { return(CYEAR); }
+leapyear { return(LEAPYEAR); }
+easter { return(EASTER); }
+pascha { return(PASCHA); }
+length { return(LENGTH); }
+shift { return(SHIFT); }
+
+black { kcallval.ival = 1; return(COLOR); }
+red { kcallval.ival = 2; return(COLOR); }
+green { kcallval.ival = 3; return(COLOR); }
+yellow { kcallval.ival = 4; return(COLOR); }
+blue { kcallval.ival = 5; return(COLOR); }
+magenta { kcallval.ival = 6; return(COLOR); }
+cyan { kcallval.ival = 7; return(COLOR); }
+white { kcallval.ival = 8; return(COLOR); }
+weekend { kcallval.ival = 9; return(COLOR); }
+
+"==" { return(EQ); }
+"!=" { return(NE); }
+"<=" { return(LE); }
+">=" { return(GE); }
+"<" { return(LT); }
+">" { return(GT); }
+"&&" { return(AND);}
+"||" { return(OR); }
+
+. { printf("holiday: bad char: %s \n", kcaltext); }
+
+%%