1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2007-10-03 01:06:57 +00:00
parent 50c7751b60
commit ee2ac58e4d
4 changed files with 33 additions and 17 deletions

View file

@ -1,3 +1,8 @@
Wed Oct 3 10:06:53 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (ruby_process_options): push frame with program name.
[ruby-core:12351]
Tue Oct 2 20:16:55 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (init_env): refactoring. remove unused code.

View file

@ -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);

30
ruby.c
View file

@ -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 @@ 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
}

View file

@ -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[];