提交 75a1d33b 编写于 作者: N nobu

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().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
上级 078b6c98
Tue Sep 15 14:49:15 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
Tue Sep 15 14:49:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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.
......
......@@ -1286,6 +1286,7 @@ dmyext.$(OBJEXT): {$(VPATH)}dmyext.c
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
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
......
......@@ -29,6 +29,10 @@
*/
#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) = {
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")
......
#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) = {
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")
......
......@@ -28,6 +28,10 @@
*/
#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) = {
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")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册