ruby-changes:39781
From: nobu <ko1@a...>
Date: Tue, 15 Sep 2015 14:50:01 +0900 (JST)
Subject: [ruby-changes:39781] nobu:r51862 (trunk): enc: fundamental encindex
nobu 2015-09-15 14:49:52 +0900 (Tue, 15 Sep 2015) New Revision: 51862 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51862 Log: enc: fundamental encindex * enc/{ascii,us_ascii,utf_8}.c: set encoding indexes of fundamental built-in encodings so that usable as well as allocated rb_encoding before rb_enc_init(). Modified files: trunk/ChangeLog trunk/common.mk trunk/enc/ascii.c trunk/enc/us_ascii.c trunk/enc/utf_8.c Index: ChangeLog =================================================================== --- ChangeLog (revision 51861) +++ ChangeLog (revision 51862) @@ -1,4 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Tue Sep 15 14:49:15 2015 Nobuyoshi Nakada <nobu@r...> +Tue Sep 15 14:49:43 2015 Nobuyoshi Nakada <nobu@r...> + + * enc/{ascii,us_ascii,utf_8}.c: set encoding indexes of + fundamental built-in encodings so that usable as well as + allocated rb_encoding before rb_enc_init(). * encindex.h: separate encoding index constants from internal.h. Index: enc/utf_8.c =================================================================== --- enc/utf_8.c (revision 51861) +++ enc/utf_8.c (revision 51862) @@ -28,6 +28,10 @@ https://github.com/ruby/ruby/blob/trunk/enc/utf_8.c#L28 */ #include "regenc.h" +#include "encindex.h" +#ifndef ENCINDEX_UTF_8 +#define ENCINDEX_UTF_8 0 +#endif #define USE_INVALID_CODE_SCHEME @@ -424,7 +428,7 @@ OnigEncodingDefine(utf_8, UTF_8) = { https://github.com/ruby/ruby/blob/trunk/enc/utf_8.c#L428 get_ctype_code_range, left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, - 0, + ENCINDEX_UTF_8, ONIGENC_FLAG_UNICODE, }; ENC_ALIAS("CP65001", "UTF-8") Index: enc/ascii.c =================================================================== --- enc/ascii.c (revision 51861) +++ enc/ascii.c (revision 51862) @@ -29,6 +29,10 @@ https://github.com/ruby/ruby/blob/trunk/enc/ascii.c#L29 */ #include "regenc.h" +#include "encindex.h" +#ifndef ENCINDEX_ASCII +#define ENCINDEX_ASCII 0 +#endif OnigEncodingDefine(ascii, ASCII) = { onigenc_single_byte_mbc_enc_len, @@ -47,7 +51,7 @@ OnigEncodingDefine(ascii, ASCII) = { https://github.com/ruby/ruby/blob/trunk/enc/ascii.c#L51 onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, - 0, + ENCINDEX_ASCII, ONIGENC_FLAG_NONE, }; ENC_ALIAS("BINARY", "ASCII-8BIT") Index: enc/us_ascii.c =================================================================== --- enc/us_ascii.c (revision 51861) +++ enc/us_ascii.c (revision 51862) @@ -1,4 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/enc/us_ascii.c#L1 #include "regenc.h" +#include "encindex.h" +#ifndef ENCINDEX_US_ASCII +#define ENCINDEX_US_ASCII 0 +#endif static int us_ascii_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc) @@ -25,7 +29,7 @@ OnigEncodingDefine(us_ascii, US_ASCII) = https://github.com/ruby/ruby/blob/trunk/enc/us_ascii.c#L29 onigenc_not_support_get_ctype_code_range, onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, - 0, + ENCINDEX_US_ASCII, ONIGENC_FLAG_NONE, }; ENC_ALIAS("ASCII", "US-ASCII") Index: common.mk =================================================================== --- common.mk (revision 51861) +++ common.mk (revision 51862) @@ -1286,6 +1286,7 @@ dmyext.$(OBJEXT): {$(VPATH)}dmyext.c https://github.com/ruby/ruby/blob/trunk/common.mk#L1286 enc/ascii.$(OBJEXT): {$(VPATH)}config.h enc/ascii.$(OBJEXT): {$(VPATH)}defines.h enc/ascii.$(OBJEXT): {$(VPATH)}enc/ascii.c +enc/ascii.$(OBJEXT): {$(VPATH)}encindex.h enc/ascii.$(OBJEXT): {$(VPATH)}missing.h enc/ascii.$(OBJEXT): {$(VPATH)}oniguruma.h enc/ascii.$(OBJEXT): {$(VPATH)}regenc.h @@ -1314,12 +1315,14 @@ enc/unicode.$(OBJEXT): {$(VPATH)}subst.h https://github.com/ruby/ruby/blob/trunk/common.mk#L1315 enc/us_ascii.$(OBJEXT): {$(VPATH)}config.h enc/us_ascii.$(OBJEXT): {$(VPATH)}defines.h enc/us_ascii.$(OBJEXT): {$(VPATH)}enc/us_ascii.c +enc/us_ascii.$(OBJEXT): {$(VPATH)}encindex.h enc/us_ascii.$(OBJEXT): {$(VPATH)}missing.h enc/us_ascii.$(OBJEXT): {$(VPATH)}oniguruma.h enc/us_ascii.$(OBJEXT): {$(VPATH)}regenc.h enc/utf_8.$(OBJEXT): {$(VPATH)}config.h enc/utf_8.$(OBJEXT): {$(VPATH)}defines.h enc/utf_8.$(OBJEXT): {$(VPATH)}enc/utf_8.c +enc/utf_8.$(OBJEXT): {$(VPATH)}encindex.h enc/utf_8.$(OBJEXT): {$(VPATH)}missing.h enc/utf_8.$(OBJEXT): {$(VPATH)}oniguruma.h enc/utf_8.$(OBJEXT): {$(VPATH)}regenc.h -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/