ruby-changes:2112
From: ko1@a...
Date: 3 Oct 2007 10:07:30 +0900
Subject: [ruby-changes:2112] nobu - Ruby:r13603 (trunk): * ruby.c (ruby_process_options): push frame with program name.
nobu 2007-10-03 10:06:57 +0900 (Wed, 03 Oct 2007) New Revision: 13603 Modified files: trunk/ChangeLog trunk/eval_error.ci trunk/ruby.c trunk/version.h Log: * ruby.c (ruby_process_options): push frame with program name. [ruby-core:12351] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=13603&r2=13602 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/eval_error.ci?r1=13603&r2=13602 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ruby.c?r1=13603&r2=13602 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13603&r2=13602 Index: ChangeLog =================================================================== --- ChangeLog (revision 13602) +++ ChangeLog (revision 13603) @@ -1,3 +1,8 @@ +Wed Oct 3 10:06:53 2007 Nobuyoshi Nakada <nobu@r...> + + * ruby.c (ruby_process_options): push frame with program name. + [ruby-core:12351] + Tue Oct 2 20:16:55 2007 NAKAMURA Usaku <usa@r...> * win32/win32.c (init_env): refactoring. remove unused code. Index: version.h =================================================================== --- version.h (revision 13602) +++ version.h (revision 13603) @@ -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[]; Index: ruby.c =================================================================== --- ruby.c (revision 13602) +++ ruby.c (revision 13603) @@ -23,6 +23,7 @@ #include "ruby/ruby.h" #include "ruby/node.h" #include "ruby/encoding.h" +#include "eval_intern.h" #include "dln.h" #include <stdio.h> #include <sys/types.h> @@ -74,6 +75,8 @@ 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 @@ 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 @@ if (opt->version) { ruby_show_version(); - return (NODE *)Qtrue; + return Qtrue; } if (opt->copyright) { ruby_show_copyright(); @@ -887,7 +893,7 @@ 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 @@ 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 @@ } } - return tree; + return (VALUE)tree; } static NODE * @@ -1314,10 +1320,11 @@ 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 @@ #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 } Index: eval_error.ci =================================================================== --- eval_error.ci (revision 13602) +++ eval_error.ci (revision 13603) @@ -89,16 +89,17 @@ 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 @@ } } - 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml