Branch: Tag:

2001-06-09

2001-06-09 12:17:28 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

shaping up place() for all combinations of Year, Month, Week, Day, Hour, Minute, Second, Fraction

Rev: lib/modules/Calendar.pmod/Time.pmod:1.16
Rev: lib/modules/Calendar.pmod/YMD.pmod:1.35

1192:    return week;    }    +  if (what->is_year) +  return Year("ymd_yn",rules,y,what->number_of_years()); +  +  if (what->is_month) +  return month(what->month_name()); +  +  if (what->is_timeofday) +  return place(what->day(),force)->place(what,force); +     error("place: Incompatible type %O\n",what);    }   
1502:    if (what->is_day)    return place_day(what->month_day(),what->n,force);    +  if (what->is_month) +  return Month("ymd_ym",rules,y,m,what->number_of_months()) +  ->autopromote(); +  +  if (what->is_week) +  return place(what->day(),force)->week(); +  +  if (what->is_timeofday) +  return place(what->day(),force)->place(what,force); +     error("place: Incompatible type %O\n",what);    }   
1800:       if (what->is_year)    return year()->place(what,force); // just fallback +  if (what->is_month) +  return month()->place(what,force); // just fallback    -  +  if (what->is_week) +  return Week("ymd_yw",rules,y,w,what->number_of_weeks()); +     if (what->is_day)    return place_day(what->week_day(),what->n,force);   
2105:    error("_move: Incompatible type %O\n",step);    }    -  TimeRange place(TimeRange what) +  TimeRange place(TimeRange what,int|void force)    {    if (what->is_timeofday)    {
2124:    ->autopromote();    }    +  if (what->is_year) +  return year()->place(what,force); // just fallback +  if (what->is_month) +  return month()->place(what,force); // just fallback +  if (what->is_week) +  return week()->place(what,force); // just fallback +  +  if (what->is_day) +  return Day("ymd_jd",rules,jd,what->number_of_days()) +  ->autopromote(); +     error("place: Incompatible type %O\n",what);    }