* ruby.c (process_options, load_file, rb_load_file): propagates script
encoding by -K to libraries. [ruby-dev:33156] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5776f23d69
commit
8020c2e676
@ -1,3 +1,8 @@
|
|||||||
|
Fri Jan 25 16:11:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ruby.c (process_options, load_file, rb_load_file): propagates script
|
||||||
|
encoding by -K to libraries. [ruby-dev:33156]
|
||||||
|
|
||||||
Fri Jan 25 15:56:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Jan 25 15:56:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ruby.c (cmdline_arguments): split argc and argv from cmdline_options.
|
* ruby.c (cmdline_arguments): split argc and argv from cmdline_options.
|
||||||
|
7
ruby.c
7
ruby.c
@ -881,6 +881,8 @@ opt_enc_index(VALUE enc_name)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int src_encoding_index = -1; /* TODO: VM private */
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
process_options(VALUE arg)
|
process_options(VALUE arg)
|
||||||
{
|
{
|
||||||
@ -1000,6 +1002,7 @@ process_options(VALUE arg)
|
|||||||
}
|
}
|
||||||
if (opt->src.enc.name != 0) {
|
if (opt->src.enc.name != 0) {
|
||||||
opt->src.enc.index = opt_enc_index(opt->src.enc.name);
|
opt->src.enc.index = opt_enc_index(opt->src.enc.name);
|
||||||
|
src_encoding_index = opt->src.enc.index;
|
||||||
}
|
}
|
||||||
if (opt->ext.enc.index >= 0) {
|
if (opt->ext.enc.index >= 0) {
|
||||||
enc = rb_enc_from_index(opt->ext.enc.index);
|
enc = rb_enc_from_index(opt->ext.enc.index);
|
||||||
@ -1181,6 +1184,7 @@ load_file(VALUE parser, const char *fname, int script, struct cmdline_options *o
|
|||||||
rb_io_ungetc(f, INT2FIX('#'));
|
rb_io_ungetc(f, INT2FIX('#'));
|
||||||
if (no_src_enc && opt->src.enc.name) {
|
if (no_src_enc && opt->src.enc.name) {
|
||||||
opt->src.enc.index = opt_enc_index(opt->src.enc.name);
|
opt->src.enc.index = opt_enc_index(opt->src.enc.name);
|
||||||
|
src_encoding_index = opt->src.enc.index;
|
||||||
}
|
}
|
||||||
if (no_ext_enc && opt->ext.enc.name) {
|
if (no_ext_enc && opt->ext.enc.name) {
|
||||||
opt->ext.enc.index = opt_enc_index(opt->ext.enc.name);
|
opt->ext.enc.index = opt_enc_index(opt->ext.enc.name);
|
||||||
@ -1224,6 +1228,7 @@ rb_load_file(const char *fname)
|
|||||||
struct cmdline_options opt;
|
struct cmdline_options opt;
|
||||||
|
|
||||||
MEMZERO(&opt, opt, 1);
|
MEMZERO(&opt, opt, 1);
|
||||||
|
opt.src.enc.index = src_encoding_index;
|
||||||
return load_file(rb_parser_new(), fname, 0, &opt);
|
return load_file(rb_parser_new(), fname, 0, &opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1455,7 +1460,7 @@ ruby_process_options(int argc, char **argv)
|
|||||||
args.argc = argc;
|
args.argc = argc;
|
||||||
args.argv = argv;
|
args.argv = argv;
|
||||||
args.opt = &opt;
|
args.opt = &opt;
|
||||||
opt.src.enc.index = -1;
|
opt.src.enc.index = src_encoding_index;
|
||||||
opt.ext.enc.index = -1;
|
opt.ext.enc.index = -1;
|
||||||
tree = (NODE *)rb_vm_call_cfunc(rb_vm_top_self(),
|
tree = (NODE *)rb_vm_call_cfunc(rb_vm_top_self(),
|
||||||
process_options, (VALUE)&args,
|
process_options, (VALUE)&args,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user