summaryrefslogtreecommitdiff
path: root/enc
diff options
context:
space:
mode:
-rw-r--r--enc/big5.c164
-rw-r--r--enc/euc_jp.c8
-rw-r--r--enc/euc_kr.c141
-rw-r--r--enc/euc_tw.c140
-rw-r--r--enc/gb18030.c500
-rw-r--r--enc/iso_8859_2.c2
-rw-r--r--enc/iso_8859_5.c2
-rw-r--r--enc/koi8_r.c212
-rw-r--r--enc/shift_jis.c10
-rw-r--r--enc/windows_1251.c201
10 files changed, 1368 insertions, 12 deletions
@@ -0,0 +1,164 @@
@@ -139,7 +139,7 @@ mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc)
int c, i, len;
OnigCodePoint n;
- len = enclen(&encoding_EUC_JP, p, end);
n = (OnigCodePoint )*p++;
if (len == 1) return n;
@@ -191,7 +191,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc)
*p++ = (UChar )(code & 0xff);
#if 1
- if (enclen(&encoding_EUC_JP, buf, p) != (p - buf))
return ONIGERR_INVALID_CODE_POINT_VALUE;
#endif
return p - buf;
@@ -213,7 +213,7 @@ mbc_case_fold(OnigCaseFoldType flag,
else {
int i;
- len = enclen(&encoding_EUC_JP, p, end);
for (i = 0; i < len; i++) {
*lower++ = *p++;
}
@@ -235,7 +235,7 @@ left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc)
p = s;
while (!eucjp_islead(*p) && p > start) p--;
- len = enclen(&encoding_EUC_JP, p, s);
if (p + len > s) return (UChar* )p;
p += len;
return (UChar* )(p + ((s - p) & ~1));
@@ -0,0 +1,141 @@
@@ -0,0 +1,140 @@
@@ -0,0 +1,500 @@
@@ -238,5 +238,5 @@ OnigEncodingDefine(iso_8859_2, ISO_8859_2) = {
onigenc_always_true_is_allowed_reverse_match
};
ENC_ALIAS("ISO8859-2", "ISO-8859-2");
-ENC_REPLICATE("Windowws-1250", "ISO-8859-2");
ENC_ALIAS("CP1250", "Windows-1250");
@@ -228,5 +228,3 @@ OnigEncodingDefine(iso_8859_5, ISO_8859_5) = {
onigenc_always_true_is_allowed_reverse_match
};
ENC_ALIAS("ISO8859-5", "ISO-8859-5");
-ENC_REPLICATE("Windows-1251", "ISO-8859-5");
-ENC_ALIAS("CP1251", "Windows-1251");
@@ -0,0 +1,212 @@
@@ -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);
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))
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);
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);
}
#endif
@@ -247,7 +247,7 @@ left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc)
}
}
}
- len = enclen(&encoding_Shift_JIS, p, s);
if (p + len > s) return (UChar* )p;
p += len;
return (UChar* )(p + ((s - p) & ~1));
@@ -0,0 +1,201 @@