Branch: Tag:

2000-07-12

2000-07-12 19:36:16 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

first pike tree checkin

Rev: lib/modules/Calendar.pmod/Austrian.pmod:1.1
Rev: lib/modules/Calendar.pmod/CHANGES:1.1
Rev: lib/modules/Calendar.pmod/Calendar.pike:1.1
Rev: lib/modules/Calendar.pmod/Coptic.pmod:1.1
Rev: lib/modules/Calendar.pmod/Discordian.pmod:1.1
Rev: lib/modules/Calendar.pmod/Event.pmod:1.1
Rev: lib/modules/Calendar.pmod/Events.pmod:1.1
Rev: lib/modules/Calendar.pmod/FILES:1.1
Rev: lib/modules/Calendar.pmod/Gregorian.pmod:1.1
Rev: lib/modules/Calendar.pmod/ISO.pmod:1.1
Rev: lib/modules/Calendar.pmod/Islamic.pmod:1.1
Rev: lib/modules/Calendar.pmod/Julian.pmod:1.1
Rev: lib/modules/Calendar.pmod/Language.pmod:1.1
Rev: lib/modules/Calendar.pmod/Namedays.pmod:1.1
Rev: lib/modules/Calendar.pmod/Orthodox.pmod:1.1
Rev: lib/modules/Calendar.pmod/Roman.pmod:1.1
Rev: lib/modules/Calendar.pmod/Ruleset.pike:1.1
Rev: lib/modules/Calendar.pmod/Stardate.pmod:1.1
Rev: lib/modules/Calendar.pmod/Swedish.pmod:1.1
Rev: lib/modules/Calendar.pmod/TZnames.pmod:1.1
Rev: lib/modules/Calendar.pmod/TZrules.pmod:1.1
Rev: lib/modules/Calendar.pmod/TZs.h:1.1
Rev: lib/modules/Calendar.pmod/Time.pmod:1.1
Rev: lib/modules/Calendar.pmod/TimeRanges.pmod:1.1
Rev: lib/modules/Calendar.pmod/Timezone.pmod:1.1
Rev: lib/modules/Calendar.pmod/YMD.pmod:1.1
Rev: lib/modules/Calendar.pmod/localization.h:1.1
Rev: lib/modules/Calendar.pmod/mkrules.pike:1.1
Rev: lib/modules/Calendar.pmod/module.pmod:1.1
Rev: lib/modules/Calendar.pmod/namnsdagar:1.2(DEAD)
Rev: lib/modules/Calendar_I.pmod/Austrian.pmod:1.1
Rev: lib/modules/Calendar_I.pmod/Gregorian.pmod:1.23
Rev: lib/modules/Calendar_I.pmod/ISO.pmod:1.8
Rev: lib/modules/Calendar_I.pmod/Julian.pmod:1.1
Rev: lib/modules/Calendar_I.pmod/Orthodox.pmod:1.2
Rev: lib/modules/Calendar_I.pmod/Stardate.pmod:1.1
Rev: lib/modules/Calendar_I.pmod/Swedish.pmod:1.13
Rev: lib/modules/Calendar_I.pmod/module.pmod:1.5
Rev: lib/modules/Calendar_I.pmod/namnsdagar:1.2(DEAD)

1: + class Timezone + { +  constant is_timezone=1;    -  + // seconds to utc, not counting DST +  static int offset_to_utc; +  + // timezone name +  string name; +  +  static void create(int offset,string _name) +  { +  offset_to_utc=offset; +  name=_name; +  } +  +  // seconds to UTC, counting DST +  +  array(int) tz_ux(int unixtime) +  { +  return ({offset_to_utc,name}); +  } +  +  array(int) tz_jd(int julian_day) +  { +  return ({offset_to_utc,name}); +  } +  +  string _sprintf(int t) { return (t=='O')?"Timezone("+name+")":0; } +  +  int raw_utc_offset() { return offset_to_utc; } + }; +  + Timezone timezone; +  + class Language + { +  constant is_language=1; +  +  string month_name_from_number(int n); +  string month_shortname_from_number(int n); +  int month_number_from_name(string name); +  +  string week_day_name_from_number(int n); +  string week_day_shortname_from_number(int n); +  int week_day_number_from_name(string name); +  +  string gregoiran_week_day_name_from_number(int n); +  string gregorian_week_day_shortname_from_number(int n); +  int gregorian_week_day_number_from_name(string name); +  +  string week_name_from_number(int n); +  int week_number_from_name(string s); +  string year_name_from_number(int y); + } +  + Language language; +  + this_program set_timezone(string|Timezone t) + { +  this_program r=clone(); +  if (stringp(t)) +  { +  t=master()->resolv("Calendar")["Timezone"][t]; +  if (!t) error("no timezone %O\n",t); +  } +  +  if (!t->is_timezone) +  error("Not a timezone: %O\n",t); +  r->timezone=t; +  return r; + } +  + this_program set_language(string|Language lang) + { +  this_program r=clone(); +  if (stringp(lang)) +  { +  lang=master()->resolv("Calendar")["Language"][lang]; +  if (!lang) lang=master()->resolv("Calendar")["Language"]["ISO"]; +  } +  if (!lang->is_language) +  error("Not a language: %O\n",lang); +  r->language=lang; +  return r; + } +  + this_program set_rule(Language|Timezone rule) + { +  this_program r=clone(); +  if (rule->is_timezone) r->timezone=rule; +  if (rule->is_language) r->language=rule; +  return r; + } +  + this_program clone() + { +  this_program r=object_program(this_object())(); +  r->timezone=timezone; +  r->language=language; +  return r; + } +  + int(0..1) `==(this_program other) + { +  return +  other->timezone==timezone && +  other->language==language; + }   Newline at end of file added.