[前][次][番号順一覧][スレッド一覧]

ruby-changes:7308

From: naruse <ko1@a...>
Date: Mon, 25 Aug 2008 07:11:15 +0900 (JST)
Subject: [ruby-changes:7308] Ruby:r18827 (trunk): * enc/emacs_mule.c: fix ctype.

naruse	2008-08-25 07:10:57 +0900 (Mon, 25 Aug 2008)

  New Revision: 18827

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18827

  Log:
    * enc/emacs_mule.c: fix ctype.

  Modified files:
    trunk/ChangeLog
    trunk/enc/emacs_mule.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18826)
+++ ChangeLog	(revision 18827)
@@ -1,3 +1,7 @@
+Mon Aug 25 07:10:21 2008  NARUSE, Yui  <naruse@r...>
+
+	* enc/emacs_mule.c: fix ctype.
+
 Mon Aug 25 00:52:31 2008  Tanaka Akira  <akr@f...>
 
 	* configure.in (BUILTIN_TRANSSRCS): defined.
Index: enc/emacs_mule.c
===================================================================
--- enc/emacs_mule.c	(revision 18826)
+++ enc/emacs_mule.c	(revision 18827)
@@ -284,7 +284,7 @@
   else {
     int i;
 
-    len = enclen(enc, p, end);
+    len = mbc_enc_len(p, end, enc);
     for (i = 0; i < len; i++) {
       *lower++ = *p++;
     }
@@ -296,120 +296,24 @@
 static UChar*
 left_adjust_char_head(const UChar* start, const UChar* s, OnigEncoding enc)
 {
-  /* In this encoding
-     mb-trail bytes doesn't mix with single bytes.
-  */
   const UChar *p;
-  int len;
 
   if (s <= start) return (UChar* )s;
   p = s;
 
   while (!emacsmule_islead(*p) && p > start) p--;
-  len = enclen(enc, p, s);
-  if (p + len > s) return (UChar* )p;
-  p += len;
-  return (UChar* )(p + ((s - p) & ~1));
+  return (UChar* )p;
 }
 
 static int
-is_allowed_reverse_match(const UChar* s, const UChar* end, OnigEncoding enc ARG_UNUSED)
-{
-  return TRUE;
-}
-
-
-static int PropertyInited = 0;
-static const OnigCodePoint** PropertyList;
-static int PropertyListNum;
-static int PropertyListSize;
-static hash_table_type* PropertyNameTable;
-
-static const OnigCodePoint CR_Hiragana[] = {
-  1,
-  0xa4a1, 0xa4f3
-}; /* CR_Hiragana */
-
-static const OnigCodePoint CR_Katakana[] = {
-  3,
-  0xa5a1, 0xa5f6,
-  0xaaa6, 0xaaaf,
-  0xaab1, 0xaadd
-}; /* CR_Katakana */
-
-static int
-init_property_list(void)
-{
-  int r;
-
-  PROPERTY_LIST_ADD_PROP("Hiragana", CR_Hiragana);
-  PROPERTY_LIST_ADD_PROP("Katakana", CR_Katakana);
-  PropertyInited = 1;
-
- end:
-  return r;
-}
-
-static int
-property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
-{
-  st_data_t ctype;
-
-  PROPERTY_LIST_INIT_CHECK;
-
-  if (onig_st_lookup_strend(PropertyNameTable, p, end, &ctype) == 0) {
-    return onigenc_minimum_property_name_to_ctype(enc, p, end);
-  }
-
-  return ctype;
-}
-
-static int
 is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc ARG_UNUSED)
 {
-  if (ctype <= ONIGENC_MAX_STD_CTYPE) {
-    if (code < 128)
-      return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
-    else {
-      if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) {
-	return (code_to_mbclen(code, enc) > 1 ? TRUE : FALSE);
-      }
-    }
-  }
-  else {
-    PROPERTY_LIST_INIT_CHECK;
-
-    ctype -= (ONIGENC_MAX_STD_CTYPE + 1);
-    if (ctype >= (unsigned int )PropertyListNum)
-      return ONIGERR_TYPE_BUG;
-
-    return onig_is_in_code_range((UChar* )PropertyList[ctype], code);
-  }
-
-  return FALSE;
+  if (code < 128)
+    return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
+  else
+    return (code_to_mbclen(code, enc) > 1 ? TRUE : FALSE);
 }
 
-static int
-get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
-		     const OnigCodePoint* ranges[], OnigEncoding enc ARG_UNUSED)
-{
-  if (ctype <= ONIGENC_MAX_STD_CTYPE) {
-    return ONIG_NO_SUPPORT_CONFIG;
-  }
-  else {
-    *sb_out = 0x80;
-
-    PROPERTY_LIST_INIT_CHECK;
-
-    ctype -= (ONIGENC_MAX_STD_CTYPE + 1);
-    if (ctype >= (OnigCtype )PropertyListNum)
-      return ONIGERR_TYPE_BUG;
-
-    *ranges = PropertyList[ctype];
-    return 0;
-  }
-}
-
 /*
  * Name: Emacs-Mule
  * Link: http://www.m17n.org/mule/pricai96/mule.en.html
@@ -426,11 +330,11 @@
   mbc_case_fold,
   onigenc_ascii_apply_all_case_fold,
   onigenc_ascii_get_case_fold_codes_by_str,
-  property_name_to_ctype,
+  onigenc_minimum_property_name_to_ctype,
   is_code_ctype,
-  get_ctype_code_range,
+  onigenc_not_support_get_ctype_code_range,
   left_adjust_char_head,
-  is_allowed_reverse_match,
+  onigenc_always_true_is_allowed_reverse_match,
   0
 };
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]