pike.git / lib / modules / Calendar.pmod / ISO.pmod

version» Context lines:

pike.git/lib/modules/Calendar.pmod/ISO.pmod:5:   //! Monday instead of Sunday.      inherit Calendar.Gregorian:Gregorian;      #include "constants.h"      string calendar_name() { return "ISO"; }      #define WEEK_MAJORITY 4    - private static mixed __initstuff=lambda() + private protected mixed __initstuff=lambda()   {    f_week_day_shortname_from_number="week_day_shortname_from_number";    f_week_day_name_from_number="week_day_name_from_number";    f_year_name_from_number="year_name_from_number";    f_week_day_number_from_name="week_day_number_from_name";   }();    - static int compat_week_day(int n) + protected int compat_week_day(int n)   {    return n%7;   }    - static string year_name_from_number(int y) + protected string year_name_from_number(int y)   {    if (y>0) return ""+y;    else return (1-y)+" BC";   }    - static array(int) week_from_julian_day(int jd) + protected array(int) week_from_julian_day(int jd)   {   // [week-year,week,day-of-week,ndays,week-julian-day]       [int y,int yjd]=year_from_julian_day(jd);    int yday=jd-yjd+1;    int wjd=jd-jd%7;      #if 1    int k=WEEK_MAJORITY+(yjd-WEEK_MAJORITY)%7;    int w=(yday+k-1)/7;
pike.git/lib/modules/Calendar.pmod/ISO.pmod:78:         #endif      // werror("wjd %d: = %d, %d, %d, %d, %d\n",   // jd,@({y,w,1+(yjd+yday-1)%7,7,wjd}));       return ({y,w,1+(yjd+yday-1)%7,7,wjd});   }    - static array(int) week_from_week(int y,int w) + protected array(int) week_from_week(int y,int w)   {   // [week-year,week,1 (wd),ndays,week-julian-day]       int yjd=julian_day_from_year(y);    int wjd=-WEEK_MAJORITY+yjd-(yjd+WEEK_MAJORITY-1)%7;      // werror("bip %O %O: %O %O\n",y,w,yjd,wjd);       if (w<1 || w>52) // may or may not be out of this year    return week_from_julian_day(wjd+w*7);