Branch: Tag:

2003-03-09

2003-03-09 22:52:49 by Martin Nilsson <mani@lysator.liu.se>

Cleaned up compilation somewhat. No difference in speed though.

Rev: lib/modules/Calendar.pmod/Timezone.pmod:1.28

687:       res+=    ({TZrules_init+ -  "import __Calendar_mkzone;\n" +     " inherit TZRules;\n"    " array(array(string|int)) jd_year_periods(int jd)\n"    " {\n"
942:    if (!sizeof(rules))    error("no rules for %O\n",id);    -  res+=({"import __Calendar_mkzone;\n"}); -  +     if (sizeof(rules)==1) // simple zone    {    res+=({"object thezone=",rules[0][4],";\n"});
1051:    mixed `[](string s) { return f(s); }    }    -  mapping mkzonemod= +  object compile_handler = class { +  mapping(string:mixed) get_default_module() { +  return constants; +  } +  +  mapping constants = all_constants() +    (["TZrules":Dummymodule(find_rule),    "TZRules":TZRules,    "TZHistory":TZHistory,    "Ruleset":Ruleset, -  "ZEROSHIFT":({0,0,0,""})]); +  "ZEROSHIFT":({0,0,0,""}) +  ]);    -  +  }(); +    // #define RTTZC_DEBUG   // #define RTTZC_TIMING   
1130:    werror("%s\n",c);   #endif    -  add_constant("__Calendar_mkzone",mkzonemod); +     program p; -  mixed err=catch { p=compile_string(c); }; -  add_constant("__Calendar_mkzone"); +  mixed err=catch { p=compile_string(c, 0, compile_handler); };    if (err)    {    int i=0;
1217:    float t2=time(t);   #endif    -  add_constant("__Calendar_mkzone",mkzonemod); +  program p=compile_string(c, 0, compile_handler);    -  program p=compile_string(c); -  +    #ifdef RTTZC_TIMING    float t3=time(t);    werror("compile %O: %O\n",s,t3-t2);