From b1a3ae2497f1ec814c9eaac2778b73e664141849 Mon Sep 17 00:00:00 2001 From: Peter Lobsinger Date: Mon, 29 Aug 2011 15:50:02 -0400 Subject: [PATCH] Revert "Set the executable name from prt0, to avoid an API call. Show usage messages from prt0 if necessary, fix handling of -h and -V. a few other related cleanups" This reverts commit 3631eece3b1ac11c034dfdf70a0de886fe171d59. The profiling runcore expects the executable name to be available before entering the runcore (and executing prt0). Conflicts: frontend/parrot2/prt0.pir --- frontend/parrot2/main.c | 10 +++++++++- src/pmc/parrotinterpreter.pmc | 11 ----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/frontend/parrot2/main.c b/frontend/parrot2/main.c index 0bf45a43a0..0865a5a84b 100644 --- a/frontend/parrot2/main.c +++ b/frontend/parrot2/main.c @@ -148,7 +148,8 @@ main(int argc, const char *argv[]) fprintf(stderr, "PARROT VM: No interpreter. Cannot get error details\n"); exit(EXIT_FAILURE); } - if (!Parrot_set_config_hash(interp)) { + if (!(Parrot_set_config_hash(interp) && + Parrot_api_set_executable_name(interp, argv[0]))) { fprintf(stderr, "PARROT VM: Could not initialize new interpreter\n"); show_last_error_and_exit(interp); } @@ -681,6 +682,13 @@ parseflags(Parrot_PMC interp, int argc, ARGIN(const char *argv[]), exit(EXIT_FAILURE); } + /* reached the end of the option list and consumed all of argv */ + if (argc == opt.opt_index) { + fprintf(stderr, "Missing program name\n"); + usage(stderr); + exit(EXIT_FAILURE); + } + args->progargv = argv + opt.opt_index; args->progargc = argc - opt.opt_index; args->sysargv = sysargs; diff --git a/src/pmc/parrotinterpreter.pmc b/src/pmc/parrotinterpreter.pmc index a84636daa6..58afe53a8a 100644 --- a/src/pmc/parrotinterpreter.pmc +++ b/src/pmc/parrotinterpreter.pmc @@ -435,17 +435,6 @@ Returns the PMC global value for C. return PMCNULL; } - VTABLE void set_pmc_keyed_int(INTVAL key, PMC * value) { - Interp * const new_interp = PMC_interp(SELF); - if (key >= 0 && key < IGLOBALS_SIZE) { - VTABLE_set_pmc_keyed_int(new_interp, new_interp->iglobals, key, - value); - return; - } - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_OUT_OF_BOUNDS, - "Cannot set interp global %d (max: %d)", key, IGLOBALS_SIZE); - } - /* =item C