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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/YMD.pmod:659:   // years       int number_of_years()    {    int m=number_of_days();    if (m<=1 || m+yd-1<year()->number_of_days()) return 1;    return 1+y-year_from_julian_day(jd+m-1)[0];    }       array(cYear) years(int ...range) +  // Note: This is zero based.    { -  int from=1,n=number_of_years(),to=n; +  int from=0,n=number_of_years()-1,to=n;       if (sizeof(range))    if (sizeof(range)<2)    error("Illegal numbers of arguments to days()\n");    else    {    [from,to]=range; -  if (from>=n) return ({}); else if (from<0) from=0; -  if (to>=n) to=n; else if (to<from) return ({}); +  if (from>n) return ({}); else if (from<0) from=0; +  if (to>n) to=n; else if (to<from) return ({});    }       return map(enumerate(1+to-from,1,y+from),    lambda(int x)    { return Year("ymd_yn",rules,x,1); });    }       cYear year(void|int m) -  +  // Note: This is zero based.    {    if (!m || (!n&&m==-1))    return Year("ymd_y",rules,y,yjd,1);       if (m<0) m=number_of_years()+m;       array(TimeRange) res=years(m,m);    if (sizeof(res)==1) return res[0];    error("not in range (Year 0..%d exist)\n",    number_of_years()-1);