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.427 2008/05/29 18:12:12 grubba Exp $ + // $Id: master.pike.in,v 1.428 2008/05/30 17:01:48 mast Exp $      #pike __REAL_VERSION__   //#pragma strict_types      // Some programs destroys character pairs beginning with the currency   // symbol when running in chinese locale.   #if "ยค/" != "\244/"   #error "master.pike.in is corrupted."   #endif   
pike.git/lib/master.pike.in:1101:    fname = fakeroot (fname);    // FIXME: Not sure if this works correctly with the fakeroot and    // module relocation stuff.    foreach (pike_module_path, string path)    if (has_prefix (fname, path))    return map (pike_module_path, `+, "/", fname[sizeof (path)..], ".o");   #endif    return ({ fname + ".o" });   }    - static class CompileCallbackError (string error_message, array error_backtrace) + static class CompileCallbackError   { -  +  inherit _static_modules.Builtin.GenericError;    constant is_generic_error = 1;    constant is_compile_callback_error = 1; -  +  constant is_cpp_or_compilation_error = 1;   }      static void compile_cb_error (string msg, mixed ... args)   // Use this to throw errors that should be converted to plain compile   // error messages, without backtraces being reported by   // compile_exception.   {    if (sizeof (args)) msg = sprintf (msg, @args);    throw (CompileCallbackError (msg, backtrace()[..<1]));   }
pike.git/lib/master.pike.in:3224:       case "execute":   #ifdef __AUTO_BIGNUM__    main_resolv( "Gmp.bignum" );   #endif /* __AUTO_BIGNUM__ */       random_seed((time() ^ (getpid()<<8)));    argv = tmp->get_args(argv,1);       program prog; +  mixed compile_err = catch {;    if(Version(compat_major,compat_minor) <= Version(7,4))    prog = compile_string(    "mixed create(int argc, array(string) argv,array(string) env){"+    opts[1]+";}");    else if (intp (opts[1]))    prog = compile_string ("mixed run() {}");    else {    string code = opts[1];    while(sscanf(code, "%sCHAR(%1s)%s", code, string c, string rest)==3)    code += c[0] + rest;    prog = compile_string(    "#define NOT(X) !(X)\n"    "mixed run(int argc, array(string) argv,"    "mapping(string:string) env){"+    code+";}");    } -  +  };    -  +  if (compile_err && compile_err->is_cpp_or_compilation_error) { +  // Don't clutter the output with the backtrace for +  // compilation errors. +  werror (describe_error (compile_err)); +  exit (20); +  } +  else throw (compile_err); +    #if constant(_debug)    if(debug) _debug(debug);   #endif    if(trace) trace = predef::trace(trace);    mixed ret;    mixed err = catch {    // One reason for this catch is to get a new call to    // eval_instruction in interpret.c so that the debug and    // trace levels set above take effect in the bytecode    // evaluator.
pike.git/lib/master.pike.in:3371:    if( file_stat(fn+".pike") )    fn += ".pike";    else    exit(1, "Could not find file %O.\n", fn);    }    if( !file_stat(fn)->isreg )    exit(1, "File %O is not a regular file.\n", fn);    if( !master_read_file(fn) )    exit(1, "File %O is not readable. %s.\n",    fn, strerror(errno())); +  if (objectp (err) && err->is_cpp_or_compilation_error) +  exit(1, "Pike: Failed to compile script.\n"); +  else    exit(1, "Pike: Failed to compile script:\n" -  "%s\n", stringp(err[0])?err[0]:describe_backtrace(err)); +  "%s", describe_backtrace(err));    }       // Don't list the program with its real path in the programs    // mapping, so that reverse lookups (typically by the codec)    // always find the canonical "/main" instead.    programs[argv[0]] = no_value;    }       programs["/main"] = prog;   
pike.git/lib/master.pike.in:3540:    ->compile_warning)(file, line, err);    }   }         //! This function is called when an exception is catched during   //! compilation. Its message is also reported to @[compile_error] if   //! this function returns zero.   int compile_exception (array|object trace)   { -  if (objectp (trace) && -  ( ([object]trace)->is_cpp_error || -  ([object]trace)->is_compilation_error)) -  // Errors thrown directly by cpp() and compile() are normally not -  // interesting; they've already been reported to compile_error. -  return 1; -  if (objectp (trace) && ([object] trace)->is_compile_callback_error) -  // Errors thrown by a compile callback that we should report as a -  // normal compile error, so let the caller do just that. +  if (objectp (trace) && ([object]trace)->is_cpp_or_compilation_error) +  // Errors thrown by cpp(), compile() or a compile callback should +  // be reported as a normal compile error, so let the caller do +  // just that.    return 0;    if (mixed val = get_inhibit_compile_errors()) {    if (objectp(val) && ([object]val)->compile_exception)    return ([function(object:int)]([object]val)    ->compile_exception)([object]trace);    }    else {    handle_error (trace);    return 1;    }