diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-10 15:05:32 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-10 15:05:32 +0000 |
commit | 5fc7312d1b6da1acccc8cf7dfff2bed79b48a33c (patch) | |
tree | e19635f6ea6ed468c2e9c0f9eb08d0eac6b98bf5 /sjis.c | |
parent | 79a202433ca81eda26450c19d5ffd5b638202c5f (diff) | |
download | ruby-5fc7312d1b6da1acccc8cf7dfff2bed79b48a33c.tar.gz |
* include/ruby/oniguruma.h (OnigEncodingTypeST): add OnigEncoding
parameter to every function members.
* include/ruby/oniguruma.h (OnigEncodingTypeST): add auxiliary
data member to provide user defined data for an encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sjis.c')
-rw-r--r-- | sjis.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -71,13 +71,13 @@ static const char SJIS_CAN_BE_TRAIL_TABLE[256] = { #define SJIS_ISMB_TRAIL(byte) SJIS_CAN_BE_TRAIL_TABLE[(byte)] static int -mbc_enc_len(const UChar* p, const UChar* e) +mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc) { return EncLen_SJIS[*p]; } static int -code_to_mbclen(OnigCodePoint code) +code_to_mbclen(OnigCodePoint code, OnigEncoding enc) { if (code < 256) { if (EncLen_SJIS[(int )code] == 1) @@ -93,7 +93,7 @@ code_to_mbclen(OnigCodePoint code) } static OnigCodePoint -mbc_to_code(const UChar* p, const UChar* end) +mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc) { int c, i, len; OnigCodePoint n; @@ -112,7 +112,7 @@ mbc_to_code(const UChar* p, const UChar* end) } static int -code_to_mbc(OnigCodePoint code, UChar *buf) +code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc) { UChar *p = buf; @@ -128,7 +128,8 @@ code_to_mbc(OnigCodePoint code, UChar *buf) static int mbc_case_fold(OnigCaseFoldType flag, - const UChar** pp, const UChar* end, UChar* lower) + const UChar** pp, const UChar* end, UChar* lower, + OnigEncoding enc) { const UChar* p = *pp; @@ -176,7 +177,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype) #endif static UChar* -left_adjust_char_head(const UChar* start, const UChar* s) +left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc) { const UChar *p; int len; @@ -199,7 +200,7 @@ left_adjust_char_head(const UChar* start, const UChar* s) } static int -is_allowed_reverse_match(const UChar* s, const UChar* end) +is_allowed_reverse_match(const UChar* s, const UChar* end, OnigEncoding enc) { const UChar c = *s; return (SJIS_ISMB_TRAIL(c) ? FALSE : TRUE); @@ -253,14 +254,14 @@ property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end) } static int -is_code_ctype(OnigCodePoint code, unsigned int ctype) +is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc) { if (ctype <= ONIGENC_MAX_STD_CTYPE) { if (code < 128) return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype); else { if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) { - return (code_to_mbclen(code) > 1 ? TRUE : FALSE); + return (code_to_mbclen(code, enc) > 1 ? TRUE : FALSE); } } } @@ -279,7 +280,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype) static int get_ctype_code_range(int ctype, OnigCodePoint* sb_out, - const OnigCodePoint* ranges[]) + const OnigCodePoint* ranges[], OnigEncoding enc) { if (ctype <= ONIGENC_MAX_STD_CTYPE) { return ONIG_NO_SUPPORT_CONFIG; @@ -314,5 +315,6 @@ OnigEncodingType OnigEncodingSJIS = { is_code_ctype, get_ctype_code_range, left_adjust_char_head, - is_allowed_reverse_match + is_allowed_reverse_match, + 0 }; |