aboutsummaryrefslogtreecommitdiffstats
path: root/euc_jp.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-10 15:05:32 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-10 15:05:32 +0000
commit5fc7312d1b6da1acccc8cf7dfff2bed79b48a33c (patch)
treee19635f6ea6ed468c2e9c0f9eb08d0eac6b98bf5 /euc_jp.c
parent79a202433ca81eda26450c19d5ffd5b638202c5f (diff)
downloadruby-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 'euc_jp.c')
-rw-r--r--euc_jp.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/euc_jp.c b/euc_jp.c
index cebd2afe9a..f48c904945 100644
--- a/euc_jp.c
+++ b/euc_jp.c
@@ -51,13 +51,13 @@ static const int EncLen_EUCJP[] = {
};
static int
-mbc_enc_len(const UChar* p, const UChar* e)
+mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc)
{
return EncLen_EUCJP[*p];
}
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;
@@ -75,7 +75,7 @@ mbc_to_code(const UChar* p, const UChar* end)
}
static int
-code_to_mbclen(OnigCodePoint code)
+code_to_mbclen(OnigCodePoint code, OnigEncoding enc)
{
if (ONIGENC_IS_CODE_ASCII(code)) return 1;
else if (code > 0xffffff) return 0;
@@ -104,7 +104,7 @@ code_to_mbc_first(OnigCodePoint code)
#endif
static int
-code_to_mbc(OnigCodePoint code, UChar *buf)
+code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
{
UChar *p = buf;
@@ -121,7 +121,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)
{
int len;
const UChar* p = *pp;
@@ -144,7 +145,7 @@ mbc_case_fold(OnigCaseFoldType flag,
}
static UChar*
-left_adjust_char_head(const UChar* start, const UChar* s)
+left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc)
{
/* In this encoding
mb-trail bytes doesn't mix with single bytes.
@@ -163,7 +164,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;
if (c <= 0x7e || c == 0x8e || c == 0x8f)
@@ -219,14 +220,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);
}
}
}
@@ -245,7 +246,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;
@@ -281,5 +282,6 @@ OnigEncodingType OnigEncodingEUC_JP = {
is_code_ctype,
get_ctype_code_range,
left_adjust_char_head,
- is_allowed_reverse_match
+ is_allowed_reverse_match,
+ 0
};