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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Gregorian.pmod:117:    (int)x==y;    }       int `>(object x)    {    return y>(int)x;    }       object next()    { -  return vYear(y); +  return vYear(y+1);    }       object prev()    { -  return vYear(y); +  return vYear(y-1);    }       object `+(int n)    {    return vYear(y+n);    }       int|object `-(int|object n)    {    if (objectp(n) && object_program(n)==vYear) return y-n->y;
pike.git/lib/modules/Calendar.pmod/Gregorian.pmod:207:    if (!week_day_mapping)    month_mapping=    mkmapping(Array.map(month_names,lower_case),    indices(allocate(13))[1..]);    n=month_mapping[n];    }       if (n<0)    return vMonth(y,13+n);    else -  return vMonth(y,n); +  return vMonth(y,n||1);    }       array(mixed) months()    {    return ({1,2,3,4,5,6,7,8,9,10,11,12});    }       object week(int n)    {    if (n<0) -  return vWeek(y,this->number_of_weeks+n+1); +  return vWeek(y,this->number_of_weeks()+n+1);    else    return vWeek(y,n||1);    }       array(mixed) weeks()    {    return indices(allocate(this->number_of_weeks()+1))[1..];    }       object day(int n)
pike.git/lib/modules/Calendar.pmod/Gregorian.pmod:301:    int `<(object x)    {    return    (object_program(x)==object_program(this) &&    (x->y==y && x->m<m) || (x->y<y));    }       int `==(object x)    {    return +  objectp(x) &&    object_program(x)==object_program(this) &&    x->y==y && x->m==m;    }    -  +  int `!=(object x) +  { +  write("foo\n"); +  return !(this==x); +  } +     int `>(object x)    {    return    (object_program(x)==object_program(this) &&    (x->y==y && x->m>m) || (x->y>y));    }       object `+(int n)    {    int m2=m;
pike.git/lib/modules/Calendar.pmod/Gregorian.pmod:509:    object prev()    {    return this-1;    }      //-- internal -------------------------------------------------------       int yday()    {    return -  ({-1,-2,-3,-4,5,6,7})[this->year()->julian_day(0)%7] +  ({0,-1,-2,-3,3,2,1})[this->year()->julian_day(0)%7]    +7*(w-1);    }      //-- nonstandard methods --------------------------------------------       int number_of_days()    {    return 7;    }   
pike.git/lib/modules/Calendar.pmod/Gregorian.pmod:557:    if (!week_day_mapping)    week_day_mapping=    mkmapping(Array.map(week_day_names,lower_case),    indices(allocate(8))[1..]);    n=week_day_mapping[n];    }       if (n<0) n=8+n;    else if (!n) n=1;    n+=yday()-1; -  if (n<0) return vYear(y-1)->day(n+1); -  if (n+1>this->year()->number_of_days()) +  if (n<0) return vYear(y-1)->day(n); +  if (n>=this->year()->number_of_days())    return vYear(y+1)->day(n-this->year()->number_of_days()); -  return vDay(y,n+1); +  return vDay(y,n);    }       array(mixed) days()    {    return ({1,2,3,4,5,6,7});    }      //-- more -----------------------------------------------------------       object year()
pike.git/lib/modules/Calendar.pmod/Gregorian.pmod:739:    array a=year()->month_start_day;    for (int i=2; i<sizeof(a); i++)    if (d<a[i]) return vMonth(y,i-1);    return vMonth(y,12);    }       object week()    {    int n;    object ye=this->year(); -  n=(-({-1,-2,-3,-4,5,6,7})[this->year()->julian_day(0)%7]+d-1)/7+1; +  n=(-({0,-1,-2,-3,3,2,1})[this->year()->julian_day(0)%7]+d)/7+1;    if (n>ye->number_of_weeks()) -  return vWeek(y+1,1); +  return ye->next()->week(1);    else if (n<=0) -  return vWeek(y-1,ye->prev()->number_of_weeks()); +  return ye->prev()->week(-1);    return vWeek(y,n);    }   };