Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-03-31 13:31:38 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-03-31 13:31:38 +0400
commit4bc42c05aa0921f57e401985458ef8e584fa8777 (patch)
tree68783798c495590d87169ccb42807fcd8da9d401 /newlib/libc/include/ctype.h
parent24bd1f86c27b5d25a12e42da286ba983cc4d7ef8 (diff)
* libc/ctype/Makefile.am: Remove _tolower.c and _toupper.c
source files. Add a dependency rule for ctype_o to note changes in ctype_iso.h and ctype_cp.h. * libc/ctype/Makefile.in: Regenerate. * libc/ctype/_tolower.c: Remove file. * libc/ctype/_toupper.c: Remove file. * libc/ctype/ctype_.c: Make sure ALLOW_NEGATIVE_CTYPE_INDEX is always defined on Cygwin. (_ctype_b): Don't make `static const' on Cygwin. (ctype_iso.h): Include if _MB_EXTENDED_CHARSETS_ISO is set. (ctype_cp.h): Include if _MB_EXTENDED_CHARSETS_WINDOWS is set. (__ctype_ptr): Drop definition. (__ctype_ptr__): De-constify. Mark as __EXPORT symbol. (_ctype_): Add Cygwin-specifc asm define. (__set_ctype): New function to set __ctype_ptr__ according to current charset. * libc/ctype/ctype_cp.h: New file containing Windows codepage specific character class tables. * libc/ctype/ctype_iso.h: New file containing ISO-8859-x specific character class tables. * libc/ctype/tolower.c (tolower): Reimplement to support any singlebyte charset if one of the extended charsets is enabled. * libc/ctype/toupper.c (toupper): Ditto. * libc/include/ctype.h (_tolower): Define as macro per POSIX. (_toupper): Ditto. (__ctype_ptr__): De-constify. (toupper): Disable macro on systems supporting extended charsets. (tolower): Ditto. * libc/include/sys/config.h (__EXPORT): Define empty if not defined. * libc/locale/locale.c (__mb_cur_max): Mark as __EXPORT symbol. (__set_ctype): Declare unconditionally. (loadlocale): Remove __CYGWIN__ guard around __set_ctype call.
Diffstat (limited to 'newlib/libc/include/ctype.h')
-rw-r--r--newlib/libc/include/ctype.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h
index 74cfb6f23..b99115ae2 100644
--- a/newlib/libc/include/ctype.h
+++ b/newlib/libc/include/ctype.h
@@ -26,8 +26,8 @@ int _EXFUN(isblank, (int __c));
#ifndef __STRICT_ANSI__
int _EXFUN(isascii, (int __c));
int _EXFUN(toascii, (int __c));
-int _EXFUN(_tolower, (int __c));
-int _EXFUN(_toupper, (int __c));
+#define _tolower(c) ((unsigned char)(c) - 'A' + 'a')
+#define _toupper(c) ((unsigned char)(c) - 'a' + 'A')
#endif
#define _U 01
@@ -39,7 +39,7 @@ int _EXFUN(_toupper, (int __c));
#define _X 0100
#define _B 0200
-extern __IMPORT _CONST char *__ctype_ptr__;
+extern __IMPORT char *__ctype_ptr__;
#ifndef __cplusplus
#define isalpha(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L))
@@ -60,8 +60,9 @@ extern __IMPORT _CONST char *__ctype_ptr__;
/* Non-gcc versions will get the library versions, and will be
- slightly slower */
-#ifdef __GNUC__
+ slightly slower. These macros are not NLS-aware so they are
+ disabled if the system supports the extended character sets. */
+# if defined(__GNUC__) && !defined (_MB_EXTENDED_CHARSETS_ISO) && !defined (_MB_EXTENDED_CHARSETS_WINDOWS)
# define toupper(c) \
__extension__ ({ int __x = (c); islower(__x) ? (__x - 'a' + 'A') : __x;})
# define tolower(c) \