ruby-changes:3740
From: ko1@a...
Date: Fri, 25 Jan 2008 15:41:41 +0900 (JST)
Subject: [ruby-changes:3740] nobu - Ruby:r15229 (trunk): * ruby.c (cmdline_arguments): split argc and argv from cmdline_options.
nobu 2008-01-25 15:41:22 +0900 (Fri, 25 Jan 2008)
New Revision: 15229
Modified files:
trunk/ChangeLog
trunk/ruby.c
Log:
* ruby.c (cmdline_arguments): split argc and argv from cmdline_options.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ruby.c?r1=15229&r2=15228&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15229&r2=15228&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15228)
+++ ChangeLog (revision 15229)
@@ -1,5 +1,7 @@
-Fri Jan 25 15:12:42 2008 Nobuyoshi Nakada <nobu@r...>
+Fri Jan 25 15:41:20 2008 Nobuyoshi Nakada <nobu@r...>
+ * ruby.c (cmdline_arguments): split argc and argv from cmdline_options.
+
* ruby.c (process_options): not set encoding of -e option from -E
option if they are not compatible.
Index: ruby.c
===================================================================
--- ruby.c (revision 15228)
+++ ruby.c (revision 15229)
@@ -66,8 +66,6 @@
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;
@@ -88,6 +86,12 @@
} src, ext;
};
+struct cmdline_arguments {
+ int argc;
+ char **argv;
+ struct cmdline_options *opt;
+};
+
static NODE *load_file(VALUE, const char *, int, struct cmdline_options *);
static void forbid_setid(const char *);
@@ -880,9 +884,10 @@
static VALUE
process_options(VALUE arg)
{
- struct cmdline_options *opt = (struct cmdline_options *)arg;
- int argc = opt->argc;
- char **argv = opt->argv;
+ struct cmdline_arguments *argp = (struct cmdline_arguments *)arg;
+ struct cmdline_options *opt = argp->opt;
+ int argc = argp->argc;
+ char **argv = argp->argv;
NODE *tree = 0;
VALUE parser;
rb_encoding *enc;
@@ -1437,18 +1442,20 @@
void *
ruby_process_options(int argc, char **argv)
{
+ struct cmdline_arguments args;
struct cmdline_options opt;
NODE *tree;
MEMZERO(&opt, opt, 1);
ruby_script(argv[0]); /* for the time being */
rb_argv0 = rb_progname;
- opt.argc = argc;
- opt.argv = argv;
+ args.argc = argc;
+ args.argv = argv;
+ args.opt = &opt;
opt.src.enc.index = -1;
opt.ext.enc.index = -1;
tree = (NODE *)rb_vm_call_cfunc(rb_vm_top_self(),
- process_options, (VALUE)&opt,
+ process_options, (VALUE)&args,
0, rb_progname);
rb_define_readonly_boolean("$-p", opt.do_print);
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/