pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1: - /* $Id: master.pike.in,v 1.65 1999/11/03 23:52:07 grubba Exp $ + /* $Id: master.pike.in,v 1.66 1999/11/04 02:35:31 grubba Exp $    *    * Master-file for Pike.    *    * Based on master.pike 1.67.    */      // Some configurable parameters useful for debugging      #define PIKE_AUTORELOAD   
pike.git/lib/master.pike.in:227:   {    tmp=combine_path_with_cwd(tmp);    pike_program_path-=({tmp});   }         mapping (string:program) programs=(["/master":object_program(this_object())]);      #define capitalize(X) (upper_case((X)[..0])+(X)[1..])    - static program low_findprog(string pname, string ext) + static program low_findprog(string pname, string ext, object|void handler)   {    program ret;    array s;    string fname=pname+ext;      #ifdef PIKE_AUTORELOAD    if(!autoreload_on || load_time[fname]>=time())   #endif    {    if(ret=programs[fname]) return ret;
pike.git/lib/master.pike.in:255:    case "":    case ".pike":    if(array s2=master_file_stat(fname+".o"))    {    if(s2[1]>=0 && s2[3]>=s[3])    {    mixed err=catch {    AUTORELOAD_CHECK_FILE(fname+".o");    return programs[fname]=decode_value(_static_modules.files()->Fd(fname+".o","r")->read(),Codec());    }; -  if(want_warnings) -  werror("Warning: Failed to decode %s.o:\n" -  " : \t%s\n", -  fname, -  err[0]); +  if(want_warnings) { +  if (handler) { +  handler->compile_warning(fname, 0, +  sprintf("Decode failed:\n" +  "\t%s", err[0])); +  } else { +  compile_warning(fname, 0, +  sprintf("Decode failed:\n" +  "\t%s", err[0]));    }    } -  +  } +  }          if ( mixed e=catch { ret=compile_file(fname); } )    {    if(arrayp(e) &&    sizeof(e)==2 &&    arrayp(e[1]) &&    sizeof(e[1]) == sizeof(backtrace()))    e[1]=({});    throw(e);
pike.git/lib/master.pike.in:292:    }       AUTORELOAD_FINISH(ret,programs,fname);       return programs[fname]=ret;    }else{    return UNDEFINED;    }   }    - static program findprog(string pname, string ext) + static program findprog(string pname, string ext, object|void handler)   {    switch(ext)    {    case ".pike":    case ".so": -  return low_findprog(pname,ext); +  return low_findprog(pname,ext,handler);       default:    pname+=ext;    return -  low_findprog(pname,"") || -  low_findprog(pname,".pike") || -  low_findprog(pname,".so"); +  low_findprog(pname,"", handler) || +  low_findprog(pname,".pike", handler) || +  low_findprog(pname,".so", handler);    }   }      /* This function is called when the driver wants to cast a string    * to a program, this might be because of an explicit cast, an inherit    * or a implict cast. In the future it might receive more arguments,    * to aid the master finding the right program.    */ - program cast_to_program(string pname, string current_file) + program cast_to_program(string pname, string current_file, object|void handler)   {    string ext;    string nname;    array(string) tmp=EXPLODE_PATH(pname);       if(sscanf(reverse(tmp[-1]),"%s.%s",ext, nname))    {    ext="."+reverse(ext);    tmp[-1]=reverse(nname);    pname=tmp*"/";    }else{    ext="";    }    if(IS_ABSOLUTE_PATH(pname))    {    pname=combine_path("/",pname); -  return findprog(pname,ext); +  return findprog(pname,ext,handler);    }else{    string cwd;    if(current_file)    {    cwd=DIRNAME(current_file);    }else{    cwd=getcwd();    }    -  if(program ret=findprog(combine_path(cwd,pname),ext)) +  if(program ret=findprog(combine_path(cwd,pname),ext,handler))    return ret;       foreach(pike_program_path, string path) -  if(program ret=findprog(combine_path(path,pname),ext)) +  if(program ret=findprog(combine_path(path,pname),ext,handler))    return ret;       return 0;    }   }      /* This function is called when an error occurs that is not caught    * with catch(). It's argument consists of:    * ({ error_string, backtrace }) where backtrace is the output from the    * backtrace() efun.
pike.git/lib/master.pike.in:468:   /*    * This function is called whenever a inherit is called for.    * It is supposed to return the program to inherit.    * The first argument is the argument given to inherit, and the second    * is the file name of the program currently compiling. Note that the    * file name can be changed with #line, or set by compile_string, so    * it can not be 100% trusted to be a filename.    * previous_object(), can be virtually anything in this function, as it    * is called from the compiler.    */ - program handle_inherit(string pname, string current_file) + program handle_inherit(string pname, string current_file, object|void handler)   { -  return cast_to_program(pname, current_file); +  return cast_to_program(pname, current_file, handler);   }      mapping (program:object) objects=([object_program(this_object()):this_object()]);      object low_cast_to_object(string oname, string current_file)   {    program p;    object o;       p=cast_to_program(oname, current_file);
pike.git/lib/master.pike.in:698:    return fc[fullname]=o;      #if constant(load_module)    if(master_file_stat(fullname+".so"))    return fc[fullname]=low_cast_to_object(fullname,"/.");   #endif       return fc[fullname]=UNDEFINED;   }    - mixed handle_import(string what, string|void current_file) + mixed handle_import(string what, string|void current_file, object|void handler)   {    string *tmp,path;    if(current_file)    {    tmp=EXPLODE_PATH(current_file);    tmp[-1]=what;    path=combine_path_with_cwd( tmp*"/");    }    return fc[path]=dirnode(path);   }
pike.git/lib/master.pike.in:1036:    * This function is called whenever a compiling error occurs,    * Nothing strange about it.    * Note that previous_object cannot be trusted in ths function, because    * the compiler calls this function.    */   void compile_warning(string file,int line,string err)   {    if(!inhibit_compile_errors)    {    if(want_warnings) -  werror(sprintf("%s:%d:%s\n",trim_file_name(file),line,err)); +  werror(sprintf("%s:%d:Warning: %s\n",trim_file_name(file),line,err));    }   }         static mixed _charset_mod;   /* This function is called by cpp() when it wants to do    * character code conversion.    */   string decode_charset(string data, string charset)   {