pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1:   /* -*- Pike -*-    * -  * $Id: master.pike.in,v 1.174 2001/11/07 21:51:19 nilsson Exp $ +  * $Id: master.pike.in,v 1.175 2001/11/08 14:46:36 grubba Exp $    *    * Master-file for Pike.    *    * Based on master.pike 1.67.    */      // Some configurable parameters useful for debugging      #pike __REAL_VERSION__   #define PIKE_AUTORELOAD
pike.git/lib/master.pike.in:479:    if(Stat s2=master_file_stat(fakeroot(oname)))    {    if(s2[1]>=0 && s2[3]>=s[3])    {    mixed err=catch {    AUTORELOAD_CHECK_FILE(oname);    return programs[fname] =    decode_value(master_read_file(oname),    Codec(fname,mkobj));    }; -  if (handler) { +  m_delete(programs, fname); +  if (handler && handler->compile_warning) {    handler->compile_warning(oname, 0,    sprintf("Decode failed:\n"    "\t%s", describe_error(err)));    } else {    compile_warning(oname, 0,    sprintf("Decode failed:\n"    "\t%s", describe_error(err)));    }    } else if (out_of_date_warning) {    if (handler) {
pike.git/lib/master.pike.in:826:   #endif    }       class module_checker    {    int `!()    {   #ifdef MODULE_TRACE    werror("%*ndirnode(%O)->module_checker()->`!()\n",sizeof(backtrace()),dirname);   #endif +  if (mixed err = catch {    if(module=findmodule(dirname+"/module", handler))    {    if(mixed tmp=module->_module_value)    module=tmp;       /* This allows for `[] to have side effects first time    * it is called. (Specifically, the Calendar module uses    * this    */    cache=([]);    _cache_full=0;    } -  +  }) { +  if(!get_inhibit_compile_errors()) +  throw(err); +  } +     return !module;    }       mixed `[](string index)    {   #ifdef MODULE_TRACE    werror("%*ndirnode(%O)->module_checker()[%O]\n",sizeof(backtrace()),dirname,index);   #endif    if(module) return module[index];    }
pike.git/lib/master.pike.in:888:    {    if( search(s, index)!=-1 || search(index,s)!=-1 )    {    ret=1;    break;    }    }    if(!ret)    return UNDEFINED;    index = dirname+"/"+index; + #ifdef MODULE_TRACE +  werror("%*nDirnode(%O) findmodule(%O)\n", +  sizeof(backtrace()), dirname, dirname+"/"+index); + #endif    if(object o=findmodule(index, handler))    {    if(mixed tmp=o->_module_value) o=tmp;    return o;    }    if (program p=cast_to_program( index, 0, handler ))    {   // werror("dirnode(%O)[%O] -> %O\n",dirname,index,p);    return p;    }
pike.git/lib/master.pike.in:2323:    {    row=tmp;    }    else if(arrayp(tmp))    {    string pos;    if(sizeof(tmp)>=2 && stringp(tmp[0])) {    if (intp(tmp[1])) {       string exact_pos = tmp[0] + ":" + tmp[1]; -  int dup_frame; -  if (tmp[1] && !zero_type (dup_frame = prev_pos[exact_pos])) { -  dup_frame -= sizeof (frames); -  if (!loop_start) { -  loop_start = dup_frame; -  loop_next = dup_frame + 1; -  loops = 0; -  continue; -  } -  else { -  int new_loop = 0; -  if (!loop_next) loop_next = loop_start, new_loop = 1; -  if (dup_frame == loop_next++) { -  loops += new_loop; -  continue; -  } -  } -  } -  prev_pos[exact_pos] = sizeof (frames); +        pos=trim_file_name(tmp[0])+":"+tmp[1];    } else {    pos = sprintf("%s:Bad line %t", trim_file_name(tmp[0]), tmp[1]);    }    }else{    mixed desc="Unknown program";    if(sizeof(tmp)>=3 && functionp(tmp[2]))    {    catch    {    if(mixed tmp=function_object(tmp[2]))    if(tmp=object_program(tmp))    if(tmp=describe_program(tmp))    desc=tmp;    };    }    pos=desc;    }    -  if (loop_start) { -  array(string) tail; -  if (!loop_next) tail = ({}), loops++; -  else tail = frames[loop_start + sizeof (frames) .. -  loop_next - 1 + sizeof (frames)]; -  if (loops) -  frames += ({sprintf ("... last %d frames above repeated %d times ...\n", -  -loop_start, loops)}); -  frames += tail; -  prev_pos = ([]); -  loop_start = 0; -  } -  +     string data;       if(sizeof(tmp)>=3)    {    if(functionp(tmp[2])) {    data = describe_function (tmp[2]);    }    else if (stringp(tmp[2])) {    data= tmp[2];    } else
pike.git/lib/master.pike.in:2413:    if (tmp) {    if (catch (row = sprintf("%O", tmp)))    row = describe_program(object_program(tmp)) + " with broken _sprintf()";    } else {    row = "Destructed object";    }    }    }) {    row = sprintf("Error indexing backtrace line %d: %s (%O)!", e, err[0], err[1]);    } -  frames += ({row + "\n"}); +  +  int dup_frame; +  if (!zero_type(dup_frame = prev_pos[row])) { +  dup_frame -= sizeof(frames); +  if (!loop_start) { +  loop_start = dup_frame; +  loop_next = dup_frame + 1; +  loops = 0; +  continue; +  } else { +  int new_loop = 0; +  if (!loop_next) loop_next = loop_start, new_loop = 1; +  if (dup_frame == loop_next++) { +  loops += new_loop; +  continue;    } -  +  } +  } +  prev_pos[row] = sizeof(frames);       if (loop_start) { -  // Want tail to contain a full loop rather than being empty; it -  // looks odd when the repeat message ends the backtrace. -  array(string) tail = frames[loop_start + sizeof (frames) .. -  loop_next - 1 + sizeof (frames)]; +  array(string) tail; +  if (!loop_next) tail = ({}), loops++; +  else tail = frames[loop_start + sizeof(frames) .. +  loop_next - 1 + sizeof(frames)];    if (loops)    frames += ({sprintf ("... last %d frames above repeated %d times ...\n",    -loop_start, loops)});    frames += tail; -  +  prev_pos = ([]); +  loop_start = 0;    }    -  +  frames += ({row + "\n"}); +  } +  +  if (loop_start) { +  // Want tail to contain a full loop rather than being empty; it +  // looks odd when the repeat message ends the backtrace. +  array(string) tail = frames[loop_start + sizeof(frames) .. +  loop_next - 1 + sizeof(frames)]; +  if (loops) { +  frames += ({ +  sprintf("... last %d frames above repeated %d times ...\n", +  -loop_start, loops) +  }); +  } +  frames += tail; +  } +     ret += frames * "";    }       return ret || "No backtrace!\n";;   }      //! @appears describe_error   //! Returns only the error message from a backtrace.   //!   //! If there is no error message in the backtrace, a fallback message
pike.git/lib/master.pike.in:2468:   {    string fname;    int mkobj;    program prog_to_mkobj;    void create(void|string f,void|int m)    {    fname=f;    mkobj=m;    }    -  void __register_new_program(program p) +  object __register_new_program(program p)    {    if(fname)    {    programs[fname]=prog_to_mkobj=p;    fname=0; -  +  if (mkobj) +  return objects[p] || (objects[p]=__null_program());    } -  +  return 0;    }    -  -  void __register_new_object(program p) -  { -  if(prog_to_mkobj == p) -  { -  objects[p]=p(); -  prog_to_mkobj=0; -  } -  } -  +     mapping f=all_constants();       string nameof(mixed x)    {    if(mixed tmp=search(f,x))    return "efun:"+tmp;       if (programp(x)) {    if(mixed tmp=search(programs,x))    return tmp;
pike.git/lib/master.pike.in:2551:    error("Cannot encode objects yet.\n");    }          void decode_object(object o, mixed data)    {    o->_decode(data);    }   }    +    //! Contains version information about a Pike version.   class Version   {       //! The major and minor parts of the version.    int major;    int minor;       //! @decl void create(int major, int minor)    //! Set the version in the object.