ruby-changes:3757
From: ko1@a...
Date: Sat, 26 Jan 2008 03:49:43 +0900 (JST)
Subject: [ruby-changes:3757] usa - Ruby:r15246 (trunk): * parse.y (parser_initialize): set default script encoding as US-ASCII.
usa 2008-01-26 03:49:28 +0900 (Sat, 26 Jan 2008)
New Revision: 15246
Modified files:
trunk/ChangeLog
trunk/parse.y
trunk/ruby.c
Log:
* parse.y (parser_initialize): set default script encoding as US-ASCII.
* ruby.c (load_file): ditto.
* ruby.c (process_options): set script encoding of -e from locale
except when -K is specified.
* ruby.c (load_file): set script encoding of stdin from locale except
when -K is specified. [ruby-dev:33375]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ruby.c?r1=15246&r2=15245&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=15246&r2=15245&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15246&r2=15245&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15245)
+++ ChangeLog (revision 15246)
@@ -1,3 +1,15 @@
+Sat Jan 26 03:41:53 2008 NAKAMURA Usaku <usa@r...>
+
+ * parse.y (parser_initialize): set default script encoding as US-ASCII.
+
+ * ruby.c (load_file): ditto.
+
+ * ruby.c (process_options): set script encoding of -e from locale
+ except when -K is specified.
+
+ * ruby.c (load_file): set script encoding of stdin from locale except
+ when -K is specified. [ruby-dev:33375]
+
Sat Jan 26 02:51:06 2008 Koichi Sasada <ko1@a...>
* compile.c, compile.h: fix stack pointer issues.
Index: parse.y
===================================================================
--- parse.y (revision 15245)
+++ parse.y (revision 15246)
@@ -9222,7 +9222,7 @@
#ifdef YYMALLOC
parser->heap = NULL;
#endif
- parser->enc = rb_ascii8bit_encoding();
+ parser->enc = rb_usascii_encoding();
}
extern void rb_mark_source_filename(char *);
Index: ruby.c
===================================================================
--- ruby.c (revision 15245)
+++ ruby.c (revision 15246)
@@ -1008,33 +1008,21 @@
enc = rb_enc_from_index(opt->ext.enc.index);
}
else {
- enc = 0;
+ enc = rb_locale_encoding();
}
if (opt->e_script) {
- rb_encoding *eenc = rb_locale_encoding();
- if (!enc) {
- enc = eenc;
+ rb_encoding *eenc;
+ if (opt->src.enc.index >= 0) {
+ eenc = rb_enc_from_index(opt->src.enc.index);
}
- else if (!rb_enc_asciicompat(enc)) {
- rb_warning("%s is not ASCII compatible, ignored for -e",
- rb_enc_name(enc));
- }
- else if (eenc != enc &&
- (rb_enc_str_coderange(opt->e_script) != ENC_CODERANGE_7BIT)) {
- rb_warning("-e conatains non ASCII string, encoding %s is not used",
- rb_enc_name(enc));
- }
else {
- eenc = enc;
+ eenc = rb_locale_encoding();
}
rb_enc_associate(opt->e_script, eenc);
require_libraries();
tree = rb_parser_compile_string(parser, opt->script, opt->e_script, 1);
}
else {
- if (!enc) {
- enc = rb_locale_encoding();
- }
if (opt->script[0] == '-' && !opt->script[1]) {
forbid_setid("program input from stdin");
}
@@ -1199,15 +1187,10 @@
enc = rb_enc_from_index(opt->src.enc.index);
}
else if (f == rb_stdin) {
- if (opt->ext.enc.index >= 0) {
- enc = rb_enc_from_index(opt->ext.enc.index);
- }
- else {
- enc = rb_locale_encoding();
- }
+ enc = rb_locale_encoding();
}
else {
- enc = rb_ascii8bit_encoding();
+ enc = rb_usascii_encoding();
}
rb_funcall(f, rb_intern("set_encoding"), 1, rb_enc_from_encoding(enc));
tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start);
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/