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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Events.pmod:185:       int i=search(all,"\nRegion \""+region+"\"");    if (i==-1) return ([])[0]; // not found       int i2=search(all,"\nRegion",i+1);    if (i2==-1) i2=strlen(all)-1;       array(array(string)) names=0;    int start=-1,stop=-1;    int leapdayshift=2000; +  string charset="iso-8859-1"; +  function(string:string) decoder=0;       foreach (all[i..i2]/"\n",string line)    {    string w="",s;    sscanf(line,"%*[ \t]%[^ \t]%*[ \t]%s",w,s);   #if 1    switch (w=lower_case(w))    {    case "":    case "region": // ignore    break;    case "leapdayshift":    sscanf(s,"%d",leapdayshift);    break; -  +  case "charset": +  sscanf(s,"%s",charset); +  object dec=Locale.Charset.decoder(charset); +  decoder=lambda(string s) +  { +  return dec->feed(s)->drain(); +  }; +  break;    case "period":    if (names)    if (res)    res|=new_namedays_object(region,id,    start,stop,leapdayshift,names);    else    res=new_namedays_object(region,id,    start,stop,leapdayshift,names);    names=0;   
pike.git/lib/modules/Calendar.pmod/Events.pmod:225: Inside #if 1
   case "may": case "jun": case "jul": case "aug":    case "sep": case "oct": case "nov": case "dec":    if (!names) names=allocate(366);       sscanf(s,"%d%*[ ]%{%*[, ]%[^,]%}",int mday,array name);   #if 1    if (mday<1 || mday>nd_m_nd[w])    error("Nameday date doesn't exists:\n%O\n",line);   #endif    if (sizeof(name)) -  names[nd_m_yd[w]+mday-1]=`+(@name); +  { +  name=`+(@name); +  if (decoder) name=map(name,decoder); +  names[nd_m_yd[w]+mday-1]=name; +  }    break;    case "leapday":    sscanf(s,"%{%*[, ]%[^,]%}",name);    names[365]=`+(@name);    break;    default:    if (w[0]=='#') break;    error("Unknown namedays definition statement:\n%O\n",line);    }   #endif