mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 03:24:00 +02:00
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@14829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
46933426b0
commit
041e829127
14 changed files with 152 additions and 39 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue