1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* include/ruby/oniguruma.h: remove ONIG_ENCODING_* and OnigEncoding*

which are not builtin.

* regenc.{c,h} (onigenc_mb2_code_to_mbclen, onigenc_mb4_code_to_mbclen):
  fix prototype.

* enc/big5.c, enc/euc_kr.c, enc/euc_tw.c, enc/gb18030.c,
  enc/koi8_r.c, enc/windows_1251.c: imported from Oniguruma.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-01-13 17:16:09 +00:00
parent 21671b558c
commit 8f15b8128c
14 changed files with 1383 additions and 74 deletions

View file

@ -152,7 +152,7 @@ mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
int c, i, len;
OnigCodePoint n;
len = enclen(&encoding_Shift_JIS, p, end);
len = enclen(&OnigEncodingName(Shift_JIS), p, end);
c = *p++;
n = c;
if (len == 1) return n;
@ -174,7 +174,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
*p++ = (UChar )(code & 0xff);
#if 0
if (enclen(&encoding_Shift_JIS, buf) != (p - buf))
if (enclen(&OnigEncodingName(Shift_JIS), buf) != (p - buf))
return REGERR_INVALID_CODE_POINT_VALUE;
#endif
return p - buf;
@ -194,7 +194,7 @@ mbc_case_fold(OnigCaseFoldType flag,
}
else {
int i;
int len = enclen(&encoding_Shift_JIS, p, end);
int len = enclen(&OnigEncodingName(Shift_JIS), p, end);
for (i = 0; i < len; i++) {
*lower++ = *p++;
@ -209,7 +209,7 @@ static int
is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
return onigenc_mbn_is_mbc_ambiguous(&encoding_Shift_JIS, flag, pp, end);
return onigenc_mbn_is_mbc_ambiguous(&OnigEncodingName(Shift_JIS), flag, pp, end);
}
#endif
@ -247,7 +247,7 @@ left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc)
}
}
}
len = enclen(&encoding_Shift_JIS, p, s);
len = enclen(&OnigEncodingName(Shift_JIS), p, s);
if (p + len > s) return (UChar* )p;
p += len;
return (UChar* )(p + ((s - p) & ~1));