diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-01 12:24:04 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-01 12:24:04 +0000 |
commit | 074d482414640ea2ca4190ae3f902820d32fcd8d (patch) | |
tree | 474e4518a368fcd26881d41c3f011e9525b1fdf2 /include/ruby/ruby.h | |
parent | 926f1f6c0683da5b7764dbd3184770c758b1465e (diff) | |
download | ruby-074d482414640ea2ca4190ae3f902820d32fcd8d.tar.gz ruby-074d482414640ea2ca4190ae3f902820d32fcd8d.tar.xz ruby-074d482414640ea2ca4190ae3f902820d32fcd8d.zip |
* include/ruby/encoding.h (rb_isascii): defined.
(rb_isalnum): ditto.
(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.
(rb_tolower): ditto.
(rb_toupper): ditto.
* include/ruby/st.h (st_strcasecmp): declared.
(st_strncasecmp): ditto.
* st.c (type_strcasehash): use st_strcasecmp instead of strcasecmp.
(st_strcasecmp): defined.
(st_strncasecmp): ditto.
* include/ruby/ruby.h: include include/ruby/encoding.h.
(ISASCII): use rb_isascii.
(ISPRINT): use rb_isprint.
(ISSPACE): use rb_isspace.
(ISUPPER): use rb_isupper.
(ISLOWER): use rb_islower.
(ISALNUM): use rb_isalnum.
(ISALPHA): use rb_isalpha.
(ISDIGIT): use rb_isdigit.
(ISXDIGIT): use rb_isxdigit.
(TOUPPER): defined.
(TOLOWER): ditto.
(STRCASECMP): ditto.
(STRNCASECMP): ditto.
* dir.c, encoding.c, file.c, hash.c, process.c, ruby.c, time.c,
transcode.c, ext/readline/readline.c: use locale insensitive
functions. [ruby-core:14662]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby/ruby.h')
-rw-r--r-- | include/ruby/ruby.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 90402afee..8ce623dfe 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -63,20 +63,6 @@ extern "C" { #include "defines.h" -/* need to include <ctype.h> to use these macros */ -#ifndef ISPRINT -#define ISASCII(c) isascii((int)(unsigned char)(c)) -#undef ISPRINT -#define ISPRINT(c) (ISASCII(c) && isprint((int)(unsigned char)(c))) -#define ISSPACE(c) (ISASCII(c) && isspace((int)(unsigned char)(c))) -#define ISUPPER(c) (ISASCII(c) && isupper((int)(unsigned char)(c))) -#define ISLOWER(c) (ISASCII(c) && islower((int)(unsigned char)(c))) -#define ISALNUM(c) (ISASCII(c) && isalnum((int)(unsigned char)(c))) -#define ISALPHA(c) (ISASCII(c) && isalpha((int)(unsigned char)(c))) -#define ISDIGIT(c) (ISASCII(c) && isdigit((int)(unsigned char)(c))) -#define ISXDIGIT(c) (ISASCII(c) && isxdigit((int)(unsigned char)(c))) -#endif - #if defined(HAVE_ALLOCA_H) #include <alloca.h> #else @@ -982,4 +968,22 @@ int rb_remove_event_hook(rb_event_hook_func_t func); } /* extern "C" { */ #endif +#include "encoding.h" +#ifndef ISPRINT +#define ISASCII(c) rb_isascii((int)(unsigned char)(c)) +#undef ISPRINT +#define ISPRINT(c) (ISASCII(c) && rb_isprint((int)(unsigned char)(c))) +#define ISSPACE(c) (ISASCII(c) && rb_isspace((int)(unsigned char)(c))) +#define ISUPPER(c) (ISASCII(c) && rb_isupper((int)(unsigned char)(c))) +#define ISLOWER(c) (ISASCII(c) && rb_islower((int)(unsigned char)(c))) +#define ISALNUM(c) (ISASCII(c) && rb_isalnum((int)(unsigned char)(c))) +#define ISALPHA(c) (ISASCII(c) && rb_isalpha((int)(unsigned char)(c))) +#define ISDIGIT(c) (ISASCII(c) && rb_isdigit((int)(unsigned char)(c))) +#define ISXDIGIT(c) (ISASCII(c) && rb_isxdigit((int)(unsigned char)(c))) +#endif +#define TOUPPER(c) (rb_toupper((int)(unsigned char)(c))) +#define TOLOWER(c) (rb_tolower((int)(unsigned char)(c))) +#define STRCASECMP(s1, s2) (st_strcasecmp(s1, s2)) +#define STRNCASECMP(s1, s2, n) (st_strncasecmp(s1, s2, n)) + #endif /* RUBY_H */ |