pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1244:   //! @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 (mod->is_resolv_joinnode) +  if (objectp(mod) && object_program(mod)->is_resolv_joinnode)    mods = mod->joined_modules;    else    mods = ({ mod });       foreach (mods;; object mod)    { -  if (mod->is_resolv_dirnode) +  if (objectp(mod) && object_program(mod)->is_resolv_dirnode)    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 (obj->is_resolv_joinnode) +  if (object_program(obj)->is_resolv_joinnode)    obj = obj->joined_modules[0]; // FIXME: check for multiples -  if (obj->is_resolv_dirnode) +  if (object_program(obj)->is_resolv_dirnode)    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) && (n->is_resolv_dirnode || n->is_resolv_joinnode)) +  if (objectp (n) && (object_program(n)->is_resolv_dirnode || +  object_program(n)->is_resolv_joinnode))    n->delete_value (p);       fname = dirname (fname);    if ( fname!="" && objectp (n = fc[fname]) ) -  if (n->is_resolv_dirnode) // Won't find joinnodes in fc. +  if (object_program(n)->is_resolv_dirnode) // 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 = ({ 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) || -  !node->is_resolv_dirnode || +  !object_program(node)->is_resolv_dirnode ||    (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) && -  (ret->is_resolv_dirnode || ret->is_resolv_joinnode)) +  (object_program(ret)->is_resolv_dirnode || +  object_program(ret)->is_resolv_joinnode))    {    // 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:2565:    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) && (o->is_resolv_dirnode || o->is_resolv_joinnode)) +  else if (objectp (o) && (object_program(o)->is_resolv_dirnode || +  object_program(o)->is_resolv_joinnode))    o->delete_value (val);    else if (string name = mappingp (o) && search (o, val))    m_delete (o, name);    }    }       protected int `== (mixed other)    { -  return objectp (other) && (other->is_resolv_joinnode == 1) && +  // 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) &&    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:3047:    }    }       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) && x->is_resolv_dirnode; +  return objectp(x) && +  object_program(x)->is_resolv_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,
pike.git/lib/master.pike.in:4992:    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 ((resolved->is_resolv_joinnode) && +  if ((object_program(resolved)->is_resolv_joinnode) &&    (sizeof(resolved->joined_modules) == 1)) {    ENC_MSG(" compare_resolved: %O is a single element joinnode.\n",    resolved);    resolved = resolved->joined_modules[0];    } -  if (resolved->is_resolv_dirnode) { +  if (object_program(resolved)->is_resolv_dirnode) {    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 (resolved->is_resolv_joinnode) { +  if (object_program(resolved)->is_resolv_joinnode) {    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:5072:    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 (what->is_resolv_dirnode) { +  if (object_program(what)->is_resolv_dirnode) {    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 (what->is_resolv_joinnode) { +  else if (object_program(what)->is_resolv_joinnode) {    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()) && -  value->is_resolv_dirnode) { +  object_program(value)->is_resolv_dirnode) {    string name = program_path_to_name (value->dirname);    modules += 1;    foreach (modules;; value) -  if (!objectp (value) || !value->is_resolv_dirnode || +  if (!objectp (value) || !object_program(value)->is_resolv_dirnode ||    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:5410:    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]subres)->is_resolv_joinnode) { +  if (objectp (subres) && +  object_program([object]subres)->is_resolv_joinnode) {    dirnode found;    foreach (([object(joinnode)]subres)->joined_modules,    object|mapping part) -  if (objectp (part) && part->is_resolv_dirnode && part->module) { +  if (objectp (part) && +  object_program(part)->is_resolv_dirnode && 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]subres)->is_resolv_dirnode) { +  if (objectp (subres) && +  object_program([object]subres)->is_resolv_dirnode) {    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);