Branch: Tag:

2008-02-07

2008-02-07 01:39:53 by Martin Stjernholm <mast@lysator.liu.se>

Fixes to make it possible to write a compat wrapper for this module: Did
away with all .Foo style identifiers since they _always_ result in a lookup
in the same directory as the current file, even when it's included from
somewhere else.

So if e.g. lib/modules/Calendar.pmod/Time.pmod is #include'd from
lib/7.6/modules/Calendar.pmod/Time.pmod (which we must do to compile it
all in #pike 7.6 mode), and the included Time.pmod contains a reference
.Ruleset, that reference will be resolved in lib/modules/Calendar.pmod.
That's odd and probably buggy, since one would reasonably expect cpp stuff
like #include to be completely transparent for the resolver.

Rev: lib/modules/Calendar.pmod/Austrian.pmod:1.7
Rev: lib/modules/Calendar.pmod/Badi.pmod:1.7
Rev: lib/modules/Calendar.pmod/Calendar.pike:1.7
Rev: lib/modules/Calendar.pmod/Coptic.pmod:1.7
Rev: lib/modules/Calendar.pmod/Discordian.pmod:1.11
Rev: lib/modules/Calendar.pmod/Event.pmod:1.23
Rev: lib/modules/Calendar.pmod/Gregorian.pmod:1.10
Rev: lib/modules/Calendar.pmod/ISO.pmod:1.9
Rev: lib/modules/Calendar.pmod/Islamic.pmod:1.10
Rev: lib/modules/Calendar.pmod/Julian.pmod:1.10
Rev: lib/modules/Calendar.pmod/Language.pmod:1.24
Rev: lib/modules/Calendar.pmod/Ruleset.pike:1.15
Rev: lib/modules/Calendar.pmod/Stardate.pmod:1.16
Rev: lib/modules/Calendar.pmod/Swedish.pmod:1.8
Rev: lib/modules/Calendar.pmod/Time.pmod:1.41
Rev: lib/modules/Calendar.pmod/TimeRanges.pmod:1.34
Rev: lib/modules/Calendar.pmod/Timezone.pmod:1.40
Rev: lib/modules/Calendar.pmod/YMD.pike:1.29

64:   // ----------------------------------------------------------------   // static    - .Rule.Timezone UTC=.Rule.Timezone(0,"UTC"); + Calendar.Rule.Timezone UTC=Calendar.Rule.Timezone(0,"UTC");      // ----------------------------------------------------------------   // from the system    - .Rule.Timezone locale=0; + Calendar.Rule.Timezone locale=0;    - static function(:.Rule.Timezone) _locale() + static function(:Calendar.Rule.Timezone) _locale()   { -  .Rule.Timezone tz; +  Calendar.Rule.Timezone tz;      // try to get the real local time settings   
143:    return expert(localtime());   };    - .Rule.Timezone tz_from_tzfile(string tzfile) + Calendar.Rule.Timezone tz_from_tzfile(string tzfile)   {    array header = array_sscanf(tzfile, "%4s%16s%4c%4c%4c%4c%4c%4c");    if( sizeof(header)<8 ) return 0;
160:   // ----------------------------------------------------------------   // expert system to pick out the correct timezone    - static .Rule.Timezone timezone_expert_rec(.Rule.Timezone try, + static Calendar.Rule.Timezone timezone_expert_rec(Calendar.Rule.Timezone try,    mapping|array|string tree,    object cal)   {
187:    return `[](tree);   }    - static .Rule.Timezone timezone_select(.Rule.Timezone try, + static Calendar.Rule.Timezone timezone_select(Calendar.Rule.Timezone try,    array tree,    object cal)   {
213:      static object expert_cal, expert_tzn;    - .Rule.Timezone expert(.Rule.Timezone try) + Calendar.Rule.Timezone expert(Calendar.Rule.Timezone try)   {    if(!expert_cal)    expert_cal=master()->resolv("Calendar")["ISO_UTC"];
308:      class Timezone_Encapsule   { -  .Rule.Timezone what; +  Calendar.Rule.Timezone what;       constant is_timezone=1;    constant is_dst_timezone=1; // ask me
317:    static int extra_offset;    string name;    -  static void create(.Rule.Timezone enc,string name,int off) +  static void create(Calendar.Rule.Timezone enc,string name,int off)    {    what=enc;    extra_name=name;
345:    int raw_utc_offset() { return what->raw_utc_offset()+extra_offset; }   }    - static private .Rule.Timezone _make_new_timezone_i(string tz,int plusminus) + static private Calendar.Rule.Timezone _make_new_timezone_i(string tz, +  int plusminus)   { -  .Rule.Timezone z=`[](tz); +  Calendar.Rule.Timezone z=`[](tz);    if (!z) return UNDEFINED;    return make_new_timezone(z,plusminus);   }      // internal, don't use this outside calendar module - .Rule.Timezone make_new_timezone(.Rule.Timezone z,int plusminus) + Calendar.Rule.Timezone make_new_timezone(Calendar.Rule.Timezone z,int plusminus)   {    if (plusminus>14*3600 || plusminus<-14*3600)    error("difference out of range -14..14 h\n");
399:    return neg*a*3600; // ignore litter   }    - static private .Rule.Timezone _magic_timezone(string tz) + static private Calendar.Rule.Timezone _magic_timezone(string tz)   {    string z,w;   
436:    return ::`[](replace(tz,"-/+"/1,"__p"/1));   }    - .Rule.Timezone `[](string tz) + Calendar.Rule.Timezone `[](string tz)   {    mixed p=::`[](tz);    if (!p && tz=="locale") return locale=_locale();
1147:    (["TZrules":Dummymodule(find_rule),    "TZRules":TZRules,    "TZHistory":TZHistory, -  "Rule":.Rule, +  "Rule":Calendar.Rule,    "ZEROSHIFT":({0,0,0,""})    ]);   
1437:    constant is_dst_timezone=1;      // figure out what timezone to use -  .Rule.Timezone whatrule(int ux); +  Calendar.Rule.Timezone whatrule(int ux);       string name=sprintf("%O",this_program);