pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1: - /* $Id: master.pike.in,v 1.66 1999/11/04 02:35:31 grubba Exp $ + /* $Id: master.pike.in,v 1.67 1999/11/04 17:00:14 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:96:      mapping(string:int) load_time=([]);   #else      #define AUTORELOAD_CHECK_FILE(X)   #define AUTORELOAD_BEGIN()   #define AUTORELOAD_FINISH(VAR,CACHE,FILE)      #endif    - program compile_string(string data, void|string name) + program compile_string(string data, void|string name, object|void handler)   { -  return compile(cpp(data,name||"-")); +  return compile(cpp(data,name||"-", 0, handler), handler);   }    - program compile_file(string file) + program compile_file(string file, object|void handler)   {    AUTORELOAD_CHECK_FILE(file); -  return compile(cpp(_static_modules.files()->Fd(file,"r")->read(),file, 1)); +  return compile(cpp(_static_modules.files()->Fd(file,"r")->read(), +  file, 1, handler), handler);   }         #ifdef GETCWD_CACHE   string current_path;   int cd(string s)   {    current_path=0;    return predef::cd(s);   }
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) { +     if (handler) { -  handler->compile_warning(fname, 0, +  handler->compile_warning(fname + ".o", 0,    sprintf("Decode failed:\n"    "\t%s", err[0]));    } else { -  compile_warning(fname, 0, +  compile_warning(fname + ".o", 0,    sprintf("Decode failed:\n"    "\t%s", err[0]));    } -  +  } else { +  if (handler) { +  handler->compile_warning(fname + ".o", 0, +  "Compiled file is out of date\n"); +  } else { +  compile_warning(fname + ".o", 0, "Compiled file is out of date\n");    }    }    }          if ( mixed e=catch { ret=compile_file(fname); } )    {    if(arrayp(e) &&    sizeof(e)==2 &&    arrayp(e[1]) &&
pike.git/lib/master.pike.in:995:    {    werror("Error: "+argv[0]+" has no main().\n");    exit(1);    }       if(trace) predef::trace(trace);    i=script->main(sizeof(argv),argv,env);    if(i >=0) exit(i);   }    + #if constant(thread_local) + object inhibit_compile_errors = thread_local(); +  + void set_inhibit_compile_errors(mixed f) + { +  inhibit_compile_errors->set(f); + } + #else /* !constant(thread_local) */   mixed inhibit_compile_errors;      void set_inhibit_compile_errors(mixed f)   {    inhibit_compile_errors=f;   } -  + #endif /* constant(thread_local) */      string trim_file_name(string s)   {    if(getenv("LONG_PIKE_ERRORS")) return s;    if(getenv("SHORT_PIKE_ERRORS")) return BASENAME(s);    string cwd=getcwd();    if(s[..sizeof(cwd)-1]==cwd) return s[sizeof(cwd)..];    return s;   }      /*    * 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_error(string file,int line,string err)   { -  if(!inhibit_compile_errors) +  mixed val; +  if(! (val = inhibit_compile_errors + #if constant(thread_local) +  ->get() + #endif /* constant(thread_local) */ +  ))    {    werror(sprintf("%s:%d:%s\n",trim_file_name(file),line,err));    } -  else if(objectp(inhibit_compile_errors) || -  programp(inhibit_compile_errors) || -  functionp(inhibit_compile_errors)) +  else if(objectp(val) || +  programp(val) || +  functionp(val))    { -  +  if (objectp(val) && val->compile_error) { +  val->compile_error(file, line, err); +  } else {    inhibit_compile_errors(file,line,err);    }    } -  + }      /*    * 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) +  mixed val; +  +  if(!(val = inhibit_compile_errors + #if constant(thread_local) +  ->get() + #endif /* constant(thread_local) */ +  ))    {    if(want_warnings)    werror(sprintf("%s:%d:Warning: %s\n",trim_file_name(file),line,err)); -  +  } else if (objectp(val) && val->compile_warning) { +  val->compile_warning(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)   {