[uClibc-cvs] uClibc/libc/misc/wctype wctype.c,1.5,1.6
Manuel Novoa III
mjn3 at uclibc.org
Tue Sep 9 04:15:33 UTC 2003
Update of /var/cvs/uClibc/libc/misc/wctype
In directory winder:/tmp/cvs-serv25923/libc/misc/wctype
Modified Files:
wctype.c
Log Message:
Fix wctype.c so that wchar can be enabled without ctype table-based functions.
Index: wctype.c
===================================================================
RCS file: /var/cvs/uClibc/libc/misc/wctype/wctype.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- wctype.c 24 Aug 2003 03:49:09 -0000 1.5
+++ wctype.c 9 Sep 2003 04:15:27 -0000 1.6
@@ -293,7 +293,13 @@
wint_t towlower(wint_t wc)
{
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
return __C_towlower(wc);
+#else
+ return (wc == ((unsigned int)(wc)))
+ ? __C_tolower(((unsigned int)(wc)))
+ : 0;
+#endif
}
#else /* __LOCALE_C_ONLY */
@@ -390,7 +396,14 @@
wint_t towupper(wint_t wc)
{
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
return __C_towupper(wc);
+#else
+ return (wc == ((unsigned int)(wc)))
+ ? __C_toupper(((unsigned int)(wc)))
+ : 0;
+#endif
+
}
#else /* __LOCALE_C_ONLY */
@@ -522,6 +535,7 @@
#endif /* __UCLIBC_MJN3_ONLY__ */
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
#if !defined(__UCLIBC_HAS_XLOCALE__) || defined(L_iswctype_l)
static const unsigned short int desc2flag[] = {
@@ -541,9 +555,12 @@
};
#endif /* defined(L_iswctype_L) || defined(__LOCALE_C_ONLY) */
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
#ifdef __LOCALE_C_ONLY
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
+
int __iswctype(wint_t wc, wctype_t desc)
{
/* Note... wctype_t is unsigned. */
@@ -556,6 +573,47 @@
return 0;
}
+#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
+int __iswctype(wint_t wc, wctype_t desc)
+{
+ /* This is lame, but it is here just to get it working for now. */
+
+ if (wc == ((unsigned int)(wc))) {
+ switch(desc) {
+ case _CTYPE_isupper:
+ return __C_isupper((unsigned int)(wc));
+ case _CTYPE_islower:
+ return __C_islower((unsigned int)(wc));
+ case _CTYPE_isalpha:
+ return __C_isalpha((unsigned int)(wc));
+ case _CTYPE_isdigit:
+ return __C_isdigit((unsigned int)(wc));
+ case _CTYPE_isxdigit:
+ return __C_isxdigit((unsigned int)(wc));
+ case _CTYPE_isspace:
+ return __C_isspace((unsigned int)(wc));
+ case _CTYPE_isprint:
+ return __C_isprint((unsigned int)(wc));
+ case _CTYPE_isgraph:
+ return __C_isgraph((unsigned int)(wc));
+ case _CTYPE_isblank:
+ return __C_isblank((unsigned int)(wc));
+ case _CTYPE_iscntrl:
+ return __C_iscntrl((unsigned int)(wc));
+ case _CTYPE_ispunct:
+ return __C_ispunct((unsigned int)(wc));
+ case _CTYPE_isalnum:
+ return __C_isalnum((unsigned int)(wc));
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
#else /* __LOCALE_C_ONLY */
#ifdef __UCLIBC_MJN3_ONLY__
More information about the uClibc-cvs
mailing list