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

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-01-03 06:13:31 +00:00
parent df4f37bca3
commit 155fda385e
5 changed files with 35 additions and 14 deletions

View file

@ -1,3 +1,22 @@
Thu Jan 3 15:10:26 2008 Tanaka Akira <akr@fsij.org>
* 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@fsij.org> Thu Jan 3 14:37:17 2008 Tanaka Akira <akr@fsij.org>
* parse.y (parser_magic_comment): use STRNCASECMP. * parse.y (parser_magic_comment): use STRNCASECMP.

View file

@ -136,19 +136,19 @@ VALUE rb_enc_default_external(void);
void rb_enc_set_default_external(VALUE encoding); void rb_enc_set_default_external(VALUE encoding);
VALUE rb_locale_charmap(VALUE klass); VALUE rb_locale_charmap(VALUE klass);
#define rb_isascii(c) ONIGENC_IS_CODE_ASCII(c) #define rb_isascii(c) ((unsigned long)(c) < 128)
#define rb_isalnum(c) ONIGENC_IS_CODE_ALNUM(ONIG_ENCODING_ASCII, c) #define rb_isalnum(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_ALNUM, ONIG_ENCODING_ASCII)
#define rb_isalpha(c) ONIGENC_IS_CODE_ALPHA(ONIG_ENCODING_ASCII, c) #define rb_isalpha(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_ALPHA, ONIG_ENCODING_ASCII)
#define rb_isblank(c) ONIGENC_IS_CODE_BLANK(ONIG_ENCODING_ASCII, c) #define rb_isblank(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_BLANK, ONIG_ENCODING_ASCII)
#define rb_iscntrl(c) ONIGENC_IS_CODE_CNTRL(ONIG_ENCODING_ASCII, c) #define rb_iscntrl(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_CNTRL, ONIG_ENCODING_ASCII)
#define rb_isdigit(c) ONIGENC_IS_CODE_DIGIT(ONIG_ENCODING_ASCII, c) #define rb_isdigit(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_DIGIT, ONIG_ENCODING_ASCII)
#define rb_isgraph(c) ONIGENC_IS_CODE_GRAPH(ONIG_ENCODING_ASCII, c) #define rb_isgraph(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_GRAPH, ONIG_ENCODING_ASCII)
#define rb_islower(c) ONIGENC_IS_CODE_LOWER(ONIG_ENCODING_ASCII, c) #define rb_islower(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_LOWER, ONIG_ENCODING_ASCII)
#define rb_isprint(c) ONIGENC_IS_CODE_PRINT(ONIG_ENCODING_ASCII, c) #define rb_isprint(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_PRINT, ONIG_ENCODING_ASCII)
#define rb_ispunct(c) ONIGENC_IS_CODE_PUNCT(ONIG_ENCODING_ASCII, c) #define rb_ispunct(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_PUNCT, ONIG_ENCODING_ASCII)
#define rb_isspace(c) ONIGENC_IS_CODE_SPACE(ONIG_ENCODING_ASCII, c) #define rb_isspace(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_SPACE, ONIG_ENCODING_ASCII)
#define rb_isupper(c) ONIGENC_IS_CODE_UPPER(ONIG_ENCODING_ASCII, c) #define rb_isupper(c) onigenc_ascii_is_code_ctype((c), ONIGENC_CTYPE_UPPER, ONIG_ENCODING_ASCII)
#define rb_isxdigit(c) ONIGENC_IS_CODE_XDIGIT(ONIG_ENCODING_ASCII, c) #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_tolower(c) rb_enc_tolower(c, ONIG_ENCODING_ASCII)
#define rb_toupper(c) rb_enc_toupper(c, ONIG_ENCODING_ASCII) #define rb_toupper(c) rb_enc_toupper(c, ONIG_ENCODING_ASCII)

View file

@ -380,6 +380,8 @@ int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p));
ONIG_EXTERN ONIG_EXTERN
int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p)); 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 */ /* PART: regular expression */

View file

@ -968,6 +968,7 @@ int rb_remove_event_hook(rb_event_hook_func_t func);
} /* extern "C" { */ } /* extern "C" { */
#endif #endif
/* locale insensitive functions */
#include "encoding.h" #include "encoding.h"
#ifndef ISPRINT #ifndef ISPRINT
#define ISASCII(c) rb_isascii((int)(unsigned char)(c)) #define ISASCII(c) rb_isascii((int)(unsigned char)(c))

View file

@ -124,7 +124,6 @@ ONIG_EXTERN int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *b
ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s, OnigEncoding enc)); 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_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_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 */ /* methods for multi byte encoding */
ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end)); ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));