From ee2ac58e4de6a63cc83bbef13b6a25718f5b8f0f Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 3 Oct 2007 01:06:57 +0000 Subject: * ruby.c (ruby_process_options): push frame with program name. [ruby-core:12351] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ eval_error.ci | 9 +++++---- ruby.c | 30 ++++++++++++++++++++---------- version.h | 6 +++--- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b5e0a1e8d..0160994ac2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 3 10:06:53 2007 Nobuyoshi Nakada + + * ruby.c (ruby_process_options): push frame with program name. + [ruby-core:12351] + Tue Oct 2 20:16:55 2007 NAKAMURA Usaku * win32/win32.c (init_env): refactoring. remove unused code. diff --git a/eval_error.ci b/eval_error.ci index 9760bd6022..210dce073d 100644 --- a/eval_error.ci +++ b/eval_error.ci @@ -89,16 +89,17 @@ static void error_print(void) { VALUE errat = Qnil; /* OK */ + VALUE errinfo = GET_THREAD()->errinfo; volatile VALUE eclass, e; char *einfo; long elen; - if (NIL_P(GET_THREAD()->errinfo)) + if (NIL_P(errinfo)) return; PUSH_TAG(); if (EXEC_TAG() == 0) { - errat = get_backtrace(GET_THREAD()->errinfo); + errat = get_backtrace(errinfo); } else { errat = Qnil; @@ -126,9 +127,9 @@ error_print(void) } } - eclass = CLASS_OF(GET_THREAD()->errinfo); + eclass = CLASS_OF(errinfo); if (EXEC_TAG() == 0) { - e = rb_funcall(GET_THREAD()->errinfo, rb_intern("message"), 0, 0); + e = rb_funcall(errinfo, rb_intern("message"), 0, 0); StringValue(e); einfo = RSTRING_PTR(e); elen = RSTRING_LEN(e); diff --git a/ruby.c b/ruby.c index 0d94e6055c..b34bf7b58c 100644 --- a/ruby.c +++ b/ruby.c @@ -23,6 +23,7 @@ #include "ruby/ruby.h" #include "ruby/node.h" #include "ruby/encoding.h" +#include "eval_intern.h" #include "dln.h" #include #include @@ -74,6 +75,8 @@ extern int ruby_yydebug; char *ruby_inplace_mode = 0; struct cmdline_options { + int argc; + char **argv; int sflag, xflag; int do_loop, do_print; int do_check, do_line; @@ -823,9 +826,12 @@ proc_options(int argc, char **argv, struct cmdline_options *opt) return argc0 - argc; } -static NODE * -process_options(int argc, char **argv, struct cmdline_options *opt) +static VALUE +process_options(VALUE arg) { + struct cmdline_options *opt = (struct cmdline_options *)arg; + int argc = opt->argc; + char **argv = opt->argv; NODE *tree = 0; VALUE parser; const char *s; @@ -873,7 +879,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt) if (opt->version) { ruby_show_version(); - return (NODE *)Qtrue; + return Qtrue; } if (opt->copyright) { ruby_show_copyright(); @@ -887,7 +893,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt) if (!opt->e_script) { if (argc == 0) { /* no more args */ if (opt->verbose) - return (NODE *)Qtrue; + return Qtrue; opt->script = "-"; } else { @@ -935,7 +941,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt) tree = load_file(parser, opt->script, 1, opt); } - if (!tree) return 0; + if (!tree) return Qfalse; process_sflag(opt); opt->xflag = 0; @@ -954,7 +960,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt) } } - return tree; + return (VALUE)tree; } static NODE * @@ -1314,10 +1320,11 @@ ruby_process_options(int argc, char **argv) MEMZERO(&opt, opt, 1); ruby_script(argv[0]); /* for the time being */ rb_argv0 = rb_progname; -#if defined(USE_DLN_A_OUT) - dln_argv0 = argv[0]; -#endif - tree = process_options(argc, argv, &opt); + opt.argc = argc; + opt.argv = argv; + tree = (NODE *)rb_vm_call_cfunc(rb_vm_top_self(), + process_options, (VALUE)&opt, + 0, rb_progname); rb_define_readonly_boolean("$-p", opt.do_print); rb_define_readonly_boolean("$-l", opt.do_line); @@ -1357,4 +1364,7 @@ ruby_sysinit(int *argc, char ***argv) #if !defined(PSTAT_SETCMD) && !defined(HAVE_SETPROCTITLE) origarg.len = get_arglen(origarg.argc, origarg.argv); #endif +#if defined(USE_DLN_A_OUT) + dln_argv0 = origarg.argv[0]; +#endif } diff --git a/version.h b/version.h index 59bcac19b9..ea5e828268 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-10-02" +#define RUBY_RELEASE_DATE "2007-10-03" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20071002 +#define RUBY_RELEASE_CODE 20071003 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 2 +#define RUBY_RELEASE_DAY 3 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; -- cgit v1.2.3