pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1228:   {    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;   }    + protected bool is_joinnode(mixed o) + { +  return objectp(o) && object_program(o)->is_resolv_joinnode; + } +  + protected bool is_dirnode(mixed o) + { +  return objectp(o) && object_program(o)->is_resolv_dirnode; + } +    //! Find the files in which @[mod] is defined, as they may be hidden away in   //! joinnodes and dirnodes   //!   //! @param mod   //! The module we are looking for.   //!   //! @returns   //! An array of strings with filenames.   //! (one for each file in a joinnode, or just one otherwise)   array(string) module_defined(object|program mod)   {    array files = ({});    if (programp(mod))    return ({ Builtin.program_defined([program]mod) });       array mods; -  if (objectp(mod) && object_program(mod)->is_resolv_joinnode) +  if (is_joinnode(mod))    mods = mod->joined_modules;    else    mods = ({ mod });       foreach (mods;; object mod)    { -  if (objectp(mod) && object_program(mod)->is_resolv_dirnode) +  if (is_dirnode(mod))    files += ({ Builtin.program_defined(object_program(mod->module)) });    else    files += ({ Builtin.program_defined(object_program(mod)) });    }    return files;   }      //! Enable caching of sources from compile_string()   void enable_source_cache()   {
pike.git/lib/master.pike.in:1288:       if (programp(obj))    prog = obj;    if (functionp(obj))    {    prog = function_program(obj);    child = ((describe_function(obj)||"")/"->")[-1];    }    if (objectp(obj))    { -  if (object_program(obj)->is_resolv_joinnode) +  if (is_joinnode(obj))    obj = obj->joined_modules[0]; // FIXME: check for multiples -  if (object_program(obj)->is_resolv_dirnode) +  if (is_dirnode(obj))    prog = object_program(obj->module);    else    prog = object_program(obj);    }          if (prog && !documentation[prog] && doc_extractor)    {    string source;    if (source_cache && source_cache[prog])
pike.git/lib/master.pike.in:1558:    resolv_debug("unregister %s\n", fname);    if (m_delete (rev_programs, p))    m_delete (programs, fname);    else    programs[fname] = no_value;       string name = program_path_to_name (fname);    mixed n = has_value (name, '.') ?    resolv ((name / ".")[..<1] * ".") :    get_root_module(); -  if (objectp (n) && (object_program(n)->is_resolv_dirnode || -  object_program(n)->is_resolv_joinnode)) +  if (is_dirnode(n) || is_joinnode(n))    n->delete_value (p);       fname = dirname (fname);    if ( fname!="" && objectp (n = fc[fname]) ) -  if (object_program(n)->is_resolv_dirnode) // Won't find joinnodes in fc. +  if (is_dirnode(n)) // Won't find joinnodes in fc.    n->delete_value (p);    }       object o = m_delete(objects, p);    if (objectp (o)) {    m_delete(rev_objects, o);    }       foreach (fc; string name; mixed mod)    if (objectp(mod) && object_program(mod) == p)
pike.git/lib/master.pike.in:2421:    joined_modules[0] == node) return;    joined_modules = ({ node }) + (joined_modules - ({ node }));    cache = ([]);    }       void rem_path(string path)    {    path = combine_path(getcwd(), path);    joined_modules = filter(joined_modules,    lambda(dirnode node) { -  return !objectp(node) || -  !object_program(node)->is_resolv_dirnode || +  return !is_dirnode(node) ||    (node->dirname != path);    });    cache = ([]);    }       protected mixed ind(string index)    {    resolv_debug ("joinnode(%O)->ind(%O)\n", joined_modules, index);    INC_RESOLV_MSG_DEPTH();       array(mixed) res = ({});    foreach(joined_modules, object|mapping o)    {    mixed ret;    if (!undefinedp(ret = o[index]))    { -  if (objectp(ret) && -  (object_program(ret)->is_resolv_dirnode || -  object_program(ret)->is_resolv_joinnode)) +  if (is_dirnode(ret) || is_joinnode(ret))    {    // Only join directorynodes (or joinnodes).    res += ({ ret });    } else {    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("joinnode(%O)->ind(%O) => found %O\n",    joined_modules, index, ret);    return (ret);    }    }
pike.git/lib/master.pike.in:2567:    void delete_value (mixed val)    {    if (string name = search (cache, val))    m_delete (cache, name);    for (int i = 0; i < sizeof (joined_modules); i++) {    object|mapping|program o = joined_modules[i];    if (o == val) {    joined_modules = joined_modules[..i - 1] + joined_modules[i + 1..];    i--;    } -  else if (objectp (o) && (object_program(o)->is_resolv_dirnode || -  object_program(o)->is_resolv_joinnode)) +  else if (is_dirnode(o) || is_joinnode(o))    o->delete_value (val);    else if (string name = mappingp (o) && search (o, val))    m_delete (o, name);    }    }       protected int `== (mixed other)    {    // NB: Index the program instead of the object to avoid issues    // with modules overloading lfun::`->() with stuff that has    // side-effects (here's looking at you Calendar.Events). -  return objectp (other) && -  (object_program(other)->is_resolv_joinnode == 1) && +  return is_joinnode(other) &&    equal (mkmultiset (joined_modules), mkmultiset (other->joined_modules));    }       array(object) _encode()    {    return joined_modules;    }       void _decode (array(object) joined_modules)    {
pike.git/lib/master.pike.in:3053:    static_modules = default_module["_static_modules"] || ([]);    }    }       node = joinnode(({    // Kluge to get _static_modules to work at top level.    ([ "_static_modules" : static_modules ]),    instantiate_static_modules(static_modules),    // Copy relevant stuff from the root module.    @filter(root_module->joined_modules, -  lambda(mixed x) { -  return objectp(x) && -  object_program(x)->is_resolv_dirnode; -  }) }), +  is_dirnode) +  }),    current_handler,    root_module->fallback_module,    "predef::");       return node;    }       //! Look up @[identifier] in the root module.    mixed resolv_base(string identifier, string|void current_file,    object|void current_handler)
pike.git/lib/master.pike.in:5000:    return "r" + name;    }       if (objectp (resolved)) {    if (object_program (resolved) == what) {    ENC_MSG (" compare_resolved: %O is program of %O\n", what, resolved);    append = ({'p'});    break compare;    }    -  if ((object_program(resolved)->is_resolv_joinnode) && +  if (is_joinnode(resolved) &&    (sizeof(resolved->joined_modules) == 1)) {    ENC_MSG(" compare_resolved: %O is a single element joinnode.\n",    resolved);    resolved = resolved->joined_modules[0];    } -  if (object_program(resolved)->is_resolv_dirnode) { +  if (is_dirnode(resolved)) {    if (resolved->module == what) {    ENC_MSG (" compare_resolved: %O is dirnode module of %O\n", what, resolved);    append = ({'m'});    resolved = resolved->module;    break compare;    }    else if (object_program (resolved->module) == what) {    ENC_MSG (" compare_resolved: %O is program of dirnode module of %O\n",    what, resolved);    append = ({'m', 'p'});    break compare;    }    else    ENC_MSG (" compare_resolved: %O is different from dirnode module %O\n",    what, resolved->module);    }   #if 0    // This is only safe if the joinnode modules don't conflict,    // and we don't know that. -  if (object_program(resolved)->is_resolv_joinnode) { +  if (is_joinnode(resolved)) {    ENC_MSG (" compare_resolved: searching for %O in joinnode %O\n",    what, resolved);    foreach (resolved->joined_modules, mixed part)    if (string|array name = compare_resolved (name, what, part,    module_object)) {    if (module_object) module_object[0] = resolved;    return name;    }    }   #endif
pike.git/lib/master.pike.in:5080:    if (what == encoded) {    ENC_MSG (" got the thing to encode - encoding recursively\n");    return UNDEFINED;    }       if (string id = rev_constants[what]) ENC_RETURN (id);    if (string id = rev_static_modules[what]) ENC_RETURN (id);       if (objectp (what)) {    -  if (object_program(what)->is_resolv_dirnode) { +  if (is_dirnode(what)) {    ENC_MSG (" is a dirnode\n");    string name = program_path_to_name (what->dirname);    if (string|array ref = compare_resolved (name, what, resolv (name),    module_object))    ENC_RETURN (ref);    }    -  else if (object_program(what)->is_resolv_joinnode) { +  else if (is_joinnode(what)) {    ENC_MSG (" is a joinnode\n");    object modules = Builtin.array_iterator (what->joined_modules);    object|mapping value;    check_dirnode: -  if (modules && objectp (value = modules->value()) && -  object_program(value)->is_resolv_dirnode) { +  if (modules && (value = modules->value()) && is_dirnode(value)) {    string name = program_path_to_name (value->dirname);    modules += 1;    foreach (modules;; value) -  if (!objectp (value) || !object_program(value)->is_resolv_dirnode || +  if (!is_dirnode(value) ||    program_path_to_name (value->dirname) != name)    break check_dirnode;    ENC_MSG (" joinnode has consistent name %O\n", name);    if (string|array ref = compare_resolved (name, what, resolv (name),    module_object))    ENC_RETURN (ref);    }    }       else if (what->is_pike_master) {
pike.git/lib/master.pike.in:5418:    if (!programp (subres) && !objectp (subres) && !mappingp (subres))    error ("Cannot subindex %O%{[%O]%} since it's a %t.\n",    res, sublist[1..i-1], subres);    if (undefinedp (subres = ([mapping]subres)[op]))    error ("Cannot find %O in %O%{[%O]%}.\n",    op, res, sublist[1..i-1]);    DEC_MSG (" indexed with %O: %O\n", op, subres);    }    else switch (op) {    case 'm': -  if (objectp (subres) && -  object_program([object]subres)->is_resolv_joinnode) { +  if (is_joinnode(subres)) {    dirnode found;    foreach (([object(joinnode)]subres)->joined_modules,    object|mapping part) -  if (objectp (part) && -  object_program(part)->is_resolv_dirnode && part->module) { +  if (is_dirnode(part) && part->module) {    if (found)    error ("There are ambiguous module objects in %O.\n",    subres);    else    found = [object(dirnode)]part;    }    if (found) subres = found;    }    -  if (objectp (subres) && -  object_program([object]subres)->is_resolv_dirnode) { +  if (is_dirnode(subres)) {    if (([object]subres)->module) {    subres = ([object]subres)->module;    DEC_MSG (" got dirnode module %O\n", subres);    }    else    error ("Cannot find module object in dirnode %O.\n", subres);    }    else    error ("Cannot get module object in thing that isn't "    "a dirnode or unambiguous joinnode: %O\n", subres);