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.216 2002/08/15 15:51:45 per Exp $ + // $Id: master.pike.in,v 1.217 2002/09/05 15:26:15 marcus 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:1569:   //! _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;    object tmp;    string a,b;    array q; -  string postparseaction=0; +  string postparseaction=0, run_tool=0;    mixed v;       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,a)    {
pike.git/lib/master.pike.in:1654:    ({"autoreload",tmp->NO_ARG,({"--autoreload"})}),   #endif    ({"master",tmp->HAS_ARG,"-m"}),    ({"compiler_trace",tmp->NO_ARG,"--compiler-trace"}),    ({"assembler_debug",tmp->MAY_HAVE_ARG,"--assembler-debug"}),    ({"optimizer_debug",tmp->MAY_HAVE_ARG,"--optimizer-debug"}),    ({"debug",tmp->MAY_HAVE_ARG,"--debug",0,1}),    ({"trace",tmp->MAY_HAVE_ARG,"--trace",0,1}),    ({"ignore",tmp->MAY_HAVE_ARG,"-Dqdatplr",0,1}),    ({"ignore",tmp->HAS_ARG,"-s"}), +  ({"run_tool",tmp->HAS_ARG,"-x"}),    }), 1);       /* Parse -M and -I backwards */    for(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;
pike.git/lib/master.pike.in:1743:    want_warnings++;    break;       case "no-warnings":    want_warnings--;    break;       case "master":    _master_file_name = q[i][1];    break; +  +  case "run_tool": +  run_tool = q[i][1]; +  break;    }    }       foreach(q, array opts)    {    switch(opts[0])    {    case "version":    werror(version() + " Copyright © 1994-2002 Linköping University\n"    "Pike comes with ABSOLUTELY NO WARRANTY; This is free software and you are\n"
pike.git/lib/master.pike.in:1840:    w( format_paths() + "\n");       w("Features......"+    main_resolv( "Tools.Install.features"/"." )()*"\n "+    "\n");    exit(0);    }       random_seed(time() ^ (getpid()<<8));    -  if(sizeof(argv)==1) +  if(run_tool) +  ; +  else if(sizeof(argv)==1)    {    main_resolv( ({ "Tools", "Hilfe" }) )->StdinHilfe();    exit(0);    }    else    argv=argv[1..];    -  +  program prog; +  +  if(run_tool) { +  mixed err = catch { +  prog=main_resolv( ({ "Tools", "Standalone", run_tool }) ); +  }; +  +  if (err) +  _error( "Pike: Failed to load tool %s:\n" +  "%s\n", run_tool, +  stringp(err[0])?err[0]:describe_backtrace(err) ); +  +  argv[0] = search(master()->programs, prog) || run_tool; +  } else {    argv[0]=combine_path_with_cwd(argv[0]);    -  program prog; +     mixed err = catch {    prog=(program)argv[0];    };       if (err)    _error( "Pike: Failed to compile script:\n"    "%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]);       object script=prog();      #if constant(_debug)    if(debug) _debug(debug);   #endif