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.296 2003/09/08 12:57:33 grubba Exp $ + // $Id: master.pike.in,v 1.297 2003/09/09 16:57:34 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:2793:   //! by changing element @expr{0@} of @[ret_obj].   //!   //! @returns   //! The a description of the path.   //!   //! @note   //! The returned description will end with a proper indexing method   //! currently either @expr{"."@} or @expr{"->"@}.   string describe_module(object|program mod, array(object)|void ret_obj)   { -  if (!mod) return ""; // efun or function in gmp(0). -  program parent_fun; -  if (objectp(mod)) { -  parent_fun = object_program(mod); -  if (ret_obj) ret_obj[0] = [object]mod; -  } else if (intp(mod)) { -  // Function in gmp -  if (ret_obj) ret_obj[0] = [object]mod; -  return sprintf("%O->", mod); -  }else { -  parent_fun = [program]mod; -  if (objectp (mod = objects[parent_fun]) && ret_obj) -  ret_obj[0] = [object]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 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:2828:    return program_path_to_name(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 + [string]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 = [array(string)]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") + "()->";   }   
pike.git/lib/master.pike.in:2887:    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 = [string]indices(parent_obj)[i];    return describe_module(parent_obj) + s;    }    }    };    if(objectp (objects[parent_fun]))    if ((s = programs_reverse_lookup (parent_fun)) &&    (s=program_path_to_name(s, "", "", "()")))
pike.git/lib/master.pike.in:2958:    {    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([function(mixed...:void|mixed)]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.