pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1:   /* -*- Pike -*-    * -  * $Id: master.pike.in,v 1.109 2000/03/27 01:17:23 per Exp $ +  * $Id: master.pike.in,v 1.110 2000/03/30 19:04:50 grubba Exp $    *    * Master-file for Pike.    *    * Based on master.pike 1.67.    */      // Some configurable parameters useful for debugging      #define PIKE_AUTORELOAD   
pike.git/lib/master.pike.in:71:      #define UNDEFINED (([])[0])   #define error(X) throw( ({ (X), backtrace()/*[0..sizeof(backtrace())-2]*/ }) )      string describe_backtrace(array trace);   object low_cast_to_object(string oname, string current_file);      array(string) pike_include_path=({});   array(string) pike_module_path=({});   array(string) pike_program_path=({}); - int want_warnings; + int want_warnings = 1;      #ifdef PIKE_AUTORELOAD      int autoreload_on;   int newest;      #define AUTORELOAD_CHECK_FILE(X) \    if(autoreload_on) if(mixed fnord=master_file_stat(X)) if(fnord[3]>newest) newest=fnord[3];      #define AUTORELOAD_BEGIN() \
pike.git/lib/master.pike.in:267:   {    program ret;    array s;    string fname=pname+ext;      #ifdef THREADED    object key;    // FIXME: The catch is needed, since we might be called in    // a context when threads are disabled.    // (compile() disables threads). -  catch { +  mixed err = catch {    key=compilation_mutex->lock(2);    }; -  +  if (err) { +  werror(sprintf("low_findprog: Caught spurious error:\n" +  "%s\n", describe_backtrace(err))); +  }   #endif      #ifdef PIKE_AUTORELOAD    if(!autoreload_on || load_time[fname]>=time())   #endif    {    if(!zero_type (ret=programs[fname])) return ret;    }      #ifdef __NT__
pike.git/lib/master.pike.in:571:    return o;    error("Cast '"+oname+"' to object failed"+    (current_file?sprintf("for '%s'",current_file):"")+".\n");    return 0;   }      class dirnode   {    string dirname;    mixed module; -  mapping cache=([]); -  array files; +  mapping(string:mixed) cache=([]); +  array(string) files;       void create(string name)    {    dirname=name;       if(module=findmodule(dirname+"/module"))    if(mixed tmp=module->_module_value)    module=tmp;    }    -  static object|program ind(string index) +  static mixed ind(string index)    {    if(module)    {    object o;    if(!zero_type(o=module[index])) return o;    }       if( !files )    files = get_dir(dirname);   
pike.git/lib/master.pike.in:615:    index = dirname+"/"+index;    if(object o=findmodule(index))    {    if(mixed tmp=o->_module_value) o=tmp;    return o;    }    if (program p=cast_to_program( index, 0 )) return p;    return UNDEFINED;    }    -  object|program `[](string index) +  mixed `[](string index)    {    mixed ret;    if(!zero_type(ret=cache[index]))    {    if(ret!=0) return ret;    return UNDEFINED;    }    return cache[index]=ind(index);    }    -  int _cache_full; +  static int _cache_full;    void fill_cache()    {   #ifdef RESOLV_DEBUG    werror(describe_backtrace(({ sprintf("Filling cache in dirnode %O\n",    dirname),    backtrace() })));   #endif /* RESOLV_DEBUG */    if (_cache_full) {    return;    }
pike.git/lib/master.pike.in:667:    compile_warning(dirname+"."+fname, 0,    sprintf("Compilation failed:\n"    "%s\n",    describe_backtrace(err)));    }    }    _cache_full = 1;    }    array(string) _indices()    { +  // werror("indices(%O) called\n", dirname);    fill_cache();    return indices(filter(cache, lambda(mixed x){ return x!=0; }));    }    array(mixed) _values()    { -  +  // werror("values(%O) called\n", dirname);    fill_cache();    return values(cache)-({0});    }   };      static class ZERO_TYPE {};      class joinnode   {    array(object|mapping) joined_modules; -  mapping cache=([]); +  mapping(string:mixed) cache=([]);       void create(array(object|mapping) _joined_modules)    {    joined_modules = _joined_modules;    }    -  static object|mapping|program ind(string index) +  static mixed ind(string index)    {    array(mixed) res = ({});    foreach(joined_modules, object|mapping o)    {    mixed ret;    if (!zero_type(ret = o[index]))    {    if (objectp(ret = o[index]) &&    (< joinnode, dirnode >)[object_program(ret)])    {
pike.git/lib/master.pike.in:717:    }    }    }    if (sizeof(res) > 1)    return joinnode(res);    else if (sizeof(res))    return res[0];    return UNDEFINED;    }    -  object|mapping|program `[](string index) +  mixed `[](string index)    { -  object|mapping|program ret; +  mixed ret;    if (!zero_type(ret = cache[index])) {    if (ret != ZERO_TYPE) {    return ret;    }    return UNDEFINED;    }    ret = ind(index);    if (zero_type(ret)) {    cache[index] = ZERO_TYPE;    } else {    cache[index] = ret;    }    return ret;    } -  int _cache_full; +  static int _cache_full;    void fill_cache()    {   #ifdef RESOLV_DEBUG    werror(describe_backtrace(({ "Filling cache in joinnode\n",    backtrace() })));   #endif /* RESOLV_DEBUG */    if (_cache_full) {    return;    }    foreach(joined_modules, object|mapping|program o) {
pike.git/lib/master.pike.in:928:    q=tmp->find_all_options(argv,({    ({"version",tmp->NO_ARG,({"-v","--version"})}),    ({"help",tmp->NO_ARG,({"-h","--help"})}),    ({"execute",tmp->HAS_ARG,({"-e","--execute"})}),    ({"preprocess",tmp->HAS_ARG,({"-E","--preprocess"})}),    ({"modpath",tmp->HAS_ARG,({"-M","--module-path"})}),    ({"ipath",tmp->HAS_ARG,({"-I","--include-path"})}),    ({"ppath",tmp->HAS_ARG,({"-P","--program-path"})}),    ({"showpaths",tmp->NO_ARG,"--show-paths"}),    ({"warnings",tmp->NO_ARG,({"-w","--warnings"})}), +  ({"nowarnings",tmp->NO_ARG,({"-W", "--woff", "--no-warnings"})}),   #ifdef PIKE_AUTORELOAD    ({"autoreload",tmp->NO_ARG,({"--autoreload"})}),   #endif    ({"master",tmp->HAS_ARG,"-m"}),    ({"compiler_trace",tmp->NO_ARG,"--compiler-trace"}),    ({"optimizer_debug",tmp->MAY_HAVE_ARG,"--optimizer-debug"}),    ({"debug",tmp->MAY_HAVE_ARG,"--debug",0,1}),    ({"trace",tmp->MAY_HAVE_ARG,"--trace",0,1}),    ({"ignore",tmp->MAY_HAVE_ARG,"-Dqdatplr",0,1}),    ({"ignore",tmp->HAS_ARG,"-s"}),
pike.git/lib/master.pike.in:986:    break;       case "ppath":    add_program_path(q[i][1]);    break;       case "warnings":    want_warnings++;    break;    +  case "no-warnings": +  want_warnings--; +  break; +     case "master":    _master_file_name = q[i][1];    break;    }    }       foreach(q, array opts)    {    switch(opts[0])    {