]> granicus.if.org Git - php/commitdiff
- Forgot to add those.
authorMoriyoshi Koizumi <moriyoshi@php.net>
Sat, 28 Feb 2004 20:46:06 +0000 (20:46 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Sat, 28 Feb 2004 20:46:06 +0000 (20:46 +0000)
25 files changed:
ext/mbstring/oniguruma/enc/ascii.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/big5.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/euc_jp.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/euc_kr.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/euc_tw.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_1.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_10.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_11.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_13.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_14.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_15.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_16.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_2.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_3.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_4.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_5.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_6.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_7.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_8.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/iso8859_9.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/koi8.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/koi8_r.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/mktable.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/sjis.c [new file with mode: 0644]
ext/mbstring/oniguruma/enc/utf8.c [new file with mode: 0644]

diff --git a/ext/mbstring/oniguruma/enc/ascii.c b/ext/mbstring/oniguruma/enc/ascii.c
new file mode 100644 (file)
index 0000000..44cc78f
--- /dev/null
@@ -0,0 +1,54 @@
+/**********************************************************************
+
+  ascii.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2003-2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+static int
+ascii_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 128)
+    return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingASCII = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "US-ASCII",  /* name */
+  1,           /* max byte length */
+  FALSE,       /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,   /* ctype_support_level */
+  TRUE,                             /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  onigenc_ascii_mbc_to_lower,
+  onigenc_ascii_mbc_is_case_ambig,
+  ascii_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/big5.c b/ext/mbstring/oniguruma/enc/big5.c
new file mode 100644 (file)
index 0000000..8aad7f5
--- /dev/null
@@ -0,0 +1,122 @@
+/**********************************************************************
+
+  big5.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2003-2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+static OnigCodePoint
+big5_mbc_to_code(UChar* p, UChar* end)
+{
+  return onigenc_mbn_mbc_to_code(ONIG_ENCODING_BIG5, p, end);
+}
+
+static int
+big5_code_to_mbc(OnigCodePoint code, UChar *buf)
+{
+  return onigenc_mb2_code_to_mbc(ONIG_ENCODING_BIG5, code, buf);
+}
+
+static int
+big5_mbc_to_lower(UChar* p, UChar* lower)
+{
+  return onigenc_mbn_mbc_to_lower(ONIG_ENCODING_BIG5, p, lower);
+}
+
+static int
+big5_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  return onigenc_mb2_code_is_ctype(ONIG_ENCODING_BIG5, code, ctype);
+}
+
+static const char BIG5_CAN_BE_TRAIL_TABLE[256] = {
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
+};
+
+#define BIG5_ISMB_FIRST(byte)  (OnigEncodingBIG5.len_table[byte] > 1)
+#define BIG5_ISMB_TRAIL(byte)  BIG5_CAN_BE_TRAIL_TABLE[(byte)]
+
+static UChar*
+big5_left_adjust_char_head(UChar* start, UChar* s)
+{
+  UChar *p;
+  int len;
+
+  if (s <= start) return s;
+  p = s;
+
+  if (BIG5_ISMB_TRAIL(*p)) {
+    while (p > start) {
+      if (! BIG5_ISMB_FIRST(*--p)) {
+       p++;
+       break;
+      }
+    } 
+  }
+  len = enc_len(ONIG_ENCODING_BIG5, *p);
+  if (p + len > s) return p;
+  p += len;
+  return p + ((s - p) & ~1);
+}
+
+static int
+big5_is_allowed_reverse_match(UChar* s, UChar* end)
+{
+  UChar c = *s;
+
+  return (BIG5_ISMB_TRAIL(c) ? FALSE : TRUE);
+}
+
+OnigEncodingType OnigEncodingBIG5 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
+  },
+  "Big5",    /* name */
+  2,         /* max byte length */
+  FALSE,     /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,  /* ctype_support_level */
+  FALSE,     /* is continuous sb mb codepoint */
+  big5_mbc_to_code,
+  onigenc_mb2_code_to_mbclen,
+  big5_code_to_mbc,
+  big5_mbc_to_lower,
+  onigenc_mbn_mbc_is_case_ambig,
+  big5_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  big5_left_adjust_char_head,
+  big5_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/euc_jp.c b/ext/mbstring/oniguruma/enc/euc_jp.c
new file mode 100644 (file)
index 0000000..b0526df
--- /dev/null
@@ -0,0 +1,191 @@
+/**********************************************************************
+
+  euc_jp.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2003-2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define eucjp_islead(c)    ((UChar )((c) - 0xa1) > 0xfe - 0xa1)
+
+static OnigCodePoint
+eucjp_mbc_to_code(UChar* p, UChar* end)
+{
+  int c, i, len;
+  OnigCodePoint n;
+
+  c = *p++;
+  len = enc_len(ONIG_ENCODING_EUC_JP, c);
+  n = c;
+  if (len == 1) return n;
+
+  for (i = 1; i < len; i++) {
+    if (p >= end) break;
+    c = *p++;
+    n <<= 8;  n += c;
+  }
+  return n;
+}
+
+static int
+eucjp_code_to_mbclen(OnigCodePoint code)
+{
+  if      ((code & 0xff0000) != 0) return 3;
+  else if ((code &   0xff00) != 0) return 2;
+  else return 1;
+}
+
+static int
+eucjp_code_to_mbc_first(OnigCodePoint code)
+{
+  int first;
+
+  if ((code & 0xff0000) != 0) {
+    first = (code >> 16) & 0xff;
+    /*
+    if (enc_len(ONIG_ENCODING_EUC_JP, first) != 3)
+      return ONIGERR_INVALID_WIDE_CHAR_VALUE;
+    */
+  }
+  else if ((code & 0xff00) != 0) {
+    first = (code >> 8) & 0xff;
+    /*
+    if (enc_len(ONIG_ENCODING_EUC_JP, first) != 2)
+      return ONIGERR_INVALID_WIDE_CHAR_VALUE;
+    */
+  }
+  else {
+    /*
+    if (enc_len(ONIG_ENCODING_EUC_JP, code) != 1)
+      return ONIGERR_INVALID_WIDE_CHAR_VALUE;
+    */
+    return (int )code;
+  }
+  return first;
+}
+
+static int
+eucjp_code_to_mbc(OnigCodePoint code, UChar *buf)
+{
+  UChar *p = buf;
+
+  if ((code & 0xff0000) != 0) *p++ = ((code >> 16) & 0xff);
+  if ((code &   0xff00) != 0) *p++ = ((code >>  8) & 0xff);
+  *p++ = (code & 0xff);
+
+#if 1
+  if (enc_len(ONIG_ENCODING_EUC_JP, buf[0]) != (p - buf))
+    return ONIGERR_INVALID_WIDE_CHAR_VALUE;
+#endif  
+  return p - buf;
+}
+
+static int
+eucjp_mbc_to_lower(UChar* p, UChar* lower)
+{
+  int len;
+
+  if (ONIGENC_IS_MBC_ASCII(p)) {
+    *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
+    return 1;
+  }
+  else {
+    len = enc_len(ONIG_ENCODING_EUC_JP, *p);
+    if (lower != p) {
+      /* memcpy(lower, p, len); */
+      int i;
+      for (i = 0; i < len; i++) {
+       *lower++ = *p++;
+      }
+    }
+    return len; /* return byte length of converted char to lower */
+  }
+}
+
+static int
+eucjp_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if ((ctype & ONIGENC_CTYPE_WORD) != 0) {
+    if (code < 128)
+      return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
+    else {
+      int first = eucjp_code_to_mbc_first(code);
+      return (enc_len(ONIG_ENCODING_EUC_JP, first) > 1 ? TRUE : FALSE);
+    }
+
+    ctype &= ~ONIGENC_CTYPE_WORD;
+    if (ctype == 0) return FALSE;
+  }
+
+  if (code < 128)
+    return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+static UChar*
+eucjp_left_adjust_char_head(UChar* start, UChar* s)
+{
+  /* Assumed in this encoding,
+     mb-trail bytes don't mix with single bytes.
+  */
+  UChar *p;
+  int len;
+
+  if (s <= start) return s;
+  p = s;
+
+  while (!eucjp_islead(*p) && p > start) p--;
+  len = enc_len(ONIG_ENCODING_EUC_JP, *p);
+  if (p + len > s) return p;
+  p += len;
+  return p + ((s - p) & ~1);
+}
+
+static int
+eucjp_is_allowed_reverse_match(UChar* s, UChar* end)
+{
+  UChar c = *s;
+  if (c <= 0x7e || c == 0x8e || c == 0x8f)
+    return TRUE;
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingEUC_JP = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
+  },
+  "EUC-JP",   /* name */
+  3,          /* max byte length */
+  FALSE,      /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  FALSE,      /* is continuous sb mb codepoint */
+  eucjp_mbc_to_code,
+  eucjp_code_to_mbclen,
+  eucjp_code_to_mbc,
+  eucjp_mbc_to_lower,
+  onigenc_mbn_mbc_is_case_ambig,
+  eucjp_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  eucjp_left_adjust_char_head,
+  eucjp_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/euc_kr.c b/ext/mbstring/oniguruma/enc/euc_kr.c
new file mode 100644 (file)
index 0000000..1a0fc99
--- /dev/null
@@ -0,0 +1,136 @@
+/**********************************************************************
+
+  euc_kr.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+static OnigCodePoint
+euckr_mbc_to_code(UChar* p, UChar* end)
+{
+  return onigenc_mbn_mbc_to_code(ONIG_ENCODING_EUC_KR, p, end);
+}
+
+static int
+euckr_code_to_mbc(OnigCodePoint code, UChar *buf)
+{
+  return onigenc_mb2_code_to_mbc(ONIG_ENCODING_EUC_KR, code, buf);
+}
+
+static int
+euckr_mbc_to_lower(UChar* p, UChar* lower)
+{
+  return onigenc_mbn_mbc_to_lower(ONIG_ENCODING_EUC_KR, p, lower);
+}
+
+static int
+euckr_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  return onigenc_mb2_code_is_ctype(ONIG_ENCODING_EUC_KR, code, ctype);
+}
+
+#define euckr_islead(c)    ((c) < 0xa1 || (c) == 0xff)
+
+static UChar*
+euckr_left_adjust_char_head(UChar* start, UChar* s)
+{
+  /* Assumed in this encoding,
+     mb-trail bytes don't mix with single bytes.
+  */
+  UChar *p;
+  int len;
+
+  if (s <= start) return s;
+  p = s;
+
+  while (!euckr_islead(*p) && p > start) p--;
+  len = enc_len(ONIG_ENCODING_EUC_KR, *p);
+  if (p + len > s) return p;
+  p += len;
+  return p + ((s - p) & ~1);
+}
+
+static int
+euckr_is_allowed_reverse_match(UChar* s, UChar* end)
+{
+  UChar c = *s;
+  if (c <= 0x7e) return TRUE;
+  else           return FALSE;
+}
+
+OnigEncodingType OnigEncodingEUC_KR = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
+  },
+  "EUC-KR",   /* name */
+  2,          /* max byte length */
+  FALSE,      /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  FALSE,      /* is continuous sb mb codepoint */
+  euckr_mbc_to_code,
+  onigenc_mb2_code_to_mbclen,
+  euckr_code_to_mbc,
+  euckr_mbc_to_lower,
+  onigenc_mbn_mbc_is_case_ambig,
+  euckr_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  euckr_left_adjust_char_head,
+  euckr_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
+
+/* Same with OnigEncodingEUC_KR except the name */
+OnigEncodingType OnigEncodingEUC_CN = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
+  },
+  "EUC-CN",   /* name */
+  2,          /* max byte length */
+  FALSE,      /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  FALSE,      /* is continuous sb mb codepoint */
+  euckr_mbc_to_code,
+  onigenc_mb2_code_to_mbclen,
+  euckr_code_to_mbc,
+  euckr_mbc_to_lower,
+  onigenc_mbn_mbc_is_case_ambig,
+  euckr_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  euckr_left_adjust_char_head,
+  euckr_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/euc_tw.c b/ext/mbstring/oniguruma/enc/euc_tw.c
new file mode 100644 (file)
index 0000000..b39a9a5
--- /dev/null
@@ -0,0 +1,98 @@
+/**********************************************************************
+
+  euc_tw.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+static OnigCodePoint
+euctw_mbc_to_code(UChar* p, UChar* end)
+{
+  return onigenc_mbn_mbc_to_code(ONIG_ENCODING_EUC_TW, p, end);
+}
+
+static int
+euctw_code_to_mbc(OnigCodePoint code, UChar *buf)
+{
+  return onigenc_mb4_code_to_mbc(ONIG_ENCODING_EUC_TW, code, buf);
+}
+
+static int
+euctw_mbc_to_lower(UChar* p, UChar* lower)
+{
+  return onigenc_mbn_mbc_to_lower(ONIG_ENCODING_EUC_TW, p, lower);
+}
+
+static int
+euctw_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  return onigenc_mb4_code_is_ctype(ONIG_ENCODING_EUC_TW, code, ctype);
+}
+
+#define euctw_islead(c)    (((c) < 0xa1 && (c) != 0x8e) || (c) == 0xff)
+
+static UChar*
+euctw_left_adjust_char_head(UChar* start, UChar* s)
+{
+  /* Assumed in this encoding,
+     mb-trail bytes don't mix with single bytes.
+  */
+  UChar *p;
+  int len;
+
+  if (s <= start) return s;
+  p = s;
+
+  while (!euctw_islead(*p) && p > start) p--;
+  len = enc_len(ONIG_ENCODING_EUC_TW, *p);
+  if (p + len > s) return p;
+  p += len;
+  return p + ((s - p) & ~1);
+}
+
+static int
+euctw_is_allowed_reverse_match(UChar* s, UChar* end)
+{
+  UChar c = *s;
+  if (c <= 0x7e) return TRUE;
+  else           return FALSE;
+}
+
+OnigEncodingType OnigEncodingEUC_TW = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
+  },
+  "EUC-TW",   /* name */
+  4,          /* max byte length */
+  FALSE,      /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  FALSE,      /* is continuous sb mb codepoint */
+  euctw_mbc_to_code,
+  onigenc_mb4_code_to_mbclen,
+  euctw_code_to_mbc,
+  euctw_mbc_to_lower,
+  onigenc_mbn_mbc_is_case_ambig,
+  euctw_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  euctw_left_adjust_char_head,
+  euctw_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_1.c b/ext/mbstring/oniguruma/enc/iso8859_1.c
new file mode 100644 (file)
index 0000000..662f0e2
--- /dev/null
@@ -0,0 +1,152 @@
+/**********************************************************************
+
+  iso8859_1.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2003-2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_1_TO_LOWER_CASE(c) EncISO_8859_1_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_1_CTYPE(code,ctype) \
+  ((EncISO_8859_1_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_1_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
+  '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
+  '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_1_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x00d0, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0871, 0x00d0, 0x0050, 0x00d0, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0850, 0x0850, 0x0050, 0x0871, 0x0050, 0x00d0,
+  0x0050, 0x0850, 0x0871, 0x00d0, 0x0850, 0x0850, 0x0850, 0x00d0,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0050,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871
+};
+
+static int
+iso_8859_1_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_1_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_1_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_1_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf, 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
+    if (*p == 0xdf || (*p >= 0xaa && *p <= 0xba))
+      return FALSE;
+    else
+      return TRUE;
+  }
+
+  return (v != 0 ? TRUE : FALSE);
+}
+
+static int
+iso_8859_1_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_1_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_1 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-1",  /* name */
+  1,             /* max byte length */
+  TRUE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_1_mbc_to_lower,
+  iso_8859_1_mbc_is_case_ambig,
+  iso_8859_1_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_10.c b/ext/mbstring/oniguruma/enc/iso8859_10.c
new file mode 100644 (file)
index 0000000..ac49303
--- /dev/null
@@ -0,0 +1,155 @@
+/**********************************************************************
+
+  iso8859_10.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_10_TO_LOWER_CASE(c) EncISO_8859_10_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_10_CTYPE(code,ctype) \
+  ((EncISO_8859_10_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_10_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\261', '\262', '\263', '\264', '\265', '\266', '\247',
+  '\270', '\271', '\272', '\273', '\274', '\255', '\276', '\277',
+  '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_10_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0050,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x00d0, 0x0a51, 0x0a51,
+  0x0050, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x00d0,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x00d0, 0x0871, 0x0871,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871
+};
+
+static int
+iso_8859_10_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_10_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_10_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_10_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf is lower case letter, but can't convert. */
+    if (*p == 0xdf)
+      return FALSE;
+    else
+      return TRUE;
+  }
+  else if (v != 0) {
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+static int
+iso_8859_10_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_10_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_10 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-10", /* name */
+  1,             /* max byte length */
+  TRUE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_10_mbc_to_lower,
+  iso_8859_10_mbc_is_case_ambig,
+  iso_8859_10_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_11.c b/ext/mbstring/oniguruma/enc/iso8859_11.c
new file mode 100644 (file)
index 0000000..ebe81d3
--- /dev/null
@@ -0,0 +1,92 @@
+/**********************************************************************
+
+  iso8859_11.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_IS_ISO_8859_11_CTYPE(code,ctype) \
+  ((EncISO_8859_11_CtypeTable[code] & ctype) != 0)
+
+static unsigned short EncISO_8859_11_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0000, 0x0000, 0x0000, 0x0000, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0000, 0x0000, 0x0000, 0x0000
+};
+
+static int
+iso_8859_11_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_11_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_11 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-11", /* name */
+  1,             /* max byte length */
+  FALSE,         /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  onigenc_ascii_mbc_to_lower,
+  onigenc_ascii_mbc_is_case_ambig,
+  iso_8859_11_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_13.c b/ext/mbstring/oniguruma/enc/iso8859_13.c
new file mode 100644 (file)
index 0000000..8de7251
--- /dev/null
@@ -0,0 +1,155 @@
+/**********************************************************************
+
+  iso8859_13.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_13_TO_LOWER_CASE(c) EncISO_8859_13_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_13_CTYPE(code,ctype) \
+  ((EncISO_8859_13_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_13_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
+  '\270', '\251', '\272', '\253', '\254', '\255', '\256', '\277',
+  '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_13_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x00d0, 0x0050, 0x0050, 0x0050, 0x00d0, 0x0050, 0x0050,
+  0x0a51, 0x0050, 0x0a51, 0x00d0, 0x0050, 0x00d0, 0x0050, 0x0a51,
+  0x0050, 0x0050, 0x0850, 0x0850, 0x00d0, 0x0871, 0x0050, 0x00d0,
+  0x0871, 0x0850, 0x0871, 0x00d0, 0x0850, 0x0850, 0x0850, 0x0871,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0050,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x00d0
+};
+
+static int
+iso_8859_13_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_13_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_13_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_13_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf is lower case letter, but can't convert. */
+    if (*p == 0xdf || *p == 0xb5)
+      return FALSE;
+    else
+      return TRUE;
+  }
+  else if (v != 0) {
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+static int
+iso_8859_13_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_13_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_13 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-13", /* name */
+  1,             /* max byte length */
+  TRUE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_13_mbc_to_lower,
+  iso_8859_13_mbc_is_case_ambig,
+  iso_8859_13_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_14.c b/ext/mbstring/oniguruma/enc/iso8859_14.c
new file mode 100644 (file)
index 0000000..333deeb
--- /dev/null
@@ -0,0 +1,155 @@
+/**********************************************************************
+
+  iso8859_14.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_14_TO_LOWER_CASE(c) EncISO_8859_14_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_14_CTYPE(code,ctype) \
+  ((EncISO_8859_14_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_14_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\242', '\242', '\243', '\245', '\245', '\253', '\247',
+  '\270', '\251', '\272', '\253', '\274', '\255', '\256', '\377',
+  '\261', '\261', '\263', '\263', '\265', '\265', '\266', '\271',
+  '\270', '\271', '\272', '\277', '\274', '\276', '\276', '\277',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_14_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0a51, 0x0871, 0x0050, 0x0a51, 0x0871, 0x0a51, 0x0050,
+  0x0a51, 0x0050, 0x0a51, 0x0871, 0x0a51, 0x00d0, 0x0050, 0x0a51,
+  0x0a51, 0x0871, 0x0a51, 0x0871, 0x0a51, 0x0871, 0x0050, 0x0a51,
+  0x0871, 0x0871, 0x0871, 0x0a51, 0x0871, 0x0a51, 0x0871, 0x0871,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871
+};
+
+static int
+iso_8859_14_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_14_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_14_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_14_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf is lower case letter, but can't convert. */
+    if (*p == 0xdf)
+      return FALSE;
+    else
+      return TRUE;
+  }
+  else if (v != 0) {
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+static int
+iso_8859_14_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_14_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_14 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-14", /* name */
+  1,             /* max byte length */
+  TRUE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_14_mbc_to_lower,
+  iso_8859_14_mbc_is_case_ambig,
+  iso_8859_14_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_15.c b/ext/mbstring/oniguruma/enc/iso8859_15.c
new file mode 100644 (file)
index 0000000..49cb266
--- /dev/null
@@ -0,0 +1,155 @@
+/**********************************************************************
+
+  iso8859_15.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2003-2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+/* reference
+   http://en.wikipedia.org/wiki/ISO_8859-15
+*/
+
+#define ENC_ISO_8859_15_TO_LOWER_CASE(c) EncISO_8859_15_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_15_CTYPE(code,ctype) \
+  ((EncISO_8859_15_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_15_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\241', '\242', '\243', '\244', '\245', '\250', '\247',
+  '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
+  '\260', '\261', '\262', '\263', '\270', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\275', '\275', '\377', '\277',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_15_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x00d0, 0x0050, 0x0050, 0x0050, 0x0050, 0x0a51, 0x0050,
+  0x0871, 0x0050, 0x0871, 0x00d0, 0x0050, 0x00d0, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0850, 0x0850, 0x0a51, 0x0871, 0x0050, 0x00d0,
+  0x0871, 0x0850, 0x0871, 0x00d0, 0x0a51, 0x0871, 0x0a51, 0x00d0,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0050,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871
+};
+
+static int
+iso_8859_15_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_15_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_15_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_15_CtypeTable[*p]
+          & (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf, 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
+    if (*p == 0xdf || *p == 0xaa || *p == 0xb5 || *p == 0xba)
+      return FALSE;
+    else
+      return TRUE;
+  }
+  return (v != 0 ? TRUE : FALSE);
+}
+
+static int
+iso_8859_15_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_15_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_15 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-15",  /* name */
+  1,              /* max byte length */
+  TRUE,           /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,      /* ctype_support_level */
+  TRUE,           /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_15_mbc_to_lower,
+  iso_8859_15_mbc_is_case_ambig,
+  iso_8859_15_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_16.c b/ext/mbstring/oniguruma/enc/iso8859_16.c
new file mode 100644 (file)
index 0000000..e59ea0f
--- /dev/null
@@ -0,0 +1,155 @@
+/**********************************************************************
+
+  iso8859_16.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_16_TO_LOWER_CASE(c) EncISO_8859_16_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_16_CTYPE(code,ctype) \
+  ((EncISO_8859_16_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_16_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\242', '\242', '\263', '\245', '\245', '\250', '\247',
+  '\250', '\251', '\272', '\253', '\256', '\255', '\256', '\277',
+  '\260', '\261', '\271', '\263', '\270', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\275', '\275', '\377', '\277',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_16_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0a51, 0x0871, 0x0a51, 0x0050, 0x00d0, 0x0a51, 0x0050,
+  0x0871, 0x0050, 0x0a51, 0x00d0, 0x0a51, 0x00d0, 0x0871, 0x0a51,
+  0x0050, 0x0050, 0x0a51, 0x0871, 0x0a51, 0x00d0, 0x0050, 0x00d0,
+  0x0871, 0x0871, 0x0871, 0x00d0, 0x0a51, 0x0871, 0x0a51, 0x0871,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871
+};
+
+static int
+iso_8859_16_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_16_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_16_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_16_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf is lower case letter, but can't convert. */
+    if (*p == 0xdf)
+      return FALSE;
+    else
+      return TRUE;
+  }
+  else if (v != 0) {
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+static int
+iso_8859_16_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_16_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_16 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-16", /* name */
+  1,             /* max byte length */
+  TRUE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_16_mbc_to_lower,
+  iso_8859_16_mbc_is_case_ambig,
+  iso_8859_16_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_2.c b/ext/mbstring/oniguruma/enc/iso8859_2.c
new file mode 100644 (file)
index 0000000..3d6b0a6
--- /dev/null
@@ -0,0 +1,152 @@
+/**********************************************************************
+
+  iso8859_2.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_2_TO_LOWER_CASE(c) EncISO_8859_2_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_2_CTYPE(code,ctype) \
+  ((EncISO_8859_2_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_2_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\261', '\242', '\263', '\244', '\265', '\266', '\247',
+  '\250', '\271', '\272', '\273', '\274', '\255', '\276', '\277',
+  '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_2_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0a51, 0x0050, 0x0a51, 0x0050, 0x0a51, 0x0a51, 0x0050,
+  0x0050, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x00d0, 0x0a51, 0x0a51,
+  0x0050, 0x0871, 0x0050, 0x0871, 0x0050, 0x0871, 0x0871, 0x0050,
+  0x0050, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050, 0x0871, 0x0871,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0050,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050
+};
+
+static int
+iso_8859_2_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_2_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_2_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_2_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf is lower case letter, but can't convert. */
+    if (*p == 0xdf)
+      return FALSE;
+    else
+      return TRUE;
+  }
+
+  return (v != 0 ? TRUE : FALSE);
+}
+
+static int
+iso_8859_2_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_2_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_2 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-2",  /* name */
+  1,             /* max byte length */
+  TRUE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_2_mbc_to_lower,
+  iso_8859_2_mbc_is_case_ambig,
+  iso_8859_2_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_3.c b/ext/mbstring/oniguruma/enc/iso8859_3.c
new file mode 100644 (file)
index 0000000..37a3089
--- /dev/null
@@ -0,0 +1,152 @@
+/**********************************************************************
+
+  iso8859_3.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_3_TO_LOWER_CASE(c) EncISO_8859_3_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_3_CTYPE(code,ctype) \
+  ((EncISO_8859_3_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_3_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\261', '\242', '\243', '\244', '\245', '\266', '\247',
+  '\250', '\271', '\272', '\273', '\274', '\255', '\256', '\277',
+  '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
+  '\340', '\341', '\342', '\303', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\320', '\361', '\362', '\363', '\364', '\365', '\366', '\327',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_3_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0a51, 0x0050, 0x0050, 0x0050, 0x0000, 0x0a51, 0x0050,
+  0x0050, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x00d0, 0x0000, 0x0a51,
+  0x0050, 0x0871, 0x0850, 0x0850, 0x0050, 0x0871, 0x0871, 0x00d0,
+  0x0050, 0x0871, 0x0871, 0x0871, 0x0871, 0x0850, 0x0000, 0x0871,
+  0x0a51, 0x0a51, 0x0a51, 0x0000, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0000, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0050,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0000, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0000, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050
+};
+
+static int
+iso_8859_3_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_3_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_3_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_3_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf is lower case letter, but can't convert. */
+    if (*p == 0xdf || *p == 0xb5)
+      return FALSE;
+    else
+      return TRUE;
+  }
+
+  return (v != 0 ? TRUE : FALSE);
+}
+
+static int
+iso_8859_3_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_3_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_3 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-3",  /* name */
+  1,             /* max byte length */
+  TRUE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_3_mbc_to_lower,
+  iso_8859_3_mbc_is_case_ambig,
+  iso_8859_3_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_4.c b/ext/mbstring/oniguruma/enc/iso8859_4.c
new file mode 100644 (file)
index 0000000..897eec9
--- /dev/null
@@ -0,0 +1,155 @@
+/**********************************************************************
+
+  iso8859_4.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_4_TO_LOWER_CASE(c) EncISO_8859_4_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_4_CTYPE(code,ctype) \
+  ((EncISO_8859_4_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_4_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\261', '\242', '\263', '\244', '\265', '\266', '\247',
+  '\250', '\271', '\272', '\273', '\274', '\255', '\276', '\257',
+  '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\274', '\277', '\276', '\277',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_4_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0a51, 0x0871, 0x0a51, 0x0050, 0x0a51, 0x0a51, 0x0050,
+  0x0050, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x00d0, 0x0a51, 0x0050,
+  0x0050, 0x0871, 0x0050, 0x0871, 0x0050, 0x0871, 0x0871, 0x0050,
+  0x0050, 0x0871, 0x0871, 0x0871, 0x0871, 0x0a51, 0x0871, 0x0871,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0050,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050
+};
+
+static int
+iso_8859_4_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_4_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_4_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_4_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf is lower case letter, but can't convert. */
+    if (*p == 0xdf || *p == 0xa2)
+      return FALSE;
+    else
+      return TRUE;
+  }
+  else if (v != 0) {
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+static int
+iso_8859_4_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_4_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_4 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-4",  /* name */
+  1,             /* max byte length */
+  TRUE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_4_mbc_to_lower,
+  iso_8859_4_mbc_is_case_ambig,
+  iso_8859_4_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_5.c b/ext/mbstring/oniguruma/enc/iso8859_5.c
new file mode 100644 (file)
index 0000000..34e0f9d
--- /dev/null
@@ -0,0 +1,144 @@
+/**********************************************************************
+
+  iso8859_5.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_5_TO_LOWER_CASE(c) EncISO_8859_5_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_5_CTYPE(code,ctype) \
+  ((EncISO_8859_5_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_5_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\255', '\376', '\377',
+  '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
+  '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
+  '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_5_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x00d0, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0050, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050, 0x0871, 0x0871
+};
+
+static int
+iso_8859_5_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_5_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_5_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_5_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  return (v != 0 ? TRUE : FALSE);
+}
+
+static int
+iso_8859_5_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_5_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_5 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-5",  /* name */
+  1,             /* max byte length */
+  FALSE,         /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_5_mbc_to_lower,
+  iso_8859_5_mbc_is_case_ambig,
+  iso_8859_5_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_6.c b/ext/mbstring/oniguruma/enc/iso8859_6.c
new file mode 100644 (file)
index 0000000..956e982
--- /dev/null
@@ -0,0 +1,92 @@
+/**********************************************************************
+
+  iso8859_6.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_IS_ISO_8859_6_CTYPE(code,ctype) \
+  ((EncISO_8859_6_CtypeTable[code] & ctype) != 0)
+
+static unsigned short EncISO_8859_6_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0000, 0x0000, 0x0000, 0x0050, 0x0000, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x00d0, 0x00d0, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x00d0, 0x0000, 0x0000, 0x0000, 0x00d0,
+  0x0000, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+};
+
+static int
+iso_8859_6_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_6_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_6 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-6",  /* name */
+  1,             /* max byte length */
+  FALSE,         /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  onigenc_ascii_mbc_to_lower,
+  onigenc_ascii_mbc_is_case_ambig,
+  iso_8859_6_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_7.c b/ext/mbstring/oniguruma/enc/iso8859_7.c
new file mode 100644 (file)
index 0000000..1ea2250
--- /dev/null
@@ -0,0 +1,151 @@
+/**********************************************************************
+
+  iso8859_7.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_7_TO_LOWER_CASE(c) EncISO_8859_7_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_7_CTYPE(code,ctype) \
+  ((EncISO_8859_7_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_7_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
+  '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
+  '\260', '\261', '\262', '\263', '\264', '\265', '\334', '\267',
+  '\335', '\336', '\337', '\273', '\374', '\275', '\375', '\376',
+  '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\322', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\334', '\335', '\336', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_7_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x00d0, 0x00d0, 0x0050, 0x0000, 0x0000, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0000, 0x00d0, 0x0050, 0x00d0, 0x0000, 0x00d0,
+  0x0050, 0x0050, 0x0850, 0x0850, 0x0050, 0x0050, 0x0a51, 0x00d0,
+  0x0a51, 0x0a51, 0x0a51, 0x00d0, 0x0a51, 0x0850, 0x0a51, 0x0a51,
+  0x0871, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0000, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0000
+};
+
+static int
+iso_8859_7_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_7_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_7_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_7_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    if (*p == 0xc0 || *p == 0xe0)
+      return FALSE;
+    else
+      return TRUE;
+  }
+
+  return (v != 0 ? TRUE : FALSE);
+}
+
+static int
+iso_8859_7_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_7_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_7 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-7",  /* name */
+  1,             /* max byte length */
+  FALSE,         /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_7_mbc_to_lower,
+  iso_8859_7_mbc_is_case_ambig,
+  iso_8859_7_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_8.c b/ext/mbstring/oniguruma/enc/iso8859_8.c
new file mode 100644 (file)
index 0000000..d87774a
--- /dev/null
@@ -0,0 +1,92 @@
+/**********************************************************************
+
+  iso8859_8.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_IS_ISO_8859_8_CTYPE(code,ctype) \
+  ((EncISO_8859_8_CtypeTable[code] & ctype) != 0)
+
+static unsigned short EncISO_8859_8_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0000, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0050, 0x00d0, 0x0050, 0x00d0, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0850, 0x0850, 0x0050, 0x0871, 0x0050, 0x00d0,
+  0x0050, 0x0850, 0x0050, 0x00d0, 0x0850, 0x0850, 0x0850, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d0,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851, 0x0851,
+  0x0851, 0x0851, 0x0851, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+};
+
+static int
+iso_8859_8_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_8_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_8 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-8",  /* name */
+  1,             /* max byte length */
+  FALSE,         /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  onigenc_ascii_mbc_to_lower,
+  onigenc_ascii_mbc_is_case_ambig,
+  iso_8859_8_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/iso8859_9.c b/ext/mbstring/oniguruma/enc/iso8859_9.c
new file mode 100644 (file)
index 0000000..9638b92
--- /dev/null
@@ -0,0 +1,152 @@
+/**********************************************************************
+
+  iso8859_9.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_ISO_8859_9_TO_LOWER_CASE(c) EncISO_8859_9_ToLowerCaseTable[c]
+#define ENC_IS_ISO_8859_9_CTYPE(code,ctype) \
+  ((EncISO_8859_9_CtypeTable[code] & ctype) != 0)
+
+static UChar EncISO_8859_9_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
+  '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
+  '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327',
+  '\370', '\371', '\372', '\373', '\374', '\335', '\376', '\337',
+  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
+  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
+  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
+  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
+};
+
+static unsigned short EncISO_8859_9_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x00d0, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0871, 0x00d0, 0x0050, 0x00d0, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0850, 0x0850, 0x0050, 0x0871, 0x0050, 0x00d0,
+  0x0050, 0x0850, 0x0871, 0x00d0, 0x0850, 0x0850, 0x0850, 0x00d0,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0050,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0050,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871
+};
+
+static int
+iso_8859_9_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_ISO_8859_9_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+iso_8859_9_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncISO_8859_9_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  if ((v | ONIGENC_CTYPE_LOWER) != 0) {
+    /* 0xdf, 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
+    if (*p == 0xdf || (*p >= 0xaa && *p <= 0xba))
+      return FALSE;
+    else
+      return TRUE;
+  }
+
+  return (v != 0 ? TRUE : FALSE);
+}
+
+static int
+iso_8859_9_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_ISO_8859_9_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingISO_8859_9 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "ISO-8859-9",  /* name */
+  1,             /* max byte length */
+  TRUE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  iso_8859_9_mbc_to_lower,
+  iso_8859_9_mbc_is_case_ambig,
+  iso_8859_9_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_get_all_fold_match_code_ss_0xdf,
+  onigenc_get_fold_match_info_ss_0xdf
+};
diff --git a/ext/mbstring/oniguruma/enc/koi8.c b/ext/mbstring/oniguruma/enc/koi8.c
new file mode 100644 (file)
index 0000000..9dba264
--- /dev/null
@@ -0,0 +1,144 @@
+/**********************************************************************
+
+  koi8.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_KOI8_TO_LOWER_CASE(c) EncKOI8_ToLowerCaseTable[c]
+#define ENC_IS_KOI8_CTYPE(code,ctype) \
+  ((EncKOI8_CtypeTable[code] & ctype) != 0)
+
+static UChar EncKOI8_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
+  '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
+  '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
+  '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
+  '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
+  '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
+  '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
+  '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
+  '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
+  '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
+  '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337'
+};
+
+static unsigned short EncKOI8_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
+  0x0142, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51
+};
+
+static int
+koi8_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_KOI8_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+koi8_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncKOI8_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  return ((v != 0) ? TRUE : FALSE);
+}
+
+static int
+koi8_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_KOI8_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingKOI8 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "KOI8",        /* name */
+  1,             /* max byte length */
+  FALSE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  koi8_mbc_to_lower,
+  koi8_mbc_is_case_ambig,
+  koi8_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/koi8_r.c b/ext/mbstring/oniguruma/enc/koi8_r.c
new file mode 100644 (file)
index 0000000..20e7d73
--- /dev/null
@@ -0,0 +1,144 @@
+/**********************************************************************
+
+  koi8_r.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define ENC_KOI8_R_TO_LOWER_CASE(c) EncKOI8_R_ToLowerCaseTable[c]
+#define ENC_IS_KOI8_R_CTYPE(code,ctype) \
+  ((EncKOI8_R_CtypeTable[code] & ctype) != 0)
+
+static UChar EncKOI8_R_ToLowerCaseTable[256] = {
+  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
+  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
+  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
+  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
+  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
+  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
+  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
+  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
+  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
+  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
+  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
+  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
+  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
+  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
+  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
+  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
+  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
+  '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
+  '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
+  '\260', '\261', '\262', '\243', '\264', '\265', '\266', '\267',
+  '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
+  '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
+  '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
+  '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
+  '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
+  '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
+  '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
+  '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
+  '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337'
+};
+
+static unsigned short EncKOI8_R_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x18d0,
+  0x10d0, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x10d0, 0x10d0, 0x10d0, 0x1004,
+  0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0142, 0x0050, 0x0050, 0x0850, 0x00d0, 0x0050,
+  0x0050, 0x0050, 0x0050, 0x0871, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0050, 0x0a51, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871, 0x0871,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51,
+  0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51, 0x0a51
+};
+
+static int
+koi8_r_mbc_to_lower(UChar* p, UChar* lower)
+{
+  *lower = ENC_KOI8_R_TO_LOWER_CASE(*p);
+  return 1; /* return byte length of converted char to lower */
+}
+
+static int
+koi8_r_mbc_is_case_ambig(UChar* p)
+{
+  int v = (EncKOI8_R_CtypeTable[*p] &
+          (ONIGENC_CTYPE_UPPER | ONIGENC_CTYPE_LOWER));
+
+  return ((v != 0) ? TRUE : FALSE);
+}
+
+static int
+koi8_r_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256)
+    return ENC_IS_KOI8_R_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+OnigEncodingType OnigEncodingKOI8_R = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+  },
+  "KOI8-R",       /* name */
+  1,              /* max byte length */
+  FALSE,          /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,    /* ctype_support_level */
+  TRUE,          /* is continuous sb mb codepoint */
+  onigenc_single_byte_mbc_to_code,
+  onigenc_single_byte_code_to_mbclen,
+  onigenc_single_byte_code_to_mbc,
+  koi8_r_mbc_to_lower,
+  koi8_r_mbc_is_case_ambig,
+  koi8_r_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  onigenc_single_byte_left_adjust_char_head,
+  onigenc_single_byte_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/mktable.c b/ext/mbstring/oniguruma/enc/mktable.c
new file mode 100644 (file)
index 0000000..67e9a61
--- /dev/null
@@ -0,0 +1,1069 @@
+/**********************************************************************
+
+  mktable.c
+
+  Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include <stdio.h>
+
+#define NOT_RUBY
+#include "regenc.h"
+
+#define ISO_8859_1     0
+#define ISO_8859_2     1
+#define ISO_8859_3     2
+#define ISO_8859_4     3
+#define ISO_8859_5     4
+#define ISO_8859_6     5
+#define ISO_8859_7     6
+#define ISO_8859_8     7
+#define ISO_8859_9     8
+#define ISO_8859_10    9
+#define ISO_8859_11   10
+#define ISO_8859_13   11
+#define ISO_8859_14   12
+#define ISO_8859_15   13
+#define ISO_8859_16   14
+#define KOI8          15
+#define KOI8_R        16
+
+typedef struct {
+  int   num;
+  char* name;
+} ENC_INFO;
+
+static ENC_INFO Info[] = {
+  { ISO_8859_1,  "ISO_8859_1"  },
+  { ISO_8859_2,  "ISO_8859_2"  },
+  { ISO_8859_3,  "ISO_8859_3"  },
+  { ISO_8859_4,  "ISO_8859_4"  },
+  { ISO_8859_5,  "ISO_8859_5"  },
+  { ISO_8859_6,  "ISO_8859_6"  },
+  { ISO_8859_7,  "ISO_8859_7"  },
+  { ISO_8859_8,  "ISO_8859_8"  },
+  { ISO_8859_9,  "ISO_8859_9"  },
+  { ISO_8859_10, "ISO_8859_10" },
+  { ISO_8859_11, "ISO_8859_11" },
+  { ISO_8859_13, "ISO_8859_13" },
+  { ISO_8859_14, "ISO_8859_14" },
+  { ISO_8859_15, "ISO_8859_15" },
+  { ISO_8859_16, "ISO_8859_16" },
+  { KOI8,        "KOI8" },
+  { KOI8_R,      "KOI8_R" }
+};
+
+
+static int IsAlpha(int enc, int c)
+{
+  if (c >= 0x41 && c <= 0x5a) return 1;
+  if (c >= 0x61 && c <= 0x7a) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_9:
+    if (c == 0xaa) return 1;
+    if (c == 0xb5) return 1;
+    if (c == 0xba) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xff) return 1;
+    break;
+
+  case ISO_8859_2:
+    if (c == 0xa1 || c == 0xa3) return 1;
+    if (c == 0xa5 || c == 0xa6) return 1;
+    if (c >= 0xa9 && c <= 0xac) return 1;
+    if (c >= 0xae && c <= 0xaf) return 1;
+    if (c == 0xb1 || c == 0xb3) return 1;
+    if (c == 0xb5 || c == 0xb6) return 1;
+    if (c >= 0xb9 && c <= 0xbc) return 1;
+    if (c >= 0xbe && c <= 0xbf) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_3:
+    if (c == 0xa1) return 1;
+    if (c == 0xa6) return 1;
+    if (c >= 0xa9 && c <= 0xac) return 1;
+    if (c == 0xaf) return 1;
+    if (c == 0xb1) return 1;
+    if (c == 0xb5 || c == 0xb6) return 1;
+    if (c >= 0xb9 && c <= 0xbc) return 1;
+    if (c == 0xbf) return 1;
+    if (c >= 0xc0 && c <= 0xc2) return 1;
+    if (c >= 0xc4 && c <= 0xcf) return 1;
+    if (c >= 0xd1 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xe2) return 1;
+    if (c >= 0xe4 && c <= 0xef) return 1;
+    if (c >= 0xf1 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_4:
+    if (c >= 0xa1 && c <= 0xa3) return 1;
+    if (c == 0xa5 || c == 0xa6) return 1;
+    if (c >= 0xa9 && c <= 0xac) return 1;
+    if (c == 0xae) return 1;
+    if (c == 0xb1 || c == 0xb3) return 1;
+    if (c == 0xb5 || c == 0xb6) return 1;
+    if (c >= 0xb9 && c <= 0xbf) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_5:
+    if (c >= 0xa1 && c <= 0xcf && c != 0xad) return 1;
+    if (c >= 0xd0 && c <= 0xff && c != 0xf0 && c != 0xfd) return 1;
+    break;
+
+  case ISO_8859_6:
+    if (c >= 0xc1 && c <= 0xda) return 1;
+    if (c >= 0xe0 && c <= 0xf2) return 1;
+    break;
+
+  case ISO_8859_7:
+    if (c == 0xb6) return 1;
+    if (c >= 0xb8 && c <= 0xba) return 1;
+    if (c == 0xbc) return 1;
+    if (c >= 0xbe && c <= 0xbf) return 1;
+    if (c == 0xc0) return 1;
+    if (c >= 0xc1 && c <= 0xdb && c != 0xd2) return 1;
+    if (c >= 0xdc && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_8:
+    if (c == 0xb5) return 1;
+    if (c >= 0xe0 && c <= 0xfa) return 1;
+    break;
+
+  case ISO_8859_10:
+    if (c >= 0xa1 && c <= 0xa6) return 1;
+    if (c >= 0xa8 && c <= 0xac) return 1;
+    if (c == 0xae || c == 0xaf) return 1;
+    if (c >= 0xb1 && c <= 0xb6) return 1;
+    if (c >= 0xb8 && c <= 0xbc) return 1;
+    if (c >= 0xbe && c <= 0xff) return 1;
+    break;
+
+  case ISO_8859_11:
+    if (c >= 0xa1 && c <= 0xda) return 1;
+    if (c >= 0xdf && c <= 0xfb) return 1;
+    break;
+
+  case ISO_8859_13:
+    if (c == 0xa8) return 1;
+    if (c == 0xaa) return 1;
+    if (c == 0xaf) return 1;
+    if (c == 0xb5) return 1;
+    if (c == 0xb8) return 1;
+    if (c == 0xba) return 1;
+    if (c >= 0xbf && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_14:
+    if (c == 0xa1 || c == 0xa2) return 1;
+    if (c == 0xa4 || c == 0xa5) return 1;
+    if (c == 0xa6 || c == 0xa8) return 1;
+    if (c >= 0xaa && c <= 0xac) return 1;
+    if (c >= 0xaf && c <= 0xb5) return 1;
+    if (c >= 0xb7 && c <= 0xff) return 1;
+    break;
+
+  case ISO_8859_15:
+    if (c == 0xaa) return 1;
+    if (c == 0xb5) return 1;
+    if (c == 0xba) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xff) return 1;
+    if (c == 0xa6) return 1;
+    if (c == 0xa8) return 1;
+    if (c == 0xb4) return 1;
+    if (c == 0xb8) return 1;
+    if (c == 0xbc) return 1;
+    if (c == 0xbd) return 1;
+    if (c == 0xbe) return 1;
+    break;
+
+  case ISO_8859_16:
+    if (c == 0xa1) return 1;
+    if (c == 0xa2) return 1;
+    if (c == 0xa3) return 1;
+    if (c == 0xa6) return 1;
+    if (c == 0xa8) return 1;
+    if (c == 0xaa) return 1;
+    if (c == 0xac) return 1;
+    if (c == 0xae) return 1;
+    if (c == 0xaf) return 1;
+    if (c == 0xb2) return 1;
+    if (c == 0xb3) return 1;
+    if (c == 0xb4) return 1;
+    if (c >= 0xb8 && c <= 0xba) return 1;
+    if (c == 0xbc) return 1;
+    if (c == 0xbd) return 1;
+    if (c == 0xbe) return 1;
+    if (c == 0xbf) return 1;
+    if (c >= 0xc0 && c <= 0xde) return 1;
+    if (c >= 0xdf && c <= 0xff) return 1;
+    break;
+
+  case KOI8_R:
+    if (c == 0xa3 || c == 0xb3) return 1;
+    /* fall */
+  case KOI8:
+    if (c >= 0xc0 && c <= 0xff) return 1;
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsBlank(int enc, int c)
+{
+  if (c == 0x09        || c == 0x20) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_2:
+  case ISO_8859_3:
+  case ISO_8859_4:
+  case ISO_8859_5:
+  case ISO_8859_6:
+  case ISO_8859_7:
+  case ISO_8859_8:
+  case ISO_8859_9:
+  case ISO_8859_10:
+  case ISO_8859_11:
+  case ISO_8859_13:
+  case ISO_8859_14:
+  case ISO_8859_15:
+  case ISO_8859_16:
+  case KOI8:
+    if (c == 0xa0) return 1;
+    break;
+
+  case KOI8_R:
+    if (c == 0x9a) return 1;
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsCntrl(int enc, int c)
+{
+  if (c >= 0x00        && c <= 0x1F) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_2:
+  case ISO_8859_3:
+  case ISO_8859_4:
+  case ISO_8859_5:
+  case ISO_8859_6:
+  case ISO_8859_7:
+  case ISO_8859_8:
+  case ISO_8859_9:
+  case ISO_8859_10:
+  case ISO_8859_11:
+  case ISO_8859_13:
+  case ISO_8859_14:
+  case ISO_8859_15:
+  case ISO_8859_16:
+  case KOI8:
+    if (c >= 0x7f && c <= 0x9F) return 1;
+    break;
+
+  case KOI8_R:
+    if (c == 0x7f) return 1;
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsDigit(int enc, int c)
+{
+  if (c >= 0x30 && c <= 0x39) return 1;
+  return 0;
+}
+
+static int IsGraph(int enc, int c)
+{
+  if (c >= 0x21 && c <= 0x7e) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_2:
+  case ISO_8859_4:
+  case ISO_8859_5:
+  case ISO_8859_9:
+  case ISO_8859_10:
+  case ISO_8859_13:
+  case ISO_8859_14:
+  case ISO_8859_15:
+  case ISO_8859_16:
+    if (c >= 0xa1 && c <= 0xff) return 1;
+    break;
+
+  case ISO_8859_3:
+    if (c >= 0xa1) {
+      if (c == 0xa5 || c == 0xae || c == 0xbe || c == 0xc3 || c == 0xd0 ||
+         c == 0xe3 || c == 0xf0)
+       return 0;
+      else
+       return 1;
+    }
+    break;
+
+  case ISO_8859_6:
+    if (c == 0xa4 || c == 0xac || c == 0xad || c == 0xbb || c == 0xbf)
+      return 1;
+    if (c >= 0xc1 && c <= 0xda) return 1;
+    if (c >= 0xe0 && c <= 0xf2) return 1;
+    break;
+
+  case ISO_8859_7:
+    if (c >= 0xa1 && c <= 0xfe &&
+       c != 0xa4 && c != 0xa5 && c != 0xaa &&
+       c != 0xae && c != 0xd2) return 1;
+    break;
+
+  case ISO_8859_8:
+    if (c >= 0xa2 && c <= 0xfa) {
+      if (c >= 0xbf && c <= 0xde) return 0;
+      return 1;
+    }
+    break;
+
+  case ISO_8859_11:
+    if (c >= 0xa1 && c <= 0xda) return 1;
+    if (c >= 0xdf && c <= 0xfb) return 1;
+    break;
+
+  case KOI8:
+    if (c >= 0xc0 && c <= 0xff) return 1;
+    break;
+
+  case KOI8_R:
+    if (c >= 0x80 && c <= 0xff && c != 0x9a) return 1;
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsLower(int enc, int c)
+{
+  if (c >= 0x61 && c <= 0x7a) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_9:
+    if (c == 0xaa) return 1;
+    if (c == 0xb5) return 1;
+    if (c == 0xba) return 1;
+    if (c >= 0xdf && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xff) return 1;
+    break;
+
+  case ISO_8859_2:
+    if (c == 0xb1 || c == 0xb3) return 1;
+    if (c == 0xb5 || c == 0xb6) return 1;
+    if (c >= 0xb9 && c <= 0xbc) return 1;
+    if (c >= 0xbe && c <= 0xbf) return 1;
+    if (c >= 0xdf && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_3:
+    if (c == 0xb1) return 1;
+    if (c == 0xb5 || c == 0xb6) return 1;
+    if (c >= 0xb9 && c <= 0xbc) return 1;
+    if (c == 0xbf) return 1;
+    if (c == 0xdf) return 1;
+    if (c >= 0xe0 && c <= 0xe2) return 1;
+    if (c >= 0xe4 && c <= 0xef) return 1;
+    if (c >= 0xf1 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_4:
+    if (c == 0xa2) return 1;
+    if (c == 0xb1 || c == 0xb3) return 1;
+    if (c == 0xb5 || c == 0xb6) return 1;
+    if (c >= 0xb9 && c <= 0xbc) return 1;
+    if (c >= 0xbe && c <= 0xbf) return 1;
+    if (c == 0xdf) return 1;
+    if (c >= 0xe0 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_5:
+    if (c >= 0xd0 && c <= 0xff && c != 0xf0 && c != 0xfd) return 1;
+    break;
+
+  case ISO_8859_6:
+    break;
+
+  case ISO_8859_7:
+    if (c == 0xc0) return 1;
+    if (c >= 0xdc && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_8:
+    if (c == 0xb5) return 1;
+    break;
+
+  case ISO_8859_10:
+    if (c >= 0xb1 && c <= 0xb6) return 1;
+    if (c >= 0xb8 && c <= 0xbc) return 1;
+    if (c == 0xbe || c == 0xbf) return 1;
+    if (c >= 0xdf && c <= 0xff) return 1;
+    break;
+
+  case ISO_8859_11:
+    break;
+
+  case ISO_8859_13:
+    if (c == 0xb5) return 1;
+    if (c == 0xb8) return 1;
+    if (c == 0xba) return 1;
+    if (c == 0xbf) return 1;
+    if (c >= 0xdf && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_14:
+    if (c == 0xa2) return 1;
+    if (c == 0xa5) return 1;
+    if (c == 0xab) return 1;
+    if (c == 0xb1 || c == 0xb3 || c == 0xb5) return 1;
+    if (c >= 0xb8 && c <= 0xba) return 1;
+    if (c == 0xbc) return 1;
+    if (c == 0xbe || c == 0xbf) return 1;
+    if (c >= 0xdf && c <= 0xff) return 1;
+    break;
+
+  case ISO_8859_15:
+    if (c == 0xaa) return 1;
+    if (c == 0xb5) return 1;
+    if (c == 0xba) return 1;
+    if (c >= 0xdf && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xff) return 1;
+    if (c == 0xa8) return 1;
+    if (c == 0xb8) return 1;
+    if (c == 0xbd) return 1;
+    break;
+
+  case ISO_8859_16:
+    if (c == 0xa2) return 1;
+    if (c == 0xa8) return 1;
+    if (c == 0xae) return 1;
+    if (c == 0xb3) return 1;
+    if (c >= 0xb8 && c <= 0xba) return 1;
+    if (c == 0xbd) return 1;
+    if (c == 0xbf) return 1;
+    if (c >= 0xdf && c <= 0xff) return 1;
+    break;
+
+  case KOI8_R:
+    if (c == 0xa3) return 1;
+    /* fall */
+  case KOI8:
+    if (c >= 0xc0 && c <= 0xdf) return 1;
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsPrint(int enc, int c)
+{
+  if (c >= 0x20 && c <= 0x7e) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_2:
+  case ISO_8859_4:
+  case ISO_8859_5:
+  case ISO_8859_9:
+  case ISO_8859_10:
+  case ISO_8859_13:
+  case ISO_8859_14:
+  case ISO_8859_15:
+  case ISO_8859_16:
+    if (c >= 0xa0 && c <= 0xff) return 1;
+    break;
+
+  case ISO_8859_3:
+    if (c >= 0xa0) {
+      if (c == 0xa5 || c == 0xae || c == 0xbe || c == 0xc3 || c == 0xd0 ||
+         c == 0xe3 || c == 0xf0)
+       return 0;
+      else
+       return 1;
+    }
+    break;
+
+  case ISO_8859_6:
+    if (c == 0xa0) return 1;
+    if (c == 0xa4 || c == 0xac || c == 0xad || c == 0xbb || c == 0xbf)
+      return 1;
+    if (c >= 0xc1 && c <= 0xda) return 1;
+    if (c >= 0xe0 && c <= 0xf2) return 1;
+    break;
+
+  case ISO_8859_7:
+    if (c >= 0xa0 && c <= 0xfe &&
+       c != 0xa4 && c != 0xa5 && c != 0xaa &&
+       c != 0xae && c != 0xd2) return 1;
+    break;
+
+  case ISO_8859_8:
+    if (c >= 0xa0 && c <= 0xfa) {
+      if (c >= 0xbf && c <= 0xde) return 0;
+      if (c == 0xa1) return 0;
+      return 1;
+    }
+    break;
+
+  case ISO_8859_11:
+    if (c >= 0xa0 && c <= 0xda) return 1;
+    if (c >= 0xdf && c <= 0xfb) return 1;
+    break;
+
+  case KOI8:
+    if (c == 0xa0) return 1;
+    if (c >= 0xc0 && c <= 0xff) return 1;
+    break;
+
+  case KOI8_R:
+    if (c >= 0x80 && c <= 0xff) return 1;
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsPunct(int enc, int c)
+{
+#ifndef BY_UNICODE_PROPERTY
+  if (c == 0x24 || c == 0x2b || c == 0x5e || c == 0x60 ||
+      c == 0x7c || c == 0x7e) return 1;
+  if (c >= 0x3c && c <= 0x3e) return 1;
+#endif
+
+  if (c >= 0x21 && c <= 0x23) return 1;
+  if (c >= 0x25 && c <= 0x2a) return 1;
+  if (c >= 0x2c && c <= 0x2f) return 1;
+  if (c >= 0x3a && c <= 0x3b) return 1;
+  if (c >= 0x3f && c <= 0x40) return 1;
+  if (c >= 0x5b && c <= 0x5d) return 1;
+  if (c == 0x5f) return 1;
+  if (c == 0x7b) return 1;
+  if (c == 0x7d) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_9:
+  case ISO_8859_15:
+    if (c == 0xa1) return 1;
+    if (c == 0xab) return 1;
+    if (c == 0xad) return 1;
+    if (c == 0xb7) return 1;
+    if (c == 0xbb) return 1;
+    if (c == 0xbf) return 1;
+    break;
+
+  case ISO_8859_2:
+  case ISO_8859_4:
+  case ISO_8859_5:
+  case ISO_8859_14:
+    if (c == 0xad) return 1;
+    break;
+
+  case ISO_8859_3:
+  case ISO_8859_10:
+    if (c == 0xad) return 1;
+    if (c == 0xb7) return 1;
+    if (c == 0xbd) return 1;
+    break;
+
+  case ISO_8859_6:
+    if (c == 0xac) return 1;
+    if (c == 0xad) return 1;
+    if (c == 0xbb) return 1;
+    if (c == 0xbf) return 1;
+    break;
+
+  case ISO_8859_7:
+    if (c == 0xa1 || c == 0xa2) return 1;
+    if (c == 0xab) return 1;
+    if (c == 0xaf) return 1;
+    if (c == 0xad) return 1;
+    if (c == 0xb7 || c == 0xbb) return 1;
+    break;
+
+  case ISO_8859_8:
+    if (c == 0xab) return 1;
+    if (c == 0xad) return 1;
+    if (c == 0xb7) return 1;
+    if (c == 0xbb) return 1;
+    if (c == 0xdf) return 1;
+    break;
+
+  case ISO_8859_13:
+    if (c == 0xa1 || c == 0xa5) return 1;
+    if (c == 0xab || c == 0xad) return 1;
+    if (c == 0xb4 || c == 0xb7) return 1;
+    if (c == 0xbb) return 1;
+    if (c == 0xff) return 1;
+    break;
+
+  case ISO_8859_16:
+    if (c == 0xa5) return 1;
+    if (c == 0xab) return 1;
+    if (c == 0xad) return 1;
+    if (c == 0xb5) return 1;
+    if (c == 0xb7) return 1;
+    if (c == 0xbb) return 1;
+    break;
+
+  case KOI8_R:
+    if (c == 0x9e) return 1;
+    break;
+
+  case ISO_8859_11:
+  case KOI8:
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsSpace(int enc, int c)
+{
+  if (c >= 0x09 && c <= 0x0d) return 1;
+  if (c == 0x20) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_2:
+  case ISO_8859_3:
+  case ISO_8859_4:
+  case ISO_8859_5:
+  case ISO_8859_6:
+  case ISO_8859_7:
+  case ISO_8859_8:
+  case ISO_8859_9:
+  case ISO_8859_10:
+  case ISO_8859_11:
+  case ISO_8859_13:
+  case ISO_8859_14:
+  case ISO_8859_15:
+  case ISO_8859_16:
+  case KOI8:
+    if (c == 0xa0) return 1;
+    break;
+
+  case KOI8_R:
+    if (c == 0x9a) return 1;
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsUpper(int enc, int c)
+{
+  if (c >= 0x41 && c <= 0x5a) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_9:
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xde) return 1;
+    break;
+
+  case ISO_8859_2:
+    if (c == 0xa1 || c == 0xa3) return 1;
+    if (c == 0xa5 || c == 0xa6) return 1;
+    if (c >= 0xa9 && c <= 0xac) return 1;
+    if (c >= 0xae && c <= 0xaf) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xde) return 1;
+    break;
+
+  case ISO_8859_3:
+    if (c == 0xa1) return 1;
+    if (c == 0xa6) return 1;
+    if (c >= 0xa9 && c <= 0xac) return 1;
+    if (c == 0xaf) return 1;
+    if (c >= 0xc0 && c <= 0xc2) return 1;
+    if (c >= 0xc4 && c <= 0xcf) return 1;
+    if (c >= 0xd1 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xde) return 1;
+    break;
+
+  case ISO_8859_4:
+    if (c == 0xa1 || c == 0xa3) return 1;
+    if (c == 0xa5 || c == 0xa6) return 1;
+    if (c >= 0xa9 && c <= 0xac) return 1;
+    if (c == 0xae) return 1;
+    if (c == 0xbd) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xde) return 1;
+    break;
+
+  case ISO_8859_5:
+    if (c >= 0xa1 && c <= 0xcf && c != 0xad) return 1;
+    break;
+
+  case ISO_8859_6:
+    break;
+
+  case ISO_8859_7:
+    if (c == 0xb6) return 1;
+    if (c >= 0xb8 && c <= 0xba) return 1;
+    if (c == 0xbc) return 1;
+    if (c >= 0xbe && c <= 0xbf) return 1;
+    if (c >= 0xc1 && c <= 0xdb && c != 0xd2) return 1;
+    break;
+
+  case ISO_8859_8:
+  case ISO_8859_11:
+    break;
+
+  case ISO_8859_10:
+    if (c >= 0xa1 && c <= 0xa6) return 1;
+    if (c >= 0xa8 && c <= 0xac) return 1;
+    if (c == 0xae || c == 0xaf) return 1;
+    if (c >= 0xc0 && c <= 0xde) return 1;
+    break;
+
+  case ISO_8859_13:
+    if (c == 0xa8) return 1;
+    if (c == 0xaa) return 1;
+    if (c == 0xaf) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xde) return 1;
+    break;
+
+  case ISO_8859_14:
+    if (c == 0xa1) return 1;
+    if (c == 0xa4 || c == 0xa6) return 1;
+    if (c == 0xa8) return 1;
+    if (c == 0xaa || c == 0xac) return 1;
+    if (c == 0xaf || c == 0xb0) return 1;
+    if (c == 0xb2 || c == 0xb4 || c == 0xb7) return 1;
+    if (c == 0xbb || c == 0xbd) return 1;
+    if (c >= 0xc0 && c <= 0xde) return 1;
+    break;
+
+  case ISO_8859_15:
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xde) return 1;
+    if (c == 0xa6) return 1;
+    if (c == 0xb4) return 1;
+    if (c == 0xbc) return 1;
+    if (c == 0xbe) return 1;
+    break;
+
+  case ISO_8859_16:
+    if (c == 0xa1) return 1;
+    if (c == 0xa3) return 1;
+    if (c == 0xa6) return 1;
+    if (c == 0xaa) return 1;
+    if (c == 0xac) return 1;
+    if (c == 0xaf) return 1;
+    if (c == 0xb2) return 1;
+    if (c == 0xb4) return 1;
+    if (c == 0xbc) return 1;
+    if (c == 0xbe) return 1;
+    if (c >= 0xc0 && c <= 0xde) return 1;
+    break;
+
+  case KOI8_R:
+    if (c == 0xb3) return 1;
+    /* fall */
+  case KOI8:
+    if (c >= 0xe0 && c <= 0xff) return 1;
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsXDigit(int enc, int c)
+{
+  if (c >= 0x30 && c <= 0x39) return 1;
+  if (c >= 0x41 && c <= 0x46) return 1;
+  if (c >= 0x61 && c <= 0x66) return 1;
+  return 0;
+}
+
+static int IsWord(int enc, int c)
+{
+  if (c >= 0x30 && c <= 0x39) return 1;
+  if (c >= 0x41 && c <= 0x5a) return 1;
+  if (c == 0x5f) return 1;
+  if (c >= 0x61 && c <= 0x7a) return 1;
+
+  switch (enc) {
+  case ISO_8859_1:
+  case ISO_8859_9:
+    if (c == 0xaa) return 1;
+    if (c >= 0xb2 && c <= 0xb3) return 1;
+    if (c == 0xb5) return 1;
+    if (c >= 0xb9 && c <= 0xba) return 1;
+    if (c >= 0xbc && c <= 0xbe) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xff) return 1;
+    break;
+
+  case ISO_8859_2:
+    if (c == 0xa1 || c == 0xa3) return 1;
+    if (c == 0xa5 || c == 0xa6) return 1;
+    if (c >= 0xa9 && c <= 0xac) return 1;
+    if (c >= 0xae && c <= 0xaf) return 1;
+    if (c == 0xb1 || c == 0xb3) return 1;
+    if (c == 0xb5 || c == 0xb6) return 1;
+    if (c >= 0xb9 && c <= 0xbc) return 1;
+    if (c >= 0xbe && c <= 0xbf) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_3:
+    if (c == 0xa1) return 1;
+    if (c == 0xa6) return 1;
+    if (c >= 0xa9 && c <= 0xac) return 1;
+    if (c == 0xaf) return 1;
+    if (c >= 0xb1 && c <= 0xb3) return 1;
+    if (c == 0xb5 || c == 0xb6) return 1;
+    if (c >= 0xb9 && c <= 0xbd) return 1;
+    if (c == 0xbf) return 1;
+    if (c >= 0xc0 && c <= 0xc2) return 1;
+    if (c >= 0xc4 && c <= 0xcf) return 1;
+    if (c >= 0xd1 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xe2) return 1;
+    if (c >= 0xe4 && c <= 0xef) return 1;
+    if (c >= 0xf1 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_4:
+    if (c >= 0xa1 && c <= 0xa3) return 1;
+    if (c == 0xa5 || c == 0xa6) return 1;
+    if (c >= 0xa9 && c <= 0xac) return 1;
+    if (c == 0xae) return 1;
+    if (c == 0xb1 || c == 0xb3) return 1;
+    if (c == 0xb5 || c == 0xb6) return 1;
+    if (c >= 0xb9 && c <= 0xbf) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_5:
+    if (c >= 0xa1 && c <= 0xcf && c != 0xad) return 1;
+    if (c >= 0xd0 && c <= 0xff && c != 0xf0 && c != 0xfd) return 1;
+    break;
+
+  case ISO_8859_6:
+    if (c >= 0xc1 && c <= 0xda) return 1;
+    if (c >= 0xe0 && c <= 0xea) return 1;
+    if (c >= 0xeb && c <= 0xf2) return 1;
+    break;
+
+  case ISO_8859_7:
+    if (c == 0xb2 || c == 0xb3) return 1;
+    if (c == 0xb6) return 1;
+    if (c >= 0xb8 && c <= 0xba) return 1;
+    if (c >= 0xbc && c <= 0xbf) return 1;
+    if (c == 0xc0) return 1;
+    if (c >= 0xc1 && c <= 0xdb && c != 0xd2) return 1;
+    if (c >= 0xdc && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_8:
+    if (c == 0xb2 || c == 0xb3 || c == 0xb5 || c == 0xb9) return 1;
+    if (c >= 0xbc && c <= 0xbe) return 1;
+    if (c >= 0xe0 && c <= 0xfa) return 1;
+    break;
+
+  case ISO_8859_10:
+    if (c >= 0xa1 && c <= 0xff) {
+      if (c != 0xa7 && c != 0xad && c != 0xb0 && c != 0xb7 && c != 0xbd)
+       return 1;
+    }
+    break;
+
+  case ISO_8859_11:
+    if (c >= 0xa1 && c <= 0xda) return 1;
+    if (c >= 0xdf && c <= 0xfb) return 1;
+    break;
+
+  case ISO_8859_13:
+    if (c == 0xa8) return 1;
+    if (c == 0xaa) return 1;
+    if (c == 0xaf) return 1;
+    if (c == 0xb2 || c == 0xb3 || c == 0xb5 || c == 0xb9) return 1;
+    if (c >= 0xbc && c <= 0xbe) return 1;
+    if (c == 0xb8) return 1;
+    if (c == 0xba) return 1;
+    if (c >= 0xbf && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xfe) return 1;
+    break;
+
+  case ISO_8859_14:
+    if (c >= 0xa1 && c <= 0xff) {
+      if (c == 0xa3 || c == 0xa7 || c == 0xa9 || c == 0xad || c == 0xae ||
+         c == 0xb6) return 0;
+      return 1;
+    }
+    break;
+
+  case ISO_8859_15:
+    if (c == 0xaa) return 1;
+    if (c >= 0xb2 && c <= 0xb3) return 1;
+    if (c == 0xb5) return 1;
+    if (c >= 0xb9 && c <= 0xba) return 1;
+    if (c >= 0xbc && c <= 0xbe) return 1;
+    if (c >= 0xc0 && c <= 0xd6) return 1;
+    if (c >= 0xd8 && c <= 0xf6) return 1;
+    if (c >= 0xf8 && c <= 0xff) return 1;
+    if (c == 0xa6) return 1;
+    if (c == 0xa8) return 1;
+    if (c == 0xb4) return 1;
+    if (c == 0xb8) return 1;
+    break;
+
+  case ISO_8859_16:
+    if (c == 0xa1) return 1;
+    if (c == 0xa2) return 1;
+    if (c == 0xa3) return 1;
+    if (c == 0xa6) return 1;
+    if (c == 0xa8) return 1;
+    if (c == 0xaa) return 1;
+    if (c == 0xac) return 1;
+    if (c == 0xae) return 1;
+    if (c == 0xaf) return 1;
+    if (c == 0xb2) return 1;
+    if (c == 0xb3) return 1;
+    if (c == 0xb4) return 1;
+    if (c >= 0xb8 && c <= 0xba) return 1;
+    if (c == 0xbc) return 1;
+    if (c == 0xbd) return 1;
+    if (c == 0xbe) return 1;
+    if (c == 0xbf) return 1;
+    if (c >= 0xc0 && c <= 0xde) return 1;
+    if (c >= 0xdf && c <= 0xff) return 1;
+    break;
+
+  case KOI8_R:
+    if (c == 0x9d) return 1;
+    if (c == 0xa3 || c == 0xb3) return 1;
+    /* fall */
+  case KOI8:
+    if (c >= 0xc0 && c <= 0xff) return 1;
+    break;
+
+  default:
+    exit(-1);
+  }
+
+  return 0;
+}
+
+static int IsAscii(int enc, int c)
+{
+  if (c >= 0x00 && c <= 0x7f) return 1;
+  return 0;
+}
+
+static int exec(FILE* fp, ENC_INFO* einfo)
+{
+#define NCOL  8
+
+  int c, val, enc;
+
+  enc = einfo->num;
+
+  fprintf(fp, "static unsigned short Enc%s_CtypeTable[256] = {\n",
+         einfo->name);
+
+  for (c = 0; c < 256; c++) {
+    val = 0;
+    if (IsAlpha (enc, c))  val |= ONIGENC_CTYPE_ALPHA;
+    if (IsBlank (enc, c))  val |= ONIGENC_CTYPE_BLANK;
+    if (IsCntrl (enc, c))  val |= ONIGENC_CTYPE_CNTRL;
+    if (IsDigit (enc, c))  val |= ONIGENC_CTYPE_DIGIT;
+    if (IsGraph (enc, c))  val |= ONIGENC_CTYPE_GRAPH;
+    if (IsLower (enc, c))  val |= ONIGENC_CTYPE_LOWER;
+    if (IsPrint (enc, c))  val |= ONIGENC_CTYPE_PRINT;
+    if (IsPunct (enc, c))  val |= ONIGENC_CTYPE_PUNCT;
+    if (IsSpace (enc, c))  val |= ONIGENC_CTYPE_SPACE;
+    if (IsUpper (enc, c))  val |= ONIGENC_CTYPE_UPPER;
+    if (IsXDigit(enc, c))  val |= ONIGENC_CTYPE_XDIGIT;
+    if (IsWord  (enc, c))  val |= ONIGENC_CTYPE_WORD;
+    if (IsAscii (enc, c))  val |= ONIGENC_CTYPE_ASCII;
+
+    if (c % NCOL == 0) fputs("  ", fp);
+    fprintf(fp, "0x%04x", val);
+    if (c != 255) fputs(",", fp);
+    if (c != 0 && c % NCOL == (NCOL-1))
+      fputs("\n", fp);
+    else
+      fputs(" ", fp);
+  }
+  fprintf(fp, "};\n");
+  return 0;
+}
+
+extern int main(int argc, char* argv[])
+{
+  int i;
+  FILE* fp = stdout;
+
+  for (i = 0; i < sizeof(Info)/sizeof(ENC_INFO); i++) {
+    exec(fp, &Info[i]);
+  }
+}
diff --git a/ext/mbstring/oniguruma/enc/sjis.c b/ext/mbstring/oniguruma/enc/sjis.c
new file mode 100644 (file)
index 0000000..2d54faa
--- /dev/null
@@ -0,0 +1,174 @@
+/**********************************************************************
+
+  sjis.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2003-2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+static const char SJIS_CAN_BE_TRAIL_TABLE[256] = {
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0
+};
+
+#define SJIS_ISMB_FIRST(byte)  (OnigEncodingSJIS.len_table[byte] > 1)
+#define SJIS_ISMB_TRAIL(byte)  SJIS_CAN_BE_TRAIL_TABLE[(byte)]
+
+static OnigCodePoint
+sjis_mbc_to_code(UChar* p, UChar* end)
+{
+  int c, i, len;
+  OnigCodePoint n;
+
+  c = *p++;
+  len = enc_len(ONIG_ENCODING_SJIS, c);
+  n = c;
+  if (len == 1) return n;
+
+  for (i = 1; i < len; i++) {
+    if (p >= end) break;
+    c = *p++;
+    n <<= 8;  n += c;
+  }
+  return n;
+}
+
+static int
+sjis_code_to_mbc(OnigCodePoint code, UChar *buf)
+{
+  UChar *p = buf;
+
+  if ((code & 0xff00) != 0) *p++ = ((code >>  8) & 0xff);
+  *p++ = (code & 0xff);
+
+#if 0
+  if (enc_len(ONIG_ENCODING_SJIS, buf[0]) != (p - buf))
+    return REGERR_INVALID_WIDE_CHAR_VALUE;
+#endif
+  return p - buf;
+}
+
+static int
+sjis_mbc_to_lower(UChar* p, UChar* lower)
+{
+  int len;
+
+  if (ONIGENC_IS_MBC_ASCII(p)) {
+    *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
+    return 1;
+  }
+  else {
+    len = enc_len(ONIG_ENCODING_SJIS, *p);
+    if (lower != p) {
+      /* memcpy(lower, p, len); */
+      int i;
+      for (i = 0; i < len; i++) {
+       *lower++ = *p++;
+      }
+    }
+    return len; /* return byte length of converted char to lower */
+  }
+}
+
+static int
+sjis_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if ((ctype & ONIGENC_CTYPE_WORD) != 0) {
+    if (code < 128)
+      return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
+    else {
+      int first = onigenc_mb2_code_to_mbc_first(code);
+      return (enc_len(ONIG_ENCODING_SJIS, first) > 1 ? TRUE : FALSE);
+    }
+
+    ctype &= ~ONIGENC_CTYPE_WORD;
+    if (ctype == 0) return FALSE;
+  }
+
+  if (code < 128)
+    return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
+  else
+    return FALSE;
+}
+
+static UChar*
+sjis_left_adjust_char_head(UChar* start, UChar* s)
+{
+  UChar *p;
+  int len;
+
+  if (s <= start) return s;
+  p = s;
+
+  if (SJIS_ISMB_TRAIL(*p)) {
+    while (p > start) {
+      if (! SJIS_ISMB_FIRST(*--p)) {
+       p++;
+       break;
+      }
+    } 
+  }
+  len = enc_len(ONIG_ENCODING_SJIS, *p);
+  if (p + len > s) return p;
+  p += len;
+  return p + ((s - p) & ~1);
+}
+
+static int
+sjis_is_allowed_reverse_match(UChar* s, UChar* end)
+{
+  UChar c = *s;
+  return (SJIS_ISMB_TRAIL(c) ? FALSE : TRUE);
+}
+
+OnigEncodingType OnigEncodingSJIS = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1
+  },
+  "Shift_JIS",   /* name */
+  2,             /* max byte length */
+  FALSE,         /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_SB,     /* ctype_support_level */
+  FALSE,         /* is continuous sb mb codepoint */
+  sjis_mbc_to_code,
+  onigenc_mb2_code_to_mbclen,
+  sjis_code_to_mbc,
+  sjis_mbc_to_lower,
+  onigenc_mbn_mbc_is_case_ambig,
+  sjis_code_is_ctype,
+  onigenc_nothing_get_ctype_code_range,
+  sjis_left_adjust_char_head,
+  sjis_is_allowed_reverse_match,
+  onigenc_nothing_get_all_fold_match_code,
+  onigenc_nothing_get_fold_match_info
+};
diff --git a/ext/mbstring/oniguruma/enc/utf8.c b/ext/mbstring/oniguruma/enc/utf8.c
new file mode 100644 (file)
index 0000000..6f7ef0f
--- /dev/null
@@ -0,0 +1,566 @@
+/**********************************************************************
+
+  utf8.c -  Oniguruma (regular expression library)
+
+  Copyright (C) 2003-2004  K.Kosako (kosako@sofnec.co.jp)
+
+**********************************************************************/
+#include "regenc.h"
+
+#define utf8_islead(c)     ((UChar )((c) & 0xc0) != 0x80)
+
+#define ENC_IS_ISO_8859_1_CTYPE(code,ctype) \
+  ((EncUnicode_ISO_8859_1_CtypeTable[code] & ctype) != 0)
+
+static unsigned short EncUnicode_ISO_8859_1_CtypeTable[256] = {
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1106, 0x1104, 0x1104, 0x1104, 0x1104, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x10d0, 0x10d0, 0x1050, 0x10d0, 0x10d0, 0x10d0,
+  0x10d0, 0x10d0, 0x10d0, 0x1050, 0x10d0, 0x10d0, 0x10d0, 0x10d0,
+  0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58, 0x1c58,
+  0x1c58, 0x1c58, 0x10d0, 0x10d0, 0x1050, 0x1050, 0x1050, 0x10d0,
+  0x10d0, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1e51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x10d0, 0x10d0, 0x10d0, 0x1050, 0x18d0,
+  0x1050, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1c71, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x10d0, 0x1050, 0x10d0, 0x1050, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004,
+  0x1142, 0x10d0, 0x1050, 0x1050, 0x1050, 0x1050, 0x1050, 0x1050,
+  0x1050, 0x1050, 0x1871, 0x10d0, 0x1050, 0x10d0, 0x1050, 0x1050,
+  0x1050, 0x1050, 0x1850, 0x1850, 0x1050, 0x1871, 0x1050, 0x10d0,
+  0x1050, 0x1850, 0x1871, 0x10d0, 0x1850, 0x1850, 0x1850, 0x10d0,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1050,
+  0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1a51, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1050,
+  0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871, 0x1871
+};
+
+static OnigCodePoint
+utf8_mbc_to_code(UChar* p, UChar* end)
+{
+  int c, len;
+  OnigCodePoint n;
+
+  c = *p++;
+  len = enc_len(ONIG_ENCODING_UTF8, c);
+  if (len > 1) {
+    len--;
+    n = c & ((1 << (6 - len)) - 1);
+    while (len--) {
+      c = *p++;
+      n = (n << 6) | (c & ((1 << 6) - 1));
+    }
+    return n;
+  }
+  else
+    return (OnigCodePoint )c;
+}
+
+static int
+utf8_code_to_mbclen(OnigCodePoint code)
+{
+  if      ((code & 0xffffff80) == 0) return 1;
+  else if ((code & 0xfffff800) == 0) {
+    if (code <= 0xff && code >= 0xfe)
+      return 1;
+    return 2;
+  }
+  else if ((code & 0xffff0000) == 0) return 3;
+  else if ((code & 0xffe00000) == 0) return 4;
+  else if ((code & 0xfc000000) == 0) return 5;
+  else if ((code & 0x80000000) == 0) return 6;
+  else
+    return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
+}
+
+#if 0
+static int
+utf8_code_to_mbc_first(OnigCodePoint code)
+{
+  if ((code & 0xffffff80) == 0)
+    return code;
+  else {
+    if ((code & 0xfffff800) == 0)
+      return ((code>>6)& 0x1f) | 0xc0;
+    else if ((code & 0xffff0000) == 0)
+      return ((code>>12) & 0x0f) | 0xe0;
+    else if ((code & 0xffe00000) == 0)
+      return ((code>>18) & 0x07) | 0xf0;
+    else if ((code & 0xfc000000) == 0)
+      return ((code>>24) & 0x03) | 0xf8;
+    else if ((code & 0x80000000) == 0)
+      return ((code>>30) & 0x01) | 0xfc;
+    else {
+      return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
+    }
+  }
+}
+#endif
+
+static int
+utf8_code_to_mbc(OnigCodePoint code, UChar *buf)
+{
+#define UTF8_TRAILS(code, shift)   ((((code) >> (shift)) & 0x3f) | 0x80)
+#define UTF8_TRAIL0(code)          (((code) & 0x3f) | 0x80)
+
+  if ((code & 0xffffff80) == 0) {
+    *buf = code;
+    return 1;
+  }
+  else {
+    UChar *p = buf;
+
+    if ((code & 0xfffff800) == 0) {
+      *p++ = ((code>>6)& 0x1f) | 0xc0;
+    }
+    else if ((code & 0xffff0000) == 0) {
+      *p++ = ((code>>12) & 0x0f) | 0xe0;
+      *p++ = UTF8_TRAILS(code, 6);
+    }
+    else if ((code & 0xffe00000) == 0) {
+      *p++ = ((code>>18) & 0x07) | 0xf0;
+      *p++ = UTF8_TRAILS(code, 12);
+      *p++ = UTF8_TRAILS(code,  6);
+    }
+    else if ((code & 0xfc000000) == 0) {
+      *p++ = ((code>>24) & 0x03) | 0xf8;
+      *p++ = UTF8_TRAILS(code, 18);
+      *p++ = UTF8_TRAILS(code, 12);
+      *p++ = UTF8_TRAILS(code,  6);
+    }
+    else if ((code & 0x80000000) == 0) {
+      *p++ = ((code>>30) & 0x01) | 0xfc;
+      *p++ = UTF8_TRAILS(code, 24);
+      *p++ = UTF8_TRAILS(code, 18);
+      *p++ = UTF8_TRAILS(code, 12);
+      *p++ = UTF8_TRAILS(code,  6);
+    }
+    else {
+      return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
+    }
+
+    *p++ = UTF8_TRAIL0(code);
+    return p - buf;
+  }
+}
+
+static int
+utf8_mbc_to_lower(UChar* p, UChar* lower)
+{
+  int len;
+
+  /* !!! U+0080 - U+00ff is treated by fold match. !!! */
+  if (ONIGENC_IS_MBC_ASCII(p)) {
+    *lower = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
+    return 1; /* return byte length of converted char to lower */
+  }
+  else {
+    len = enc_len(ONIG_ENCODING_UTF8, *p);
+    if (lower != p) {
+      /* memcpy(lower, p, len); */
+      int i;
+      for (i = 0; i < len; i++) {
+       *lower++ = *p++;
+      }
+    }
+    return len; /* return byte length of converted char to lower */
+  }
+}
+
+static int
+utf8_mbc_is_case_ambig(UChar* p)
+{
+  /* !!! U+0080 - U+00ff ( 0x80[0xc2,0x80] - 0xff[0xc3,0xbf] )
+     is treated by fold match. !!! */
+
+  if (ONIGENC_IS_MBC_ASCII(p))
+    return ONIGENC_IS_ASCII_CODE_CASE_AMBIG(*p);
+
+  return FALSE;
+}
+
+static int
+utf8_code_is_ctype(OnigCodePoint code, unsigned int ctype)
+{
+  if (code < 256) {
+    return ENC_IS_ISO_8859_1_CTYPE(code, ctype);
+  }
+
+  if ((ctype & ONIGENC_CTYPE_WORD) != 0) {
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+static int
+utf8_get_ctype_code_range(int ctype, int* nsb, int* nmb,
+                         OnigCodePointRange* sbr[], OnigCodePointRange* mbr[])
+{
+#define CR_SET(sbl,mbl) do { \
+  *nsb = sizeof(sbl) / sizeof(OnigCodePointRange); \
+  *nmb = sizeof(mbl) / sizeof(OnigCodePointRange); \
+  *sbr = sbl; \
+  *mbr = mbl; \
+} while (0)
+
+#define CR_SB_SET(sbl) do { \
+  *nsb = sizeof(sbl) / sizeof(OnigCodePointRange); \
+  *nmb = 0; \
+  *sbr = sbl; \
+} while (0)
+
+  static OnigCodePointRange SBAlpha[] = {
+    { 0x41, 0x5a },
+    { 0x61, 0x7a }
+  };
+
+  static OnigCodePointRange MBAlpha[] = {
+    { 0xaa, 0xaa },
+    { 0xb5, 0xb5 },
+    { 0xba, 0xba },
+    { 0xc0, 0xd6 },
+    { 0xd8, 0xf6 },
+    { 0xf8, 0x220 }
+  };
+
+  static OnigCodePointRange SBBlank[] = {
+    { 0x09, 0x09 },
+    { 0x20, 0x20 }
+  };
+
+  static OnigCodePointRange MBBlank[] = {
+    { 0xa0, 0xa0 }
+  };
+
+  static OnigCodePointRange SBCntrl[] = {
+    { 0x00, 0x1f },
+    { 0x7f, 0x7f }
+  };
+
+  static OnigCodePointRange MBCntrl[] = {
+    { 0x80, 0x9f }
+  };
+
+  static OnigCodePointRange SBDigit[] = {
+    { 0x30, 0x39 }
+  };
+
+  static OnigCodePointRange SBGraph[] = {
+    { 0x21, 0x7e }
+  };
+
+  static OnigCodePointRange MBGraph[] = {
+    { 0xa1, 0x220 }
+  };
+
+  static OnigCodePointRange SBLower[] = {
+    { 0x61, 0x7a }
+  };
+
+  static OnigCodePointRange MBLower[] = {
+    { 0xaa, 0xaa },
+    { 0xb5, 0xb5 },
+    { 0xba, 0xba },
+    { 0xdf, 0xf6 },
+    { 0xf8, 0xff }
+  };
+
+  static OnigCodePointRange SBPrint[] = {
+    { 0x20, 0x7e }
+  };
+
+  static OnigCodePointRange MBPrint[] = {
+    { 0xa0, 0x220 }
+  };
+
+  static OnigCodePointRange SBPunct[] = {
+    { 0x21, 0x23 },
+    { 0x25, 0x2a },
+    { 0x2c, 0x2f },
+    { 0x3a, 0x3b },
+    { 0x3f, 0x40 },
+    { 0x5b, 0x5d },
+    { 0x5f, 0x5f },
+    { 0x7b, 0x7b },
+    { 0x7d, 0x7d }
+  };
+
+  static OnigCodePointRange MBPunct[] = {
+    { 0xa1, 0xa1 },
+    { 0xab, 0xab },
+    { 0xad, 0xad },
+    { 0xb7, 0xb7 },
+    { 0xbb, 0xbb },
+    { 0xbf, 0xbf }
+  };
+
+  static OnigCodePointRange SBSpace[] = {
+    { 0x09, 0x0d },
+    { 0x20, 0x20 }
+  };
+
+  static OnigCodePointRange MBSpace[] = {
+    { 0xa0, 0xa0 }
+  };
+
+  static OnigCodePointRange SBUpper[] = {
+    { 0x41, 0x5a }
+  };
+
+  static OnigCodePointRange MBUpper[] = {
+    { 0xc0, 0xd6 },
+    { 0xd8, 0xde }
+  };
+
+  static OnigCodePointRange SBXDigit[] = {
+    { 0x30, 0x39 },
+    { 0x41, 0x46 },
+    { 0x61, 0x66 }
+  };
+
+  static OnigCodePointRange SBWord[] = {
+    { 0x30, 0x39 },
+    { 0x41, 0x5a },
+    { 0x5f, 0x5f },
+    { 0x61, 0x7a }
+  };
+
+  static OnigCodePointRange MBWord[] = {
+    { 0xaa, 0xaa },
+    { 0xb2, 0xb3 },
+    { 0xb5, 0xb5 },
+    { 0xb9, 0xba },
+    { 0xbc, 0xbe },
+    { 0xc0, 0xd6 },
+    { 0xd8, 0xf6 },
+#if 0
+    { 0xf8, 0x220 }
+#else
+    { 0xf8, 0x7fffffff } /* all multibyte code as word */
+#endif
+  };
+
+  static OnigCodePointRange SBAscii[] = {
+    { 0x00, 0x7f }
+  };
+
+  static OnigCodePointRange SBAlnum[] = {
+    { 0x30, 0x39 },
+    { 0x41, 0x5a },
+    { 0x61, 0x7a }
+  };
+
+  static OnigCodePointRange MBAlnum[] = {
+    { 0xaa, 0xaa },
+    { 0xb5, 0xb5 },
+    { 0xba, 0xba },
+    { 0xc0, 0xd6 },
+    { 0xd8, 0xf6 },
+    { 0xf8, 0x220 }
+  };
+
+  switch (ctype) {
+  case ONIGENC_CTYPE_ALPHA:
+    CR_SET(SBAlpha, MBAlpha);
+    break;
+  case ONIGENC_CTYPE_BLANK:
+    CR_SET(SBBlank, MBBlank);
+    break;
+  case ONIGENC_CTYPE_CNTRL:
+    CR_SET(SBCntrl, MBCntrl);
+    break;
+  case ONIGENC_CTYPE_DIGIT:
+    CR_SB_SET(SBDigit);
+    break;
+  case ONIGENC_CTYPE_GRAPH:
+    CR_SET(SBGraph, MBGraph);
+    break;
+  case ONIGENC_CTYPE_LOWER:
+    CR_SET(SBLower, MBLower);
+    break;
+  case ONIGENC_CTYPE_PRINT:
+    CR_SET(SBPrint, MBPrint);
+    break;
+  case ONIGENC_CTYPE_PUNCT:
+    CR_SET(SBPunct, MBPunct);
+    break;
+  case ONIGENC_CTYPE_SPACE:
+    CR_SET(SBSpace, MBSpace);
+    break;
+  case ONIGENC_CTYPE_UPPER:
+    CR_SET(SBUpper, MBUpper);
+    break;
+  case ONIGENC_CTYPE_XDIGIT:
+    CR_SB_SET(SBXDigit);
+    break;
+  case ONIGENC_CTYPE_WORD:
+    CR_SET(SBWord, MBWord);
+    break;
+  case ONIGENC_CTYPE_ASCII:
+    CR_SB_SET(SBAscii);
+    break;
+  case ONIGENC_CTYPE_ALNUM:
+    CR_SET(SBAlnum, MBAlnum);
+    break;
+
+  default:
+    return ONIGERR_TYPE_BUG;
+    break;
+  }
+
+  return 0;
+}
+
+static int
+utf8_get_all_fold_match_code(OnigCodePoint** codes)
+{
+  static OnigCodePoint list[] = {
+    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+    0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
+    0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+
+    0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+    0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+    0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
+    0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe,
+  };
+
+  *codes = list;
+  return sizeof(list) / sizeof(OnigCodePoint);
+}
+
+static int
+utf8_get_fold_match_info(UChar* p, UChar* end, OnigEncFoldMatchInfo** info)
+{
+  
+  static OnigEncFoldMatchInfo xc[] = {
+    { 2, { 2, 2 }, { "\303\200", "\303\240" } }, /* CodePoint 0xc0 */
+    { 2, { 2, 2 }, { "\303\201", "\303\241" } },
+    { 2, { 2, 2 }, { "\303\202", "\303\242" } },
+    { 2, { 2, 2 }, { "\303\203", "\303\243" } },
+    { 2, { 2, 2 }, { "\303\204", "\303\244" } },
+    { 2, { 2, 2 }, { "\303\205", "\303\245" } },
+    { 2, { 2, 2 }, { "\303\206", "\303\246" } },
+    { 2, { 2, 2 }, { "\303\207", "\303\247" } },
+    { 2, { 2, 2 }, { "\303\210", "\303\250" } },
+    { 2, { 2, 2 }, { "\303\211", "\303\251" } },
+    { 2, { 2, 2 }, { "\303\212", "\303\252" } },
+    { 2, { 2, 2 }, { "\303\213", "\303\253" } },
+    { 2, { 2, 2 }, { "\303\214", "\303\254" } },
+    { 2, { 2, 2 }, { "\303\215", "\303\255" } },
+    { 2, { 2, 2 }, { "\303\216", "\303\256" } },
+    { 2, { 2, 2 }, { "\303\217", "\303\257" } },
+    { 2, { 2, 2 }, { "\303\220", "\303\260" } }, /* CodePoint 0xd0 */
+    { 2, { 2, 2 }, { "\303\221", "\303\261" } },
+    { 2, { 2, 2 }, { "\303\222", "\303\262" } },
+    { 2, { 2, 2 }, { "\303\223", "\303\263" } },
+    { 2, { 2, 2 }, { "\303\224", "\303\264" } },
+    { 2, { 2, 2 }, { "\303\225", "\303\265" } },
+    { 2, { 2, 2 }, { "\303\226", "\303\266" } },
+    { 0, { 0 }, { "" } },
+    { 2, { 2, 2 }, { "\303\230", "\303\270" } },
+    { 2, { 2, 2 }, { "\303\231", "\303\271" } },
+    { 2, { 2, 2 }, { "\303\232", "\303\272" } },
+    { 2, { 2, 2 }, { "\303\233", "\303\273" } },
+    { 2, { 2, 2 }, { "\303\234", "\303\274" } },
+    { 2, { 2, 2 }, { "\303\235", "\303\275" } },
+    { 2, { 2, 2 }, { "\303\236", "\303\276" } },
+    { 3, { 2, 2, 2 }, { "\303\237", "ss", "SS" }} /* ess-tsett(U+00DF) */
+  };
+
+  if (p + 1 >= end)  return -1;
+  if (*p < 0x80) {
+    if ((*p == 'S' && *(p+1) == 'S') ||
+       (*p == 's' && *(p+1) == 's')) {
+      *info = &(xc[0xdf - 0xc0]);
+      return 2;
+    }
+  }
+  else if (*p == 195) { /* 195 == '\303' */
+    int c = *(p+1);
+    if (c >= 128) {
+      if (c <= 159) { /* upper */
+       if (c == 151) return -1; /* 0xd7 */
+       *info = &(xc[c - 128]);
+       return 2;
+      }
+      else { /* lower */
+       if (c == 183) return -1; /* 0xf7 */
+       *info = &(xc[c - 160]);
+       return 2;
+      }
+    }
+  }
+
+  return -1; /* is not a fold string. */
+}
+
+
+static UChar*
+utf8_left_adjust_char_head(UChar* start, UChar* s)
+{
+  UChar *p;
+
+  if (s <= start) return s;
+  p = s;
+
+  while (!utf8_islead(*p) && p > start) p--;
+  return p;
+}
+
+static int
+utf8_is_allowed_reverse_match(UChar* s, UChar* end)
+{
+  return TRUE;
+}
+
+OnigEncodingType OnigEncodingUTF8 = {
+  {
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+    4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
+  },
+  "UTF-8",     /* name */
+  6,           /* max byte length */
+  TRUE,        /* is_fold_match */
+  ONIGENC_CTYPE_SUPPORT_LEVEL_FULL,  /* ctype_support_level */
+  TRUE,                             /* is continuous sb mb codepoint */
+  utf8_mbc_to_code,
+  utf8_code_to_mbclen,
+  utf8_code_to_mbc,
+  utf8_mbc_to_lower,
+  utf8_mbc_is_case_ambig,
+  utf8_code_is_ctype,
+  utf8_get_ctype_code_range,
+  utf8_left_adjust_char_head,
+  utf8_is_allowed_reverse_match,
+  utf8_get_all_fold_match_code,
+  utf8_get_fold_match_info
+};