зеркало из https://github.com/github/ruby.git
* regenc.c (onigenc_ascii_is_code_ctype): moved from enc/ascii.c.
* regenc.h (onigenc_ascii_is_code_ctype): declared. * enc/ascii.c: use onigenc_ascii_is_code_ctype. * enc/us_ascii.c: new file for US-ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e11ed98f88
Коммит
bcb064eb0f
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Sat Dec 22 14:27:27 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* regenc.c (onigenc_ascii_is_code_ctype): moved from enc/ascii.c.
|
||||
|
||||
* regenc.h (onigenc_ascii_is_code_ctype): declared.
|
||||
|
||||
* enc/ascii.c: use onigenc_ascii_is_code_ctype.
|
||||
|
||||
* enc/us_ascii.c: new file for US-ASCII.
|
||||
|
||||
Sat Dec 22 14:30:34 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (reg_named_capture_assign_iter): allows non-ascii names and
|
||||
|
|
11
enc/ascii.c
11
enc/ascii.c
|
@ -29,15 +29,6 @@
|
|||
|
||||
#include "regenc.h"
|
||||
|
||||
static int
|
||||
ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
|
||||
{
|
||||
if (code < 128)
|
||||
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
OnigEncodingDefine(ascii, ASCII) = {
|
||||
onigenc_single_byte_mbc_enc_len,
|
||||
"ASCII-8BIT",/* name */
|
||||
|
@ -51,7 +42,7 @@ OnigEncodingDefine(ascii, ASCII) = {
|
|||
onigenc_ascii_apply_all_case_fold,
|
||||
onigenc_ascii_get_case_fold_codes_by_str,
|
||||
onigenc_minimum_property_name_to_ctype,
|
||||
ascii_is_code_ctype,
|
||||
onigenc_ascii_is_code_ctype,
|
||||
onigenc_not_support_get_ctype_code_range,
|
||||
onigenc_single_byte_left_adjust_char_head,
|
||||
onigenc_always_true_is_allowed_reverse_match
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#include "regenc.h"
|
||||
|
||||
extern int
|
||||
mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc)
|
||||
{
|
||||
if (*p & 0x80)
|
||||
return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
|
||||
return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(1);
|
||||
}
|
||||
|
||||
OnigEncodingDefine(us_ascii, US_ASCII) = {
|
||||
mbc_enc_len,
|
||||
"US-ASCII",/* name */
|
||||
1, /* max byte length */
|
||||
1, /* min byte length */
|
||||
onigenc_is_mbc_newline_0x0a,
|
||||
onigenc_single_byte_mbc_to_code,
|
||||
onigenc_single_byte_code_to_mbclen,
|
||||
onigenc_single_byte_code_to_mbc,
|
||||
onigenc_ascii_mbc_case_fold,
|
||||
onigenc_ascii_apply_all_case_fold,
|
||||
onigenc_ascii_get_case_fold_codes_by_str,
|
||||
onigenc_minimum_property_name_to_ctype,
|
||||
onigenc_ascii_is_code_ctype,
|
||||
onigenc_not_support_get_ctype_code_range,
|
||||
onigenc_single_byte_left_adjust_char_head,
|
||||
onigenc_always_true_is_allowed_reverse_match
|
||||
};
|
|
@ -301,7 +301,6 @@ rb_enc_init(void)
|
|||
#undef ENC_REGISTER
|
||||
enc_alias("ASCII", rb_enc_name(ONIG_ENCODING_ASCII));
|
||||
enc_alias("BINARY", rb_enc_name(ONIG_ENCODING_ASCII));
|
||||
enc_alias("US-ASCII", rb_enc_name(ONIG_ENCODING_ASCII)); /* will be defined separately in future. */
|
||||
enc_alias("SJIS", rb_enc_name(ONIG_ENCODING_SJIS));
|
||||
}
|
||||
|
||||
|
|
10
regenc.c
10
regenc.c
|
@ -640,6 +640,16 @@ onigenc_always_false_is_allowed_reverse_match(const UChar* s, const UChar* end,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype,
|
||||
OnigEncoding enc)
|
||||
{
|
||||
if (code < 128)
|
||||
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern OnigCodePoint
|
||||
onigenc_mbn_mbc_to_code(OnigEncoding enc, const UChar* p, const UChar* end)
|
||||
{
|
||||
|
|
1
regenc.h
1
regenc.h
|
@ -124,6 +124,7 @@ ONIG_EXTERN int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *b
|
|||
ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s, OnigEncoding enc));
|
||||
ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
|
||||
ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
|
||||
ONIG_EXTERN int onigenc_ascii_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc));
|
||||
|
||||
/* methods for multi byte encoding */
|
||||
ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));
|
||||
|
|
Загрузка…
Ссылка в новой задаче