pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1:   // -*- Pike -*-   //   // Master Control Program for Pike.   //   // This file is part of Pike. For copyright information see COPYRIGHT.   // Pike is distributed under GPL, LGPL and MPL. See the file COPYING   // for more information.   // - // $Id: master.pike.in,v 1.411 2008/02/07 01:47:15 mast Exp $ + // $Id: master.pike.in,v 1.412 2008/02/28 18:18:28 grubba Exp $      #pike __REAL_VERSION__   //#pragma strict_types      // Some programs destroys character pairs beginning with the currency   // symbol when running in chinese locale.   #if "ยค/" != "\244/"   #error "master.pike.in is corrupted."   #endif   
pike.git/lib/master.pike.in:2468:    INC_RESOLV_MSG_DEPTH();       // FIXME: Support having the cache in the handler?    if( no_resolv[ identifier ] ) {    DEC_RESOLV_MSG_DEPTH();    resolv_debug("resolv(%O, %O) => excluded\n",identifier, current_file);    return UNDEFINED;    }       if (current_file && !stringp(current_file)) { -  error( "resolv(%O, %O, %O): current_file is not a string!\n", -  identifier, current_file, current_handler, -  backtrace() ); +  error("resolv(%O, %O, %O): current_file is not a string!\n", +  identifier, current_file, current_handler);    }    -  array(string) tmp=identifier/"."; -  mixed ret = resolv_base(tmp[0], current_file, current_handler); -  foreach(tmp[1..],string index) { +  array(string) tmp = identifier/"::"; +  mixed ret; +  if (sizeof(tmp) > 1) { +  string scope = tmp[0]; +  tmp = tmp[1]/":"; +  switch(scope) { +  case "predef": +  ret = all_constants(); +  break; +  default: +  if (sscanf(scope, "%d.%d%*s", int major, int minor) == 3) { +  // Versioned identifier. +  ret = get_compilation_handler(major, minor); +  if (ret) { +  if (tmp[0] == "__default") { +  tmp = tmp[1..]; +  ret = ret->resolv("__default"); +  } else { +  ret = ret->get_default_module(); +  } +  break; +  } +  } +  error("resolv(%O, %O, %O): Unsupported scope: %O!\n", +  identifier, current_file, current_handler, scope); +  } +  } else { +  tmp = identifier/"."; +  ret = resolv_base(tmp[0], current_file, current_handler); +  tmp = tmp[1..]; +  } +  foreach(tmp,string index) {    resolv_debug("indexing %O with %O...\n",    ret, index);    resolv_debug("indices(Gmp): %O\n", indices(ret));    if (zero_type(ret)) break;    ret = ret[index];    }    DEC_RESOLV_MSG_DEPTH();   #ifdef RESOLV_DEBUG    if (zero_type (ret))    resolv_debug("resolv(%O, %O) => not found\n",identifier, current_file);
pike.git/lib/master.pike.in:4093:   //! All lowercase letters and the symbols ':', '/' and '.' are   //! reserved for internal use in both cases where characters are used   //! above.   {    mixed encoded;       static mapping(mixed:string) rev_constants = ([]);    static mapping(mixed:string) rev_static_modules = ([]);       static array find_index (object|program parent, mixed child, -  array(object) module_object) +  array(object) module_object, +  int|void try)    {    array id;       find_id: {    array inds = indices (parent), vals = values (parent);    int i = search (vals, child);    if (i >= 0 && parent[inds[i]] == child) {    id = ({inds[i]});    ENC_MSG (" found as parent value with index %O\n", id[0]);    }
pike.git/lib/master.pike.in:4123:    module_object[0] = val;    id = ({inds[i]});    }    else    id = ({inds[i], 'p'});    ENC_MSG (" found as program of parent value object %O with index %O\n",    val, id[0]);    break find_id;    }    +  if (try) { +  ENC_MSG("Cannot find %O in %O.\n", child, parent); +  return UNDEFINED; +  }    error ("Cannot find %O in %O.\n", child, parent);    }    }    -  if (!stringp (id[0])) +  if (!stringp (id[0])) { +  if (try) { +  ENC_MSG("Got nonstring index %O for %O in %O.\n", id[0], child, parent); +  return UNDEFINED; +  }    error ("Got nonstring index %O for %O in %O.\n", id[0], child, parent); -  +  }       return id;    }       static string|array compare_resolved (string name, mixed what,    mixed resolved, array(object) module_object)    {    array append;       compare: {    if (resolved == what) {    ENC_MSG (" compare_resolved: %O is %O\n", what, resolved); -  break compare; +  /* No need for anything advanced. resolv() does the job. */ +  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_dirnode)
pike.git/lib/master.pike.in:4264:   #if 0    else if ((prog = object_program (what)))    ENC_MSG (" got program of object: %O\n", prog);   #endif       if (prog) {    if (prog == encoded) ENC_RETURN ("o");    if (string path = programs_reverse_lookup (prog)) {    ENC_MSG (" found path in programs: %O\n", path);    string name = program_path_to_name (path); +  ENC_MSG (" program name: %O\n", name);    if (string|array ref = compare_resolved (name,    what->_module_value || what,    resolv (name), module_object))    ENC_RETURN (ref);    else {    ENC_MSG (" Warning: Failed to resolve; encoding path\n");   #ifdef PIKE_MODULE_RELOC    ENC_RETURN ("o" + unrelocate_module (path));   #else    ENC_RETURN ("o" + path);
pike.git/lib/master.pike.in:4315:    // module object and not the program. That since we'll    // always be able to do a better job if we base the indexing    // on objects.    array parent_object = ({0});    string|array parent_name = nameof (parent, parent_object);    if (!parent_name) {    ENC_MSG (" inside the thing to encode - encoding recursively\n");    return UNDEFINED;    }    else { +  ENC_MSG(" parent has name: %O\n", parent_name);    if (objectp (parent_object[0])) parent = parent_object[0];    array id = find_index (parent, what, module_object); -  if (equal (id, ({"_module_value"}))) +  if ((equal(id, ({"_module_value"}))) || +  (equal(id, ({ "__default" })) && has_suffix(parent_name, "::")))    ENC_RETURN (parent_name);    else    ENC_RETURN ((arrayp (parent_name) ? parent_name : ({parent_name})) + id);    }    }    }       error ("Failed to find name of unencodable object %O.\n", what);    }   
pike.git/lib/master.pike.in:4363:    }       array parent_object = ({0});    string|array parent_name = nameof (parent, parent_object);    if (!parent_name) {    ENC_MSG (" inside the thing to encode - encoding recursively\n");    return UNDEFINED;    }       else { +  ENC_MSG(" parent has name: %O\n", parent_name);    if (objectp (parent_object[0])) parent = parent_object[0]; -  if (parent["_module_value"] == what && objects_reverse_lookup (parent)) { +  if (parent["_module_value"] == what && +  objects_reverse_lookup (parent)) {    ENC_MSG (" found as _module_value of parent module\n");    ENC_RETURN (parent_name);    }    else {    string|array id = function_name ([program]what);    if (stringp (id) && parent[id] == what) {    ENC_MSG (" found function name in parent: %O\n", id);    id = ({id});    } -  else +  else { +  if (stringp(parent_name) && +  has_suffix(parent_name, "::__default") && +  parent->all_constants) { +  if (id = find_index(parent->all_constants(), what, +  module_object, 1)) { +  ENC_MSG(" found in all_constants() for %O: %O\n", +  parent, id); +  ENC_RETURN(({parent_name[..sizeof(parent_name)- +  (1+sizeof("__default"))] + id[0]}) + +  id[1..]); +  } +  }    id = find_index (parent, what, module_object); -  +  }    if (equal (id, ({"_module_value"})))    ENC_RETURN (parent_name);    else    ENC_RETURN ((arrayp (parent_name) ? parent_name : ({parent_name})) + id);    }    }    }       error ("Failed to find name of %t %O.\n", what, what);    }