v07i099: Compute length of any year
sources-request at mirror.TMC.COM
sources-request at mirror.TMC.COM
Wed Jan 21 02:23:27 AEST 1987
Submitted by: seismo!nbires!vianet!devine
Mod.sources: Volume 7, Issue 99
Archive-name: yearlength
Enclosed is a collection of files that deal with determining the actual
length of a calendar year for the years 1 through 9999. I realize that
the program is severely lacking in a good main() but it was only there
for the testing.
Bob Devine
(seismo!nbires!vianet!devine)
--------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting test in a file
# 3. Execute the file with /bin/sh (not csh) to create the files:
#
# READ_ME
# Makefile
# main.c
# days.c
# early.c
# year.tbl
#
# Created by devine (Bob Devine) on Tue Nov 11 20:16:26 MST 1986
#
if test -f 'READ_ME'
then
echo shar: will not over-write existing file "'READ_ME'"
else
echo extracting "'READ_ME'"
sed 's/^X//' >READ_ME <<'SHAR_EOF'
X
X
X This collection of functions attempts to provide the number of
Xdays in a year based upon a selected year and country. It is
Xbeing posted because of a promise I made to the readers of net.lang.c.
X
X There are basically three levels of that can be used in to calculate
Xhow long a year is:
X
X 1. Divisibility by 4 -- this works for the years 1901-2099 and,
X as a result, is suitable for nearly all programs. It can be
X coded as: or a faster version:
X
X if (year % 4 == 0) if ((year & 0x03) == 0)
X days_in_year = 366; days_in_year = 366;
X else else
X days_in_year = 365; days_in_year = 365;
X
X
X 2. Gregorian rules -- this works from the year after your country
X adopted the Gregorian calendar through the forseeable future.
X It can be coded as:
X
X if (year%4 == 0 && year%100 != 0 || year%400 == 0)
X days_in_year = 366;
X else
X days_in_year = 365;
X
X or slightly faster (as Karl Heuer suggested to me via mail):
X
X if ((year%4 == 0) && (year%100 != 0 || year%400 == 0))
X days_in_year = 366;
X else
X days_in_year = 365;
X
X or (depending on how the remainder operator is implemented)
X this is up to 5 times faster by taking advantage of some
X common factors of 100 and 400:
X
X register int ndiv100; /* Boolean for not divisible by 100 */
X
X if ((year&0x3)==0 && (ndiv100=year%100) || (year&0xF)==0 && !ndiv100)
X days_in_year = 366;
X else
X days_in_year = 365;
X
X or even faster by using Karl Heuer's suggestion of reordering
X the expression:
X
X if ((year&0x3)==0 && ((year&0xF)==0 || year%100!=0))
X days_in_year = 366;
X else
X days_in_year = 365;
X
X I believe that this is the fastest possible check for leap years.
X Does anyone know of a fast check for remainders so that the "% 100"
X test can be speeded up?
X
X 3. Country-dependent rules -- which is what this collection of
X functions attempt to do. It gets messy.
X
X
X
XBACKGROUND INFORMATION OF COUNTRY-DEPENDENT RULES
X-------------------------------------------------
X
X When dealing with calendars based on different epochs (e.g., Egyptian,
XRoman Republican, Julian, Augustan, Christian/Gregorian, Jewish, Muslim,
XChinese, Mayan, Japanese) it is easier to convert dates into a scheme that
Xhas a starting date older than that of any of the epochs. Such a scheme
Xwas invented by J. Scalinger in 1583.
X
X However, all years as used by this package are those of the Christian
Xera because that is the most common representation used throughout the
Xworld. Valid years are 1AD through 9999AD. There is no year 0. Negative
Xyears (those BC) are not used in this program because the Julian calendar
Xwas still being changed by Augustus in 8BC (renamed the month Sextilus
Xto August and changed the number of days in several months).
X
X The argument may be made that going to years before the 4th Century AD
Xis fruitless. It is about that time that the Emperor Constantine (he had
Xpreviously converted to Christianity) made the 7 day week official
Xthroughout the Roman Empire. The Celtic calendar had 8 days but the
Xcalendar Moses took with him from Egypt had 7. It's fascinating how
Xcalendars tie in with history. Had the Nazis won WW2, we now might have
Xa calendar based on the birth of Hitler! And it was about that time that
Xthe year of Christ's birth, instead of the start of City of Rome, was
Xsuggested as the basis for counting years.
X
X It is not possible to guarentee the accuracy for very early dates.
XThe references that I consulted occasionally would disagree on dates.
XThere are many difficulties in arriving at a definitive answer for
Xa region's calendar because of national and supernational influences.
XSome of these are: wars that change boundaries; country-dwellers
Xresistance to the calendar change wrought by the city-based government;
Xand religous differences over what is the "right" calendar. Many
XProtestants chose to be "wrong with the calendar rather than right with
Xthe Pope". For examples of such turmoil see any of the *_early() functions.
X
X An assumption that I used to decide when a country should be put
Xin the switched-to-Gregorian calendar list, if I could not find a
Xclear date, was to take the switch over date of its ruling country.
XAll of the South American countries use Spain's date even though
Xthe reality of when countries actually changed is much more complex.
XThe many British colonies use the same year as Great Britain, 1752.
XSee canada_early() for a the type of trouble caused by two dominant
Xcountries: Britain and France. So, a plea to those out there that
Xwant to rule the world: When you do take over, see to that the rules
Xare observed consistently! It makes everything much easier :-)
X
X Some countries did not transistion directly from the Julian to the
XGregorian calendar. An alternate calendar was tried or the calendar
Xwas modified only slightly. See the france_early(), sweden_early(),
Xand ussr_early() functions.
X
X Some of the date/country pairs are historically naive. By all
Xrights, Israeli dates should not exist before 1948. However because
Xthe country of Palestine was following the same year rules prior to
X1948, I allowed it. Many, many such arguments can be made (e.g., how
Xto handle dates in years before the USA gained independence or even
Xbefore it was "discovered" by Columbus/stray Vikings/Anasazi Indians.
XChange the dates to make yourself happy.
X
X The list of countries is not complete. I have no intention of
Xextending it to cover all current, past, and future countries. If
Xyou want to do it yourself, feel free to hack it up.
X
X I would appreciate the reception of any changes/corrections you make!
X
X
XBob Devine
XNovember 1986 (Gregorian style numbering)
X
SHAR_EOF
if test 5865 -ne "`wc -c < 'READ_ME'`"
then
echo shar: error transmitting "'READ_ME'" '(should have been 5865 characters)'
fi
fi
if test -f 'Makefile'
then
echo shar: will not over-write existing file "'Makefile'"
else
echo extracting "'Makefile'"
sed 's/^X//' >Makefile <<'SHAR_EOF'
X# PRINTSERVER makefile
X
X#COPTS =
XCOPTS = -O
X#CDEFS = -DDEBUG
XCDEFS =
XINCDIR =
XCFLAGS = $(COPTS) $(CDEFS) $(INCDIR)
X
XLFLAGS =
XLIBS =
XBIN_DIR =
XPROG = year
X
XCFILES = \
X main.c \
X days.c \
X early.c
X
X
XOFILES = $(CFILES:.c=.o)
XLFILES = $(CFILES:.c=.ln)
X
X.SUFFIXES: .ln
X.c.ln:
X lint -abchu $(INCDIR) $*.c
X
Xbuild : $(PROG)
X
Xpbuild : $(OFILES)
X cc -p -o $(PROG) $(LFLAGS) $(OFILES) $(LIBS)
X
Xall : $(PROG) lint
X
X$(PROG): $(OFILES)
X cc -o $(PROG) $(LFLAGS) $(OFILES) $(LIBS)
X
Xinstall : $(PROG)
X mv $(PROG) $(BIN_DIR)
X
Xlint : $(LFILES)
X
Xclean :
X -rm $(PROG)
X -rm *.o
SHAR_EOF
if test 573 -ne "`wc -c < 'Makefile'`"
then
echo shar: error transmitting "'Makefile'" '(should have been 573 characters)'
fi
fi
if test -f 'main.c'
then
echo shar: will not over-write existing file "'main.c'"
else
echo extracting "'main.c'"
sed 's/^X//' >main.c <<'SHAR_EOF'
X#include <stdio.h>
X
X
Xmain()
X{
X int days_in_year();
X int year;
X int country_code;
X
X while (1)
X {
X printf("\nEnter year and country code: ");
X if (scanf("%d %d", &year, &country_code) == EOF)
X exit(0);
X
X printf("it has %d days\n", days_in_year(year, country_code));
X }
X}
SHAR_EOF
if test 295 -ne "`wc -c < 'main.c'`"
then
echo shar: error transmitting "'main.c'" '(should have been 295 characters)'
fi
fi
if test -f 'days.c'
then
echo shar: will not over-write existing file "'days.c'"
else
echo extracting "'days.c'"
sed 's/^X//' >days.c <<'SHAR_EOF'
X#include <stdio.h>
X
Xstruct country_years
X{
X short greg_switch; /* year according to Christian era */
X int (*weird_years)(); /* function pointer for early years */
X};
X
X
X#include "year.tbl"
X
X
X
X/**********************************************************************
X*
X* days_in_year() -- give number of days for particular year and country
X*
X* N.B. countries and their borders have changed a bit over time ...
X*
X* returns:
X* -1 for unknown countries or bad years
X* # of days for good years of countries in table
X*
X**********************************************************************/
Xint
Xdays_in_year(year, country_code)
X register int year;
X register int country_code;
X{
X register int switch_year;
X
X
X /* valid country code? */
X if (country_code < 0 || country_code > MAX_COUNTRY)
X return(-1);
X
X /* check the farthest boundaries; there is no year 0 */
X /* NOTE: individual country functions may handle less */
X if (year <= 0 || year > 9999)
X return(-1);
X
X /* if year is after Gregorian calendar change, use Gregorian rule */
X switch_year = year_table[country_code].greg_switch;
X if (year > switch_year)
X if ((year&0x3)==0 && ((year&0xF)==0 || year%100))
X return(366);
X else
X return(365);
X
X /* else, need to handle years before and during calendar change */
X return((*year_table[country_code].weird_years)(year, switch_year));
X}
SHAR_EOF
if test 1423 -ne "`wc -c < 'days.c'`"
then
echo shar: error transmitting "'days.c'" '(should have been 1423 characters)'
fi
fi
if test -f 'early.c'
then
echo shar: will not over-write existing file "'early.c'"
else
echo extracting "'early.c'"
sed 's/^X//' >early.c <<'SHAR_EOF'
X#include <stdio.h>
X
X
X/**********************************************************************
X*
X* unknown_calendar() -- ignorance place holder
X*
X* This is for countries that I don't know about. It is used for
X* the Muslim, Celtic, Chinese, Mayan, and other calendars.
X*
X**********************************************************************/
Xint unknown_calendar(year, change_year)
X int year;
X int change_year;
X{
X return(-1);
X}
X
X
X/**********************************************************************
X*
X* julian() -- return length of year based on Julius Caesar/Sosigenes rule
X*
X* Actually could go back to 45 BC, but why?
X* Calling routine allows no years before 1 AD
X*
X**********************************************************************/
Xint julian(year, change_year)
X int year;
X int change_year;
X{
X int length = 365;
X
X
X if ((year & 03) == 0)
X length = 366;
X
X if (year == change_year)
X switch (change_year / 100)
X {
X case 20:
X /* 2000 - 2099 */
X /* 2000 is a leap year; fall through */
X case 19:
X /* 1900 - 1999 */
X return(length-13);
X case 18:
X /* 1800 - 1899 */
X return(length-12);
X case 17:
X /* 1700 - 1799 */
X return(length-11);
X case 16:
X /* 1600 - 1699 */
X /* 1600 is a leap year, fall through */
X case 15:
X /* 1500 - 1599 */
X return(length-10);
X }
X
X return(length);
X}
X
X
X/**********************************************************************
X*
X* belgium_early() -- handle problem caused by the change to Gregorian
X* overlapping two years
X*
X**********************************************************************/
Xint belgium_early(year, change_year)
X int year;
X int change_year;
X{
X /* the days 12/25/1582 - 1/5/1583 were dropped */
X if (year == change_year || year == change_year-1)
X return(360);
X
X /* do normal Julian rules */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X/**********************************************************************
X*
X* canada_early() -- deal with conflict between French rules and
X* British rules for dates
X*
X* France changed to Gregorian 12/10/1582 (Julian)
X* Britain changed to Gregorian 09/05/1752 (Julian)
X* therefore, Canada changed on ??/??/????
X*
X* Some guesses can be made based on the individual provinces/territories:
X*
X* Alberta British rules likely apply
X* British Columbia British rules definitely apply
X* Manitoba likely British rules (def. British after 1763)
X* New Brunswick France and British alternated control
X* Newfoundland contested until 1713 when became British
X* Nova Scotia British after 1713
X* Ontario French first then British after 1759
X* Prince Edward Island follows Ontario rules (?)
X* Quebec Britain gained in 1763 with Treaty of Paris
X* Saskatchewan British rules apply
X* Yukon Territory first Russian then British after 1840 (?)
X*
X**********************************************************************/
Xint canada_early(year, change_year)
X int year;
X int change_year;
X{
X /* calculate using British change year for Canada's */
X return(julian(year, change_year));
X}
X
X
X/**********************************************************************
X*
X* china_early() -- previous to using the Gregorian calendar, China
X* used a 12 (ordinary year) or 13 (full year) month
X* calendar that operated in 60 year cycles
X* Years began with the lunar month that had the sun
X* enter the zodiacal sign Aquarius
X*
X* Jesuit missionaries tried to reform the calendar
X* when they arrived in the 1600s. I haven't found
X* out the full ramifications of that attempt. What I
X* have seen is that the calendar was again changed by
X* the Chinese after that; this introduced some errors.
X*
X* Now, what that means for converting years is
X* a lot of work...
X*
X**********************************************************************/
Xint china_early(year, change_year)
X int year;
X int change_year;
X{
X /* punt */
X return(-1);
X}
X
X
X
X/**********************************************************************
X*
X* france_early() -- deal with France's use of the Republic calendar
X* for the years 1793-1805
X*
X* The Revolutionary Calendar was a base 10 calendar. That is, it
X* had 360 days arranged in 12 months of 30 days plus 5 or 6 unnumbered
X* days that were added to the end of the last month. Each day was 10
X* hours of 100 minutes of 100 seconds long.
X*
X* It was rejected after over a decade of use mainly because of its
X* opposition from religious groups who did not approve of weeks that
X* were seven days long.
X*
X**********************************************************************/
Xint france_early(year, change_year)
X int year;
X int change_year;
X{
X /* Republic --> Gregorian */
X if (year == 1806)
X return(365); /* ? */
X
X /* Republic Calendar -- follows Julian leap-year rule */
X if (year > 1793 || year < 1806)
X {
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X }
X
X /* Gregorian --> Republic */
X if (year == 1793)
X return(365);
X
X /* Gregorian */
X if (year > 1582 || year < 1793)
X {
X if ((year&0x3)==0 && ((year&0xF)==0 || year%100))
X return(366);
X else
X return(365);
X }
X
X /* Julian --> Gregorian */
X if (year == 1582)
X return(365-10); /* dropped the days 12/10 - 12/20 */
X
X /* Julian */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X/**********************************************************************
X*
X* german_early() -- deal with problem of country adopting the
X* Gregorian calendar in parts
X*
X* Gregorian calendar was adopted in overlapping parts:
X* 10/16/1583 Bavaria
X* 11/14/1583 the Catholic population
X* 3/01/1682 Strassburg
X* 11/15/1699 the Protestant population
X* 12/12/1700 Utrecht
X*
X* I have the last date (1700) in the table for the entire country.
X* If you want more accuracy in dealing with the partial changes,
X* make modifications to the country table and the following code.
X*
X**********************************************************************/
Xint german_early(year, change_year)
X int year;
X int change_year;
X{
X /* deal with change-over date */
X if (year == change_year)
X return(366-11); /* 1700 is a leap year */
X
X /* else, do normal Julian rules */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X
X/**********************************************************************
X*
X* greece_early() -- country did not change all at one time
X*
X* The changes that occurred are:
X*
X* 07/15/1916 Calendar change adopted by all except...
X* 09/30/1923 ...the Greek Church, which finally accepted it
X*
X* The table uses the latter date. Hack this if you don't like it.
X* A warning: one reference seemed to indicated (it wasn't clear if
X* it had been just proposed or it was accepted) that Greece is using a
X* modified Julian calendar that has two leap centuries out of *nine*.
X* If this is true, then dates after 2800 will be different from
X* the Gregorian calendar.
X*
X**********************************************************************/
Xint greece_early(year, change_year)
X int year;
X int change_year;
X{
X /* do change-over year */
X if (year == change_year)
X return(365-13); /* 1923 was not a leap year */
X
X /* do normal Julian rules */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X/**********************************************************************
X*
X* iran_early() -- uses the Monarchic Calendar
X*
X* I don't know how if or when Gregorian was used. The Muslim
X* calendar may still be used (it is a 12 month calendar with a 30
X* year cycle; eleven days are added over the cycle) for daily or
X* religious or even Government functions.
X*
X**********************************************************************/
Xint iran_early(year, change_year)
X int year;
X int change_year;
X{
X return(-1);
X}
X
X
X/**********************************************************************
X*
X* japan_early() -- deal with Japanese lunar calendar
X*
X* Unfortunately, I have been unable to find any detailed information
X* on the calendar used prior to the adoption of the Gregorian calendar.
X*
X* If anyone has some info, I'd like to receive it.
X*
X**********************************************************************/
Xint japan_early(year, change_year)
X int year;
X int change_year;
X{
X return(-1);
X}
X
X
X/**********************************************************************
X*
X* netherlands_early() -- deal with scattered adoption
X*
X* Adoption of the Gregorian calendar went by the following cities:
X* 12/15/1582 Holland, Zeeland, Brabant, Vlaandern
X* 06/30/1700 Gelerland
X* 11/30/1700 Utrecht, Overijisol
X* 12/31/1700 Friesland, Groningen
X* 01/12/1701 Entire country consistent
X*
X**********************************************************************/
Xint netherlands_early(year, change_year)
X int year;
X int change_year;
X{
X /* Use date of total country adoption -- 1701 */
X if (year == change_year)
X return(365 - 11);
X
X /* do normal Julian rules */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X/**********************************************************************
X*
X* poland_early() -- deal with country's partial adoption dates
X*
X* Dates for adoption are
X* 11/01/1582 Catholics (and Protestants?) adopt
X* 03/18/1918 Russian Poland changes (Civil War split)
X* 05/??/1923 Orthodox members adopt
X*
X**********************************************************************/
Xint poland_early(year, change_year)
X int year;
X int change_year;
X{
X /* Use date of total country adoption -- 1923 */
X if (year == change_year)
X return(365 - 13);
X
X /* do normal Julian rules */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X/**********************************************************************
X*
X* sweden_early() -- deal with bouncing leap day
X*
X* Sweden took a half-step towards Gregorian but then retreated (think
X* of it as sort of a single partner polka).
X*
X* 1700 -- made this year a non-leap year by dropping Feb 29th
X* 1712 -- went back to Julian calendar by making a Feb 30th !!
X* 2/18/1753 -- adopted Gregorian
X*
X**********************************************************************/
Xint sweden_early(year, change_year)
X int year;
X int change_year;
X{
X if (year == change_year)
X return(365 - 11);
X
X if (year == 1700)
X return(365);
X
X if (year == 1712)
X return(367);
X
X /* do normal Julian rules */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X/**********************************************************************
X*
X* switzerland_early() -- deal with scattered adoption in country
X*
X* Districts and their adoption dates (I had conflicting sources for
X* the spelling of the district names)
X*
X* Catholic districts
X* 01/22/1584 Fribourg, Lucerne, Schwyz, Solothurn, Unterwalden, Uri, Zug
X* 01/17/1597 Appenzell
X* 03/01/1656 Valais (part did early in 1622)
X*
X* Protestant districts
X* 01/01/1701 Baselstradt, Bern, Biel, Cargous, Geneva, Neuchatel,
X* Schaffhausen, Thurgan, and Zurich
X* 12/20/1723 Appenzell
X* 01/12/1724 Glarus, St. Galen
X* 02/17/1812 Grisons
X*
X**********************************************************************/
Xint switzerland_early(year, change_year)
X int year;
X int change_year;
X{
X /* Use date of total country adoption -- 1724 (a leap year) */
X if (year == change_year)
X return(366 - 11);
X
X /* do normal Julian rules */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X/**********************************************************************
X*
X* turkey_early() -- deal with scattered adoption of new calendar
X*
X* Adoption seemed to depend on regional background
X*
X* 1908 people with a European heritage
X* 1917 people with a Asian heritage (might be 1914)
X*
X**********************************************************************/
Xint turkey_early(year, change_year)
X int year;
X int change_year;
X{
X /* Use date of total country adoption -- 1917 */
X if (year == change_year)
X return(365 - 13);
X
X /* do normal Julian rules */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X/**********************************************************************
X*
X* usa_early() -- deal with state differences
X*
X* The USA, for the most part, followed Great Britain's lead in the
X* adoption of the the Gregorian calendar in 1752. However, not all
X* current states were part of the "country" at that time. An easy
X* lie is to say that all parts of the yet-to-be USA changed over on
X* that date. States like California were not even settled until
X* about 1770.
X*
X* The exceptions to the 1752 rule:
X*
X* Alaska was owned by Russia until 1867. (see Russia's rules)
X* Hawaii was an independent country that adopted Gregorian in 1893(?).
X*
X* The non-states that operate under US protection are likewise exceptions
X* to the rule (luckily, some were not inhabited or we'd have to hypnotise
X* the native population to change their memory of previous calendars:-):
X*
X* American Samoa became possesion 1899.
X* Baker, Howland, and Jarvis Islands became possesions 1857(?).
X* Panama Canal Zone was a possesion 1903-1979 (?).
X* Canton and Enderbury Islands - 1939.
X* Great Corn and Little Corn - leased from Nicaraugua for 99 years in 1914.
X* Guam - obtained in 1898, lost to Japan 1941, regained in 1944.
X* Johnston Island - came with Hawaii
X* Midway Islands - 1867
X* Phillipine Islands - was US territory 1898-1946
X* Puerto Rico - Spain ceded to US in 1898
X* Trust Territories of the Pacific (approx 2000 islands in W. Pacific)-1947
X* Virgin Islands - bought from Denmark in 1917
X* Wake Island - got from Spain 1898, Japan took 1941, regained in 1945
X*
X**********************************************************************/
Xint usa_early(year, change_year)
X int year;
X int change_year;
X{
X /* this is for the majority of the cases, change if desired */
X if (year == change_year) /* 1752 */
X return(366 - 11);
X
X /* do normal Julian rules */
X if ((year & 03) == 0)
X return(366);
X else
X return(365);
X}
X
X
X/**********************************************************************
X*
X* ussr_early() -- deal with scattered adoption of new calendar
X*
X* The changing calendar for the Soviet Union reflects a country
X* that was undergoing great changes. The dates of change are:
X*
X* 1/1/1918 -- Western part changes to Gregorian
X* 2/5/1920 -- Eastern part changes to Gregorian
X* 1929 -- Entire country changed to a 5 day week and new calendar
X* 1932 -- Entire country changed to a 6 day week and new calendar
X* 6/27/1940 -- Chucked the non-standard calendar and returned to Gregorian
X*
X**********************************************************************/
Xint ussr_early(year, change_year)
X int year;
X int change_year;
X{
X /* the above is the present and total knowledge I have on the */
X /* calendars used.... So, I'll punt and return(-1); */
X return(-1);
X}
SHAR_EOF
if test 15537 -ne "`wc -c < 'early.c'`"
then
echo shar: error transmitting "'early.c'" '(should have been 15537 characters)'
fi
fi
if test -f 'year.tbl'
then
echo shar: will not over-write existing file "'year.tbl'"
else
echo extracting "'year.tbl'"
sed 's/^X//' >year.tbl <<'SHAR_EOF'
X#define VATICAN_CITY 00
X#define UNITED_STATES 01
X#define CANADA 02
X#define MEXICO 03
X#define AUSTRALIA 04
X#define AUSTRIA 05
X#define BELGIUM 06
X#define BRAZIL 07
X#define CHILE 08
X#define CHINA 09
X#define CZECHOSLOVAKIA 10
X#define DENMARK 11
X#define EGYPT 12
X#define FINLAND 13
X#define FRANCE 14
X#define GERMANY 15
X#define GREAT_BRITAIN 16
X#define GREECE 17
X#define HONG_KONG 18
X#define HUNGARY 19
X#define INDIA 20
X#define IRAN 21
X#define IRAQ 22
X#define ISRAEL 23
X#define IRELAND 24
X#define ITALY 25
X#define JAPAN 26
X#define SOUTH_KOREA 27
X#define NETHERLANDS 28
X#define NEW_ZEALAND 29
X#define NORWAY 30
X#define POLAND 31
X#define SAUDI_ARABIA 32
X#define SCOTLAND 33
X#define SINGAPORE 34
X#define SOUTH_AFRICA 35
X#define SOVIET_UNION 36
X#define SPAIN 37
X#define SWEDEN 38
X#define SWITZERLAND 39
X#define TAIWAN 40
X#define THAILAND 41
X#define TURKEY 42
X
X#define MAX_COUNTRY 43
X
X
Xextern int unknown_calendar();
Xextern int julian();
X
Xextern int belgium_early();
Xextern int usa_early();
Xextern int canada_early();
Xextern int china_early();
Xextern int france_early();
Xextern int german_early();
Xextern int greece_early();
Xextern int iran_early();
Xextern int japan_early();
Xextern int netherlands_early();
Xextern int poland_early();
Xextern int ussr_early();
Xextern int sweden_early();
Xextern int switzerland_early();
Xextern int turkey_early();
X
X
X
Xstruct country_years year_table[MAX_COUNTRY] =
X{
X { /* VATICAN_CITY */ 1582, julian},
X { /* UNITED_STATES */ 1752, usa_early},
X { /* CANADA */ 1806, canada_early},
X { /* MEXICO */ 1582, julian},
X { /* AUSTRALIA */ 1582, julian},
X { /* AUSTRIA */ 1583, julian},
X { /* BELGIUM */ 1583, belgium_early},
X { /* BRAZIL */ 1582, julian},
X { /* CHILE */ 1582, julian},
X { /* CHINA */ 1912, china_early},
X { /* CZECHOSLOVAKIA */ 1891, unknown_calendar},
X { /* DENMARK */ 1582, julian}, /* 1700 ? */
X { /* EGYPT */ 1900, unknown_calendar},
X { /* FINLAND */ 1918, julian},
X { /* FRANCE */ 1806, france_early},
X { /* GERMANY */ 1700, german_early},
X { /* GREAT_BRITAIN */ 1752, julian},
X { /* GREECE */ 1924, greece_early}, /* 1920? */
X { /* HONG_KONG */ 1752, julian},
X { /* HUNGARY */ 1587, julian}, /* 1582? */
X { /* INDIA */ 1752, unknown_calendar},
X { /* IRAN */ 9999, iran_early},
X { /* IRAQ */ 1918, unknown_calendar},
X { /* ISRAEL */ 1752, julian},
X { /* IRELAND */ 1752, julian},
X { /* ITALY */ 1582, julian}, /* Mar 25 = new year for parts*/
X { /* JAPAN */ 1873, japan_early}, /* 1893? */
X { /* SOUTH_KOREA */ 1873, japan_early}, /* 1893? */
X { /* NETHERLANDS */ 1702, netherlands_early},
X { /* NEW_ZEALAND */ 1752, julian},
X { /* NORWAY */ 1700, unknown_calendar}, /* prob. Celtic cal */
X { /* POLAND */ 1923, poland_early},
X { /* SAUDI_ARABIA */ 1900, unknown_calendar},
X { /* SCOTLAND */ 1752, julian},
X { /* SINGAPORE */ 1752, julian},
X { /* SOUTH_AFRICA */ 1752, julian},
X { /* SOVIET_UNION */ 1940, ussr_early},
X { /* SPAIN */ 1582, julian},
X { /* SWEDEN */ 1753, sweden_early},
X { /* SWITZERLAND */ 1724, switzerland_early},
X { /* TAIWAN */ 1873, japan_early},
X { /* THAILAND */ 1920, unknown_calendar},
X { /* TURKEY */ 1917, turkey_early} /* 1914? */
X};
SHAR_EOF
if test 3617 -ne "`wc -c < 'year.tbl'`"
then
echo shar: error transmitting "'year.tbl'" '(should have been 3617 characters)'
fi
fi
# end of shell archive
exit 0
More information about the Mod.sources
mailing list