Branch: Tag:

2000-07-12

2000-07-12 19:36:16 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

first pike tree checkin

Rev: lib/modules/Calendar.pmod/Austrian.pmod:1.1
Rev: lib/modules/Calendar.pmod/CHANGES:1.1
Rev: lib/modules/Calendar.pmod/Calendar.pike:1.1
Rev: lib/modules/Calendar.pmod/Coptic.pmod:1.1
Rev: lib/modules/Calendar.pmod/Discordian.pmod:1.1
Rev: lib/modules/Calendar.pmod/Event.pmod:1.1
Rev: lib/modules/Calendar.pmod/Events.pmod:1.1
Rev: lib/modules/Calendar.pmod/FILES:1.1
Rev: lib/modules/Calendar.pmod/Gregorian.pmod:1.1
Rev: lib/modules/Calendar.pmod/ISO.pmod:1.1
Rev: lib/modules/Calendar.pmod/Islamic.pmod:1.1
Rev: lib/modules/Calendar.pmod/Julian.pmod:1.1
Rev: lib/modules/Calendar.pmod/Language.pmod:1.1
Rev: lib/modules/Calendar.pmod/Namedays.pmod:1.1
Rev: lib/modules/Calendar.pmod/Orthodox.pmod:1.1
Rev: lib/modules/Calendar.pmod/Roman.pmod:1.1
Rev: lib/modules/Calendar.pmod/Ruleset.pike:1.1
Rev: lib/modules/Calendar.pmod/Stardate.pmod:1.1
Rev: lib/modules/Calendar.pmod/Swedish.pmod:1.1
Rev: lib/modules/Calendar.pmod/TZnames.pmod:1.1
Rev: lib/modules/Calendar.pmod/TZrules.pmod:1.1
Rev: lib/modules/Calendar.pmod/TZs.h:1.1
Rev: lib/modules/Calendar.pmod/Time.pmod:1.1
Rev: lib/modules/Calendar.pmod/TimeRanges.pmod:1.1
Rev: lib/modules/Calendar.pmod/Timezone.pmod:1.1
Rev: lib/modules/Calendar.pmod/YMD.pmod:1.1
Rev: lib/modules/Calendar.pmod/localization.h:1.1
Rev: lib/modules/Calendar.pmod/mkrules.pike:1.1
Rev: lib/modules/Calendar.pmod/module.pmod:1.1
Rev: lib/modules/Calendar.pmod/namnsdagar:1.2(DEAD)
Rev: lib/modules/Calendar_I.pmod/Austrian.pmod:1.1
Rev: lib/modules/Calendar_I.pmod/Gregorian.pmod:1.23
Rev: lib/modules/Calendar_I.pmod/ISO.pmod:1.8
Rev: lib/modules/Calendar_I.pmod/Julian.pmod:1.1
Rev: lib/modules/Calendar_I.pmod/Orthodox.pmod:1.2
Rev: lib/modules/Calendar_I.pmod/Stardate.pmod:1.1
Rev: lib/modules/Calendar_I.pmod/Swedish.pmod:1.13
Rev: lib/modules/Calendar_I.pmod/module.pmod:1.5
Rev: lib/modules/Calendar_I.pmod/namnsdagar:1.2(DEAD)

1: + //! + //! module Calendar + //! submodule Coptic + //! + //! This is the Coptic Orthodox Church calendar, + //! that starts the 11th or 12th September and has + //! 13 months. + //! + //! note: + //! The (default) names of the months + //! are different then other the emacs calendar; + //! I do not know which ones are used - the difference + //! seem to be only the transcription of the phonetic sounds + //! (B &lt;-&gt; P, etc). + //! + //! I do not know for how long back the calendar is valid, + //! either. My sources claim that the calendar is synchronized + //! with the <ref>Gregorian</ref> calendar, which is odd. + //!    -  + import "."; + // inherit some rules from Gregorian, like week numbering + inherit Gregorian:Gregorian; +  + string calendar_name() { return "Coptic"; } +  + private static mixed __initstuff=lambda() + { +  f_week_day_shortname_from_number="gregorian_week_day_shortname_from_number"; +  f_week_day_name_from_number="gregorian_week_day_name_from_number"; +  f_week_day_number_from_name="gregorian_week_day_number_from_name"; +  +  f_year_name_from_number="coptic_year_name_from_number"; +  f_month_name_from_number="coptic_month_name_from_number"; +  f_month_shortname_from_number="coptic_month_shortname_from_number"; +  f_month_number_from_name="coptic_month_number_from_name"; +  f_week_name_from_number="week_name_from_number"; + }(); +  + static constant year_offset=-284; + static constant start=1720949; +  + static array year_from_julian_day(int jd) + { +  int d=jd-start; +  +  int century=(4*d+3)/146097; +  int century_jd=(century*146097)/4; +  int century_day=d-century_jd; +  int century_year=(100*century_day+75)/36525; +  +  return +  ({ +  century*100+century_year+year_offset, +  start+century_year*365+century_year/4+century_jd, +  }); + } +  + static int julian_day_from_year(int y) + { +  y-=year_offset; +  return start+y*365+y/4-y/100+y/400; + } +  + static int year_leap_year(int y) + { +  y-=year_offset; +  werror("%O\n",y); +  return (!(((y)%4) || (!((y)%100) && ((y)%400)))); + } +  + static array(int) year_month_from_month(int y,int m) + { + // [y,m,ndays,myd] +  +  y+=(m-1)/13; +  m=1+(m-1)%13; +  +  return ({y,m,m==13?year_leap_year(y)+5:30,1+30*(m-1)}); + } +  + static array(int) month_from_yday(int y,int yd) + { + // [month,day-of-month,ndays,month-year-day] +  int m=(yd-1)/30+1; +  int myd=1+30*(m-1); +  return ({m,1+yd-myd,m==13?year_leap_year(y)+5:30,myd}); + } +  + class cYear + { +  inherit Gregorian::cYear; +  +  int number_of_months() +  { +  return 13*n; +  } + }   Newline at end of file added.