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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Timezone.pmod:635:    " inherit TZRules;\n"    " array(array(string|int)) jd_year_periods(int jd)\n"    " {\n"    " [int y,int yjd,int leap]=gregorian_yjd(jd);\n"    " switch (y)\n"    " {\n"});       array sr=({});       int mn=min(@indices(rules-(<NUL_YEAR>))); +  int firstyear=99999,lastyear=0;       for (y=INF_YEAR;sizeof(r2);y--)    if (r2[y])    {    array z=r2[y];    multiset my=(<y>);       foreach (indices(r2),int y2)    if (join_periods(z,r2[y2],y,y2))    my[y2]=1;       foreach ((array)my,int y2) m_delete(r2,y2);       array tr=({});       int y0=min(@(array)my);    int y2=max(@(array)my); -  +  if (y0!=NUL_YEAR && y0<firstyear) firstyear=y0; +  if (y2!=INF_YEAR && y2>lastyear) lastyear=y2;    for (; y0<=y2; y0++)    if (my[y0])    {    int y1=y0;    while (my[++y1]);       y1--;    -  +  // figure first and last interesting year    if (y0==NUL_YEAR)    { -  +  if (y1!=NUL_YEAR && y1<firstyear) firstyear=y1;    if (my[INF_YEAR])    tr+=({" default: // .."+max(y1,mn-1),    " and ½½½..\n"});    else    tr+=({" default: // .."+max(y1,mn-1),    ":\n"});    }    else if (y0==y1)    tr+=({" case "+y0+":\n"}); -  else if (y1==2050) +  else if (y1==INF_YEAR)    { -  +  if (y0>lastyear) lastyear=y0; +     if (!my[NUL_YEAR])    tr+=({" case "+y0,"..:\n"});    else    tr[0]=replace(tr[0],"½½½",(string)y0);    }    else    tr+=({" case "+y0,".."+y1+":\n"});       y0=y1;    }
pike.git/lib/modules/Calendar.pmod/Timezone.pmod:698:    tr+=({s->dump(lastoffset,my),"\n"," "*21});    lastoffset=s->offset;    }    tr[-3]=replace(tr[-3],", ","});");    sr=tr[..sizeof(tr)-2]+sr;    }    res+=sr+    ({" }\n"    " }\n"    "\n" +  "constant firstyear="+firstyear+";\n" +  "constant lastyear="+lastyear+";\n",    "array(string) rule_s=\n"});       multiset tzname=(<>);    foreach (values(rules),array(Shift)|object(Shift) s)    if (arrayp(s)) foreach (s,Shift s) tzname[s->s]=1;    else tzname[s->s]=1;       res+=({"({",map((array)tzname,    lambda(string s) { return sprintf("%O",s); })*",",    "});\n",
pike.git/lib/modules/Calendar.pmod/Timezone.pmod:1126: Inside #if defined(RTTZC_TIMING)
   r->add(b);   #ifdef RTTZC_TIMING    float tf=time(t);    werror("find %O at: %O\n",s,tf-t1);    float tq=time(t);   #endif    foreach (q/"\n",string line)    if (sscanf(line,"Rule%*[ \t]%[^ \t]%*[ \t]%s",a,b)==4 &&    a==s)    r->add(b); -  else +  else if (sscanf(line,"%*[ ]#%*s")<2)    break; // end of zone   #ifdef RTTZC_TIMING    float tf=time(t);    werror("load %O: %O\n",s,tf-tq);   #endif    break;    }    n++;    }    string c=r->dump();