// calend.h // // by John D. de Boer enum { JulianCalendar,GregorianCalendar,HebrewCalendar }; typedef struct { bool good; // validity of returned contents short calend; // Julian, Gregorian or Hebrew long jd, // Julian day number + 0.5, i.e. at noon; 0 == 4713 B.C. Jan 1 (J) year; // one-based year (not astronomical) short month, // zero-based month; 0 is January or Nisan; 11 to 13 are Adar, Adar I and Adar II date; // zero-based day of month; 0 == 1st of month } Date; int dayofweek(long JD); int leapyear(long YEAR, bool Greg); int jdisgreg(long JD); int dateisgreg(Date *D); void jdtojul(Date *D); void jultojd(Date *D); void jdtogreg(Date *D); void gregtojd(Date *D); // Date conversion long datetojd(int YEAR, int MONTH, int DATE); void jdtodate(long JD, short *YEAR, short *MONTH, short *DATE); // the Hebrew calendar void hebtojd(Date *D); void jdtoheb(Date *D); // Proper names for days of the week and months char *dayname(int N); bool parsedayname(const char *S, short *D); char *monthname(int N); char *monthshortform(int N); bool parsemonthname(const char *S, short *M); char *hebmonthname(int N); bool parsehebmonth(const char *S, short *M); // Test function void testcalend(void);