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.249 2003/08/18 12:43:49 tomas Exp $ + // $Id: master.pike.in,v 1.250 2003/09/09 16:57:04 mast Exp $      #pike __REAL_VERSION__      // Some programs destroys character pairs beginning with the currency   // symbol when running in chinese locale.   #if "ยค/" != "\244/"   #error "master.pike.in is corrupted."   #endif      // --- Some configurable parameters
pike.git/lib/master.pike.in:2439:   //! by changing element @tt{0@} of @[ret_obj].   //!   //! @returns   //! The a description of the path.   //!   //! @note   //! The returned description will end with a proper indexing method   //! currently either @tt{"."@} or @tt{"->"@}.   string describe_module(object|program mod, array(object)|void ret_obj)   { -  if (!mod) return ""; -  program parent_fun; -  if (objectp(mod)) { -  parent_fun = object_program(mod); +  // Note: mod might be a bignum object; objectp won't work right for +  // our purposes. object_program returns zero for non-objects, so we +  // use it instead. +  program parent_fun = object_program(mod); +  if (parent_fun) {    if (ret_obj) ret_obj[0] = mod; -  } else { +  } else if (programp (mod)) {    parent_fun = mod;    if (objectp (mod = objects[parent_fun]) && ret_obj) ret_obj[0] = mod;    } -  +  else +  return ""; // efun +     if (mod) {    catch {    string res = sprintf("%O", mod);    if (res != "object" && res != "")    return (objectp (objects[parent_fun]) && programs["/master"] != parent_fun?    res+".":res+"->");    };    }    if (!object_program(parent_fun)) {    // We might be a top-level entity.
pike.git/lib/master.pike.in:2469:    if(path) return path;    }    // Begin by describing our parent.    array(object) parent_obj = ({ 0 });    string res = describe_module(function_object(parent_fun)||    function_program(parent_fun)||    object_program(parent_fun),    parent_obj);    // werror("So far: %O parent_obj:%O\n", res, parent_obj);    object|program parent = -  objectp (parent_obj[0]) ? parent_obj[0] : object_program(parent_fun); -  if (mod && (objectp (parent) || parent)) { +  object_program (parent_obj[0]) ? parent_obj[0] : object_program(parent_fun); +  if (mod && (object_program (parent) || parent)) {    // Object identified.    catch {    // Check if we're an object in parent.    int i = search(values(parent), mod);    if (i >= 0) {    return res + indices(parent)[i] + ".";    }    };    }       // We're cloned from something in parent.    if (string fun_name = function_name(parent_fun)) {    return res + fun_name + "()->";    }       // No such luck.    // Try identifying a clone of ourselves. -  if (!mod && (objectp (parent) || parent)) { +  if (!mod && (object_program (parent) || parent)) {    catch {    // Check if there's a clone of parent_fun in parent_obj.    int i;    array(mixed) val = values(parent);    array(string) ind = indices(parent);    for (i=0; i < sizeof(val); i++) { -  if (objectp(val[i]) && object_program(val[i]) == parent_fun) { +  if (object_program(val[i]) && object_program(val[i]) == parent_fun) {    return res + ind[i] + ".";    }    }    };    }       // We're really out of luck here...    return res + (describe_program(parent_fun)||"unknown_program") + "()->";   }      //!   string describe_object(object|program o)   {    string s; -  if(!o) return 0; +        function parent_fun = object_program(o); -  +  if(!parent_fun) return 0;       /* Constant object? */    catch {    object|program parent_obj =    (function_object(parent_fun) || function_program(parent_fun));       if (objectp (parent_obj) || parent_obj) {    /* Check if we have a constant object. */    object tmp = objects[parent_obj];    if (objectp (tmp)) parent_obj = tmp;       /* Try finding ourselves in parent_obj. */    int i; -  if (objectp(o)) { +  if (object_program(o)) {    i = search(values(parent_obj), o);    } else {    i = search(map(values(parent_obj),    lambda(mixed x) { -  if (objectp(x)) return object_program(x); +  if (program p = object_program(x)) return p;    return 0; -  }), o); +  }), (mixed) o);    }    if (i >= 0) {    s = indices(parent_obj)[i];    return describe_module(parent_obj) + s;    }    }    };    if(objectp (objects[parent_fun]))    if(s=get_clean_program_path(parent_fun, "", "", "()"))    return s;
pike.git/lib/master.pike.in:2590:    {    if(has_suffix(s, ".pmod"))    name = EXPLODE_PATH(s[..sizeof(s)-6])[-1];    else    name = trim_file_name(s);    }    else    if (catch (name = function_name (f))) name = "function";       object o = function_object(f); -  if(objectp (o)) { // Check if it's an object in a way that (hopefully) doesn't -  // call any functions in it (neither `== nor `!). +  if(object_program (o)) { // Check if it's an object in a way that +  // (hopefully) doesn't call any functions +  // in it (neither `== nor `!).    string s;    if (!catch (s = sprintf("%O",o)) && s != "object")    return s+"->"+name;    }    return name;   }      /* It is possible that this should be a real efun,    * it is currently used by handle_error to convert a backtrace to a    * readable message.