diff options
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | include/ruby/encoding.h | 26 | ||||
-rw-r--r-- | include/ruby/oniguruma.h | 2 | ||||
-rw-r--r-- | include/ruby/ruby.h | 1 | ||||
-rw-r--r-- | regenc.h | 1 |
5 files changed, 35 insertions, 14 deletions
@@ -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> * parse.y (parser_magic_comment): use STRNCASECMP. diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index e10d893fb1..c2c83783a4 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -136,19 +136,19 @@ VALUE rb_enc_default_external(void); 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) diff --git a/include/ruby/oniguruma.h b/include/ruby/oniguruma.h index 0cf2e0c6e4..66d7637a30 100644 --- a/include/ruby/oniguruma.h +++ b/include/ruby/oniguruma.h @@ -380,6 +380,8 @@ int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p)); 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 */ diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index c5184f7ca6..199098f609 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -968,6 +968,7 @@ int rb_remove_event_hook(rb_event_hook_func_t func); } /* extern "C" { */ #endif +/* locale insensitive functions */ #include "encoding.h" #ifndef ISPRINT #define ISASCII(c) rb_isascii((int)(unsigned char)(c)) @@ -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 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)); |