a580e12000-09-27Fredrik Hübinette (Hubbe) #pike __REAL_VERSION__
a20af62000-09-26Fredrik Hübinette (Hubbe) 
8872292003-03-10Martin Nilsson //! This is the container class for rules.
78fd532000-07-12Mirar (Pontus Hagland) 
8872292003-03-10Martin Nilsson .Rule.Timezone timezone; .Rule.Language language;
78fd532000-07-12Mirar (Pontus Hagland) 
4c83372000-08-04Mirar (Pontus Hagland) mapping(string:string) abbr2zone= ([ "AMT":"America/Manaus", "AST":"America/Curacao", "CDT":"America/Costa_Rica", "CST":"America/El_Salvador", "EST":"America/Panama", "GST":"Asia/Dubai", "IST":"Asia/Jerusalem", "WST":"Australia/Perth",
e7dce62001-01-11Mirar (Pontus Hagland)  // written out names -> standard abbreviation "Pacific Daylight Time":"PDT", "Pacific Standard Time":"PST", "Central Daylight Time":"CDT", "Central Standard Time":"CST", "Eastern Daylight Time":"EDT", "Eastern Standard Time":"EST",
40481e2001-01-12Mirar (Pontus Hagland)  // local languages "MEZ":"CET", "MESZ":"CEST",
4c83372000-08-04Mirar (Pontus Hagland) ]);
8872292003-03-10Martin Nilsson this_program set_timezone(string|.Rule.Timezone t)
78fd532000-07-12Mirar (Pontus Hagland) {
8872292003-03-10Martin Nilsson  if (stringp(t)) { t=.Timezone[t]; if (!t) error("No timezone %O\n",t);
78fd532000-07-12Mirar (Pontus Hagland)  } if (!t->is_timezone) error("Not a timezone: %O\n",t);
8872292003-03-10Martin Nilsson  this_program r=clone();
78fd532000-07-12Mirar (Pontus Hagland)  r->timezone=t; return r; }
8872292003-03-10Martin Nilsson this_program set_language(string|.Rule.Language lang)
78fd532000-07-12Mirar (Pontus Hagland) { 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; }
dc21d42001-05-05Mirar (Pontus Hagland) //! method Ruleset set_abbr2zone(mapping(string:string) abbr2zone) //! Sets the guess-mapping for timezones. //! Default is the mapping
4c83372000-08-04Mirar (Pontus Hagland) //!
dc21d42001-05-05Mirar (Pontus Hagland) //! <pre>
4c83372000-08-04Mirar (Pontus Hagland) //! Abbreviation Interpretation //! AMT America/Manaus [UTC-4] //! AST America/Curacao [UTC-4] //! CDT America/Costa_Rica [UTC-5] //! CST America/El Salvador [UTC-6] //! EST America/Panama [UTC-5] //! GST Asia/Dubai [UTC+4] //! IST Asia/Jerusalem [UTC+2] //! WST Australia/Perth [UTC+8]
dc21d42001-05-05Mirar (Pontus Hagland) //! </pre>
4c83372000-08-04Mirar (Pontus Hagland) //!
dc21d42001-05-05Mirar (Pontus Hagland) //! see also: YMD.parse
4c83372000-08-04Mirar (Pontus Hagland) this_program set_abbr2zone(mapping(string:string) m) { this_program r=clone(); r->abbr2zone=m; return r; }
8872292003-03-10Martin Nilsson this_program set_rule(.Rule.Language|.Rule.Timezone rule)
78fd532000-07-12Mirar (Pontus Hagland) { this_program r=clone(); if (rule->is_timezone) r->timezone=rule; if (rule->is_language) r->language=rule; return r; } this_program clone() {
8872292003-03-10Martin Nilsson  this_program r=this_program();
78fd532000-07-12Mirar (Pontus Hagland)  r->timezone=timezone; r->language=language;
8872292003-03-10Martin Nilsson  r->abbr2zone=abbr2zone;
78fd532000-07-12Mirar (Pontus Hagland)  return r; } int(0..1) `==(this_program other) {
c0dbee2000-08-01Mirar (Pontus Hagland)  if (!objectp(other)) return 0;
78fd532000-07-12Mirar (Pontus Hagland)  return other->timezone==timezone && other->language==language; }