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.268 2003/04/09 23:48:10 nilsson Exp $ + // $Id: master.pike.in,v 1.269 2003/04/10 00:31:07 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:1718:         //! This function is called when all the driver is done with all setup   //! of modules, efuns, tables etc. etc. and is ready to start executing   //! _real_ programs. It receives the arguments not meant for the driver   //! and an array containing the environment variables on the same form as   //! a C program receives them.   void _main(array(string) orig_argv, array(string) env)   {    array(string) argv=copy_value(orig_argv); -  int i,debug,trace,run_tool; +  int debug,trace,run_tool;    object tmp; -  array q; +     string postparseaction=0;       predefines = _static_modules.Builtin()->_take_over_initial_predefines();    _pike_file_name = orig_argv[0];   #if constant(thread_create)    _backend_thread = this_thread();   #endif       foreach(env, string a)    if( sscanf(a, "%s=%s", a, string b)==2 ) {
pike.git/lib/master.pike.in:1748:    }    else    werror("Broken environment var %s\n",a);       void _error(string a, mixed ... b) {    werror(a, @b);    exit(1);    };      #ifndef NOT_INSTALLED -  q=(getenv("PIKE_INCLUDE_PATH")||"")/":"-({""}); -  for(i=sizeof(q)-1;i>=0;i--) add_include_path(q[i]); +  { +  array parts = (getenv("PIKE_INCLUDE_PATH")||"")/":"-({""}); +  int i = sizeof(parts); +  while(i) add_include_path(parts[--i]);    -  q=(getenv("PIKE_PROGRAM_PATH")||"")/":"-({""}); -  for(i=sizeof(q)-1;i>=0;i--) add_program_path(q[i]); +  parts = (getenv("PIKE_PROGRAM_PATH")||"")/":"-({""}); +  i = sizeof(parts); +  while(i) add_program_path(parts[--i]);    -  q=(getenv("PIKE_MODULE_PATH")||"")/":"-({""}); -  for(i=sizeof(q)-1;i>=0;i--) add_module_path(q[i]); +  parts = (getenv("PIKE_MODULE_PATH")||"")/":"-({""}); +  i = sizeof(parts); +  while(i) add_module_path(parts[--i]); +  }   #endif       // Some configure scripts depends on this format.    string format_paths() {    return ("master.pike...: " + (_master_file_name || __FILE__) + "\n"    "Module path...: " + pike_module_path*"\n"    " " + "\n"    "Include path..: " + pike_include_path*"\n"    " " + "\n"    "Program path..: " + pike_program_path*"\n"
pike.git/lib/master.pike.in:1782:    if(v) v = v[sym];    if(!v)    _error("Could not resolv %s\n"    "Is your PIKE_MODULE_PATH environment variable set correctly?\n",    syms*".");    return v;    };       if(sizeof(argv)>1 && sizeof(argv[1]) && argv[1][0]=='-')    { +  array q;    tmp = main_resolv( "Getopt" );       int NO_ARG = tmp->NO_ARG;    int MAY_HAVE_ARG = tmp->MAY_HAVE_ARG;    int HAS_ARG = tmp->HAS_ARG;       q=tmp->find_all_options(argv,({    ({"compat_version", HAS_ARG, ({"-V", "--compat"}), 0, 0}),    ({"version", NO_ARG, ({"-v", "--version"}), 0, 0}),    ({"dumpversion", NO_ARG, ({"--dumpversion"}), 0, 0}),
pike.git/lib/master.pike.in:1817:    ({"assembler_debug",MAY_HAVE_ARG, ({"--assembler-debug"}), 0, 0}),    ({"optimizer_debug",MAY_HAVE_ARG, ({"--optimizer-debug"}), 0, 0}),    ({"debug", MAY_HAVE_ARG, ({"--debug"}), 0, 1}),    ({"trace", MAY_HAVE_ARG, ({"--trace"}), 0, 1}),    ({"ignore", MAY_HAVE_ARG, ({"-Dqdatplr"}), 0, 1}),    ({"ignore", HAS_ARG, ({"-s"}), 0, 0}),    ({"run_tool", NO_ARG, ({"-x"}), 0, 0}),    }), 1);       /* Parse -M and -I backwards */ -  for(i=sizeof(q)-1; i>=0; i--) +  for(int i=sizeof(q)-1; i>=0; i--)    {    switch(q[i][0])    {    case "compat_version":    sscanf(q[i][1],"%d.%d",compat_major,compat_minor);    break;      #ifdef PIKE_AUTORELOAD    case "autoreload":    autoreload_on++;
pike.git/lib/master.pike.in:2099:    "%s\n", stringp(err[0])?err[0]:describe_backtrace(err) );    }       if(!prog)    _error("Pike: Couldn't find script to execute\n(%O)\n", argv[0]);      #if constant(_debug)    if(debug) _debug(debug);   #endif    if(trace) predef::trace(trace); +  mixed ret;    mixed err = catch {    // The main reason for this catch is actually 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.    object script=prog(argv);    if(!script->main)    _error("Error: %s has no main().\n", argv[0]); -  i=script->main(sizeof(argv),argv,env); +  ret=script->main(sizeof(argv),argv,env);    };    if(trace) predef::trace(0);    if (err) {    handle_error (err); -  i = 10; +  ret = 10;    } -  if(i >=0) exit(i); +  if(!intp(ret)) exit(0); +  if(ret >=0) exit([int]ret);    _async=1;       while(1)    {    mixed err=catch    {    while(1)    _static_modules.Builtin.__backend(3600.0);    };    master()->handle_error(err);