Branch: Tag:

2004-02-27

2004-02-27 13:08:23 by Martin Nilsson <mani@lysator.liu.se>

Cleaned up _error and main_resolv

Rev: lib/master.pike.in:1.334

6:   // Pike is distributed under GPL, LGPL and MPL. See the file COPYING   // for more information.   // - // $Id: master.pike.in,v 1.333 2004/02/08 16:03:13 grubba Exp $ + // $Id: master.pike.in,v 1.334 2004/02/27 13:08:23 nilsson Exp $      #pike __REAL_VERSION__   
2205:    else    werror("Broken environment var %s\n",a);    -  void _error(string a, mixed ... b) { -  werror(a, @b); -  exit(1); -  }; -  -  +    #ifndef NOT_INSTALLED    {    array parts = (getenv("PIKE_INCLUDE_PATH")||"")/PATH_SEPARATOR-({""});
2238:    " " + "\n");    };    -  mixed main_resolv(string ... syms) { -  mixed v = resolv(syms[0]); -  foreach(syms[1..], string sym) -  if(v) v = v[sym]; +  mixed main_resolv(string sym) { +  mixed v = resolv(sym);    if(!v) -  _error("Could not resolv %s. (Perhaps the installed pike tree has been moved.)\n", -  syms*"."); +  error("Could not resolv %s. " +  "(Perhaps the installed pike tree has been moved.)\n", sym);    return v;    };   
2400:    exit(0);       case "help": -  werror( main_resolv("Tools","MasterHelp")->do_help(opts[1]) ); +  werror( main_resolv("Tools.MasterHelp")->do_help(opts[1]) );    exit(0);       case "features":
2417:       case "execute":   #ifdef __AUTO_BIGNUM__ -  main_resolv( "Gmp", "bignum" ); +  main_resolv( "Gmp.bignum" );   #endif /* __AUTO_BIGNUM__ */       random_seed((time() ^ (getpid()<<8)));
2465:       case "preprocess":   #ifdef __AUTO_BIGNUM__ -  main_resolv( "Gmp", "bignum" ); +  main_resolv( "Gmp.bignum" );   #endif /* __AUTO_BIGNUM__ */    write(cpp(master_read_file(opts[1]),opts[1]));    exit(0);
2478:    switch (postparseaction)    {    case "features": -  write( main_resolv( "Tools", "Install", "features" )()*"\n"+"\n" ); +  write( main_resolv( "Tools.Install.features" )()*"\n"+"\n" );    exit(0);       case "info":
2489:    "pike binary..."+_pike_file_name+"\n"+    format_paths() + "\n"    "Features......"+ -  main_resolv( "Tools","Install","features" )()*"\n "+ +  main_resolv( "Tools.Install.features" )()*"\n "+    "\n");    exit(0);    }      #ifdef __AUTO_BIGNUM__ -  main_resolv( "Gmp", "bignum" ); +  main_resolv( "Gmp.bignum" );   #endif /* __AUTO_BIGNUM__ */       random_seed(time() ^ (getpid()<<8));
2507:    "Available tools:\n");    mapping t = ([]);    int i; -  object ts = main_resolv( "Tools", "Standalone" ); +  object ts = main_resolv( "Tools.Standalone" );    foreach (indices(ts), string s) {    mixed val = ts[s];    if (programp (val)) {
2521:    werror(" %-"+i+"s %s\n", s, t[s]);    exit(1);    } -  main_resolv( "Tools", "Hilfe" )->StdinHilfe(); +  main_resolv( "Tools.Hilfe" )->StdinHilfe();    exit(0);    }    else
2531:       if(run_tool) {    mixed err = catch { -  prog=main_resolv( "Tools", "Standalone", argv[0] ); +  prog=main_resolv( "Tools.Standalone." + argv[0] );    };       if (err) -  _error( "Pike: Failed to load tool %s:\n" +  error( "Pike: Failed to load tool %s:\n"    "%s\n", argv[0],    stringp(err[0])?err[0]:describe_backtrace(err) );   
2548:    };       if (err) -  _error( "Pike: Failed to compile script:\n" +  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]); +  error("Pike: Couldn't find script to execute\n(%O)\n", argv[0]);      #if constant(_debug)    if(debug) _debug(debug);
2572:    script=prog(argv);    }    if(!script->main) -  _error("Error: %s has no main().\n", argv[0]); +  error("Error: %s has no main().\n", argv[0]);    ret=script->main(sizeof(argv),argv,env);    };    // Disable traceing.