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.251 2003/01/26 18:31:02 nilsson Exp $ + // $Id: master.pike.in,v 1.252 2003/01/27 03:49:43 nilsson 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:2687:    end = 1;       mapping(string:int) prev_pos = ([]);    array(string) frames = ({});    int loop_start = 0, loop_next, loops;       for(e = sizeof(trace)-1; e>=end; e--)    {    mixed tmp;    string row; -  if (mixed err=catch { +  if (array err=[array]catch {    tmp = trace[e];    if(stringp(tmp))    {    row=tmp;    }    else if(arrayp(tmp))    {    string pos;    if(sizeof(tmp)>=2 && stringp(tmp[0])) {    if (intp(tmp[1])) {
pike.git/lib/master.pike.in:2822:   //! Returns only the error message from a backtrace.   //!   //! If there is no error message in the backtrace, a fallback message   //! will be returned.   //!   //! @seealso   //! @[backtrace()], @[describe_backtrace()]   //!   string describe_error (mixed trace)   { -  if((arrayp(trace) && sizeof(trace)==2 && stringp(trace[0])) || -  (objectp(trace) && trace->is_generic_error)) +  if((arrayp(trace) && sizeof([array]trace)==2 && +  stringp(([array]trace)[0])) || +  (objectp(trace) && ([object]trace)->is_generic_error))    {    if (catch { -  return trace[0] || "No error message.\n"; +  return ([array(string)]trace)[0] || "No error message.\n";    }) {    return "Error indexing backtrace!\n";    }    }    return sprintf ("Backtrace is of unknown type %t!\n", trace);   }         class Codec (void|string fname, void|int mkobj)   {
pike.git/lib/master.pike.in:2851:    if(fname)    {    programs[fname]=prog_to_mkobj=p;    fname=0;    if (mkobj)    return objectp (objects[p]) ? objects[p] : (objects[p]=__null_program());    }    return 0;    }    -  mapping f=all_constants(); +  mapping(string:mixed) f=all_constants();       string nameof(mixed x)    { -  if(mixed tmp=search(f,x)) -  return "efun:"+tmp; +  if(string s=search(f,x)) +  return "efun:"+s;       if (programp(x)) { -  if(mixed tmp=search(programs,x)) -  return tmp; +  if(string s=search(programs,x)) +  return s;    -  if(mixed tmp=search(values(_static_modules), x)) +  if(int tmp=search(values(_static_modules), x))    return "_static_modules."+(indices(_static_modules)[tmp]);    }    else if (objectp(x)) -  if(mixed tmp=search(objects,x)) -  if(tmp=search(programs,tmp)) -  return tmp; +  if(program p=search(objects,x)) +  if(string s=search(programs,p)) +  return s;    return UNDEFINED;    }       function functionof(string x)    { -  if(sscanf(x,"efun:%s",x)) return f[x]; -  if(sscanf(x,"resolv:%s",x)) return resolv(x); +  if(sscanf(x,"efun:%s",x)) return [function]f[x]; +  if(sscanf(x,"resolv:%s",x)) return [function]resolv(x);    return 0;    }       object objectof(string x)    { -  if(sscanf(x,"efun:%s",x)) return f[x]; -  if(sscanf(x,"resolv:%s",x)) return resolv(x); +  if(sscanf(x,"efun:%s",x)) return [object]f[x]; +  if(sscanf(x,"resolv:%s",x)) return [object]resolv(x);    if(sscanf(x,"mpath:%s",x))    foreach(pike_module_path, string path) {    object ret = low_cast_to_object(combine_path(path,x),0);    if (objectp (ret)) return ret;    }    return cast_to_object(x,0);    }       program programof(string x)    { -  if(sscanf(x,"efun:%s",x)) return f[x]; -  if(sscanf(x,"resolv:%s",x)) return resolv(x); +  if(sscanf(x,"efun:%s",x)) return [program]f[x]; +  if(sscanf(x,"resolv:%s",x)) return [program]resolv(x);    if(sscanf(x,"mpath:%s",x))    foreach(pike_module_path, string path)    if(program ret=cast_to_program(combine_path(path,x),0))    return ret;    return cast_to_program(x,0);    }       mixed encode_object(object x)    { -  if(x->_encode) return x->_encode(); +  if(x->_encode) return ([function]x->_encode)();    error("Cannot encode objects yet.\n");    }          void decode_object(object o, mixed data)    {    o->_decode(data);    }   }   
pike.git/lib/master.pike.in:2932:    int minor;       //! @decl void create(int major, int minor)    //! Set the version in the object.    void create(int maj, int min)    {    major = maj;    minor = min;    }    - #define CMP(X) ((major - (X)->major) || (minor - (X)->minor)) + #define CMP(X) ((major - ([object]X)->major) || (minor - ([object]X)->minor))       //! Methods define so that version objects    //! can be compared and ordered. -  int `<(Version v) { return CMP(v) < 0; } -  int `>(Version v) { return CMP(v) > 0; } -  int `==(Version v) { return CMP(v)== 0; } +  int `<(mixed v) { return objectp(v) && CMP(v) < 0; } +  int `>(mixed v) { return objectp(v) && CMP(v) > 0; } +  int `==(mixed v) { return objectp(v) && CMP(v)== 0; }    int _hash() { return major * 4711 + minor ; }       string _sprintf(int t) {    switch(t) {    case 's': return sprintf("%d.%d",major,minor);    case 'O': return sprintf("%O(%s)", this_program, this_object());    }    }       //! The version object can be casted into a string.