pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1908:   //! @seealso   //! @[joinnode]   class dirnode (string dirname, object|void compilation_handler,    string|void name)   {    constant is_resolv_dirnode = 1;    // objectp() is intentionally not used on the module object, to    // allow a module to deny its own existence with `!.    mixed module;    mapping(string:mixed) cache=([]); +  +  // Maps a base name like "Bar" to an ordered array of file paths, +  // e.g. ({ "/lib/Foo.pmod/Bar.pmod", "/lib/Foo.pmod/Bar.so" }).    mapping(string:array(string)) file_paths = ([]);      #ifdef __NT__   #define FIX_CASE(X) lower_case(X)   #else   #define FIX_CASE(X) (X)   #endif /* __NT__ */       protected string base_from_filename(string fname)    {
pike.git/lib/master.pike.in:1949:    }    return 0;    }       protected int prio_from_filename(string fname)    {    fname = FIX_CASE(fname);    if (has_suffix(fname, ".pmod")) return 3;    if (has_suffix(fname, ".so")) return 2;    if (has_suffix(fname, ".pike")) return 1; -  -  // FIXME: Warn here? -  return 0; +  return 0; // We will not reach this.    }       protected void create()    {    if (!dirname) {    error("Attempt to create a dirnode without a directory.\n"    "Have you inherited a dirnode?\n");    }       resolv_debug ("dirnode(%O,%O) created with name %O\n", dirname,    compilation_handler, name);    fc[dirname]=this; -  array(string) files = sort(master_get_dir(dirname)||({})); +     if (!sizeof(dirname)) return; -  +  array(string) files = sort(master_get_dir(dirname)||({}));    array(string) bases = map(files, base_from_filename);    files = filter(files, bases);    bases = filter(bases, bases);    resolv_debug("dirnode(%O,%O) got %d files.\n",    dirname, compilation_handler, sizeof(bases));    if (!sizeof(files)) return;       foreach(files; int no; string fname) {    fname = combine_path(dirname, fname);    string base = bases[no];
pike.git/lib/master.pike.in:1998:    // Insert sort. Worst case is 3 filenames.    int prio = prio_from_filename(fname);    int index;    foreach(paths; index; string other_fname) {    if (prio_from_filename(other_fname) <= prio) break;    }    file_paths[base] = paths[..index-1] + ({ fname }) + paths[index..];    }    }    -  class module_checker +  protected class module_checker    {    protected int `!()    {    resolv_debug ("dirnode(%O)->module_checker()->`!()\n",dirname);       if (mixed err = catch {    // Look up module.    if (module = cache["module"] || low_ind("module", 1)) {    /* This allows for `[] to have side effects first time    * it is called. (Specifically, the Calendar module uses
pike.git/lib/master.pike.in:2149:    if (_cache_full) {    DEC_RESOLV_MSG_DEPTH();    resolv_debug("dirnode(%O)->ind(%O) => cache_full %O\n",    dirname, index, cache[index]);    return cache[index];    }       if(module)    {    mixed o; - // _describe(module); +     if(!undefinedp(o=module[index]))    {    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("dirnode(%O)->ind(%O) => found %O\n",    dirname, index, o);    return o;    }    resolv_debug ("dirnode(%O)->ind(%O) => not found in module\n",    dirname, index);    }
pike.git/lib/master.pike.in:2220:    dirname+"."+fname,    "Compilation failed: " +    call_describe_error(err));    }    return UNDEFINED;    }       protected int(0..1) _cache_full;    void fill_cache()    { - #if 0 -  werror(call_describe_backtrace(({ sprintf("Filling cache in dirnode %O\n", -  dirname), -  backtrace() }))); - #endif +     if (_cache_full) {    return;    }       resolv_debug ("dirnode(%O) => Filling cache...\n", dirname);       // NOTE: We rely on side effects in `[]() and safe_index()    // to fill the cache.       // Why shouldn't thrown errors be propagated here? /mast