diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/encoding.h | 26 | ||||
-rw-r--r-- | include/ruby/oniguruma.h | 2 | ||||
-rw-r--r-- | include/ruby/ruby.h | 1 |
3 files changed, 16 insertions, 13 deletions
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)) |