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

ruby-changes:3371

From: ko1@a...
Date: 3 Jan 2008 15:13:49 +0900
Subject: [ruby-changes:3371] akr - Ruby:r14864 (trunk): * include/ruby/encoding.h (rb_isascii): simplified.

akr	2008-01-03 15:13:31 +0900 (Thu, 03 Jan 2008)

  New Revision: 14864

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/encoding.h
    trunk/include/ruby/oniguruma.h
    trunk/include/ruby/ruby.h
    trunk/regenc.h

  Log:
    * include/ruby/encoding.h (rb_isascii): simplified.
      (rb_isalnum): call onigenc_ascii_is_code_ctype without indirect call.
      (rb_isalpha): ditto.
      (rb_isblank): ditto.
      (rb_iscntrl): ditto.
      (rb_isdigit): ditto.
      (rb_isgraph): ditto.
      (rb_islower): ditto.
      (rb_isprint): ditto.
      (rb_ispunct): ditto.
      (rb_isspace): ditto.
      (rb_isupper): ditto.
      (rb_isxdigit): ditto.
    
    * include/ruby/oniguruma.h (onigenc_ascii_is_code_ctype): declaration
      moved from regenc.h.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/ruby.h?r1=14864&r2=14863&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/oniguruma.h?r1=14864&r2=14863&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14864&r2=14863&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/encoding.h?r1=14864&r2=14863&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/regenc.h?r1=14864&r2=14863&diff_format=u

Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 14863)
+++ include/ruby/ruby.h	(revision 14864)
@@ -968,6 +968,7 @@
 }  /* extern "C" { */
 #endif
 
+/* locale insensitive functions */
 #include "encoding.h"
 #ifndef ISPRINT
 #define ISASCII(c) rb_isascii((int)(unsigned char)(c))
Index: include/ruby/encoding.h
===================================================================
--- include/ruby/encoding.h	(revision 14863)
+++ include/ruby/encoding.h	(revision 14864)
@@ -136,19 +136,19 @@
 void rb_enc_set_default_external(VALUE encoding);
 VALUE rb_locale_charmap(VALUE klass);
 
-#define rb_isascii(c) ONIGENC_IS_CODE_ASCII(c)
-#define rb_isalnum(c) ONIGENC_IS_CODE_ALNUM(ONIG_ENCODING_ASCII, c)
-#define rb_isalpha(c) ONIGENC_IS_CODE_ALPHA(ONIG_ENCODING_ASCII, c)
-#define rb_isblank(c) ONIGENC_IS_CODE_BLANK(ONIG_ENCODING_ASCII, c)
-#define rb_iscntrl(c) ONIGENC_IS_CODE_CNTRL(ONIG_ENCODING_ASCII, c)
-#define rb_isdigit(c) ONIGENC_IS_CODE_DIGIT(ONIG_ENCODING_ASCII, c)
-#define rb_isgraph(c) ONIGENC_IS_CODE_GRAPH(ONIG_ENCODING_ASCII, c)
-#define rb_islower(c) ONIGENC_IS_CODE_LOWER(ONIG_ENCODING_ASCII, c)
-#define rb_isprint(c) ONIGENC_IS_CODE_PRINT(ONIG_ENCODING_ASCII, c)
-#define rb_ispunct(c) ONIGENC_IS_CODE_PUNCT(ONIG_ENCODING_ASCII, c)
-#define rb_isspace(c) ONIGENC_IS_CODE_SPACE(ONIG_ENCODING_ASCII, c)
-#define rb_isupper(c) ONIGENC_IS_CODE_UPPER(ONIG_ENCODING_ASCII, c)
-#define rb_isxdigit(c) ONIGENC_IS_CODE_XDIGIT(ONIG_ENCODING_ASCII, c)
+#define rb_isascii(c) ((unsigned long)(c) < 128)
+#define rb_isalnum(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_ALNUM, ONIG_ENCODING_ASCII)
+#define rb_isalpha(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_ALPHA, ONIG_ENCODING_ASCII)
+#define rb_isblank(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_BLANK, ONIG_ENCODING_ASCII)
+#define rb_iscntrl(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_CNTRL, ONIG_ENCODING_ASCII)
+#define rb_isdigit(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_DIGIT, ONIG_ENCODING_ASCII)
+#define rb_isgraph(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_GRAPH, ONIG_ENCODING_ASCII)
+#define rb_islower(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_LOWER, ONIG_ENCODING_ASCII)
+#define rb_isprint(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_PRINT, ONIG_ENCODING_ASCII)
+#define rb_ispunct(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_PUNCT, ONIG_ENCODING_ASCII)
+#define rb_isspace(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_SPACE, ONIG_ENCODING_ASCII)
+#define rb_isupper(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_UPPER, ONIG_ENCODING_ASCII)
+#define rb_isxdigit(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_XDIGIT, ONIG_ENCODING_ASCII)
 #define rb_tolower(c) rb_enc_tolower(c, ONIG_ENCODING_ASCII)
 #define rb_toupper(c) rb_enc_toupper(c, ONIG_ENCODING_ASCII)
 
Index: include/ruby/oniguruma.h
===================================================================
--- include/ruby/oniguruma.h	(revision 14863)
+++ include/ruby/oniguruma.h	(revision 14864)
@@ -380,6 +380,8 @@
 ONIG_EXTERN
 int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p));
 
+ONIG_EXTERN
+int onigenc_ascii_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc));
 
 
 /* PART: regular expression */
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14863)
+++ ChangeLog	(revision 14864)
@@ -1,3 +1,22 @@
+Thu Jan  3 15:10:26 2008  Tanaka Akira  <akr@f...>
+
+	* include/ruby/encoding.h (rb_isascii): simplified.
+	  (rb_isalnum): call onigenc_ascii_is_code_ctype without indirect call.
+	  (rb_isalpha): ditto.
+	  (rb_isblank): ditto.
+	  (rb_iscntrl): ditto.
+	  (rb_isdigit): ditto.
+	  (rb_isgraph): ditto.
+	  (rb_islower): ditto.
+	  (rb_isprint): ditto.
+	  (rb_ispunct): ditto.
+	  (rb_isspace): ditto.
+	  (rb_isupper): ditto.
+	  (rb_isxdigit): ditto.
+
+	* include/ruby/oniguruma.h (onigenc_ascii_is_code_ctype): declaration
+	  moved from regenc.h.
+
 Thu Jan  3 14:37:17 2008  Tanaka Akira  <akr@f...>
 
 	* parse.y (parser_magic_comment): use STRNCASECMP.
Index: regenc.h
===================================================================
--- regenc.h	(revision 14863)
+++ regenc.h	(revision 14864)
@@ -124,7 +124,6 @@
 ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s, OnigEncoding enc));
 ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
 ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
-ONIG_EXTERN int onigenc_ascii_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc));
 
 /* methods for multi byte encoding */
 ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));

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

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