1 /* Copyright (C) 2002, 2003 Manuel Novoa III
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Library General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, see
15 * <http://www.gnu.org/licenses/>.
18 /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION!
20 * Besides uClibc, I'm using this code in my libc for elks, which is
21 * a 16-bit environment with a fairly limited compiler. It would make
22 * things much easier for me if this file isn't modified unnecessarily.
23 * In particular, please put any new or replacement functions somewhere
24 * else, and modify the makefile to use your version instead.
27 * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */
38 #include <bits/uClibc_uwchar.h>
40 #if defined(__LOCALE_C_ONLY) && defined(__UCLIBC_DO_XLOCALE)
41 # error xlocale functionality is not supported in stub locale mode.
44 /* We know wide char support is enabled. We wouldn't be here otherwise. */
46 /* Define this if you want to unify the towupper and towlower code in the
47 * towctrans function. */
48 /* #define SMALL_UPLOW */
51 /* Pull in __CTYPE_xxx constants */
52 #include <bits/uClibc_charclass.h>
55 /* The following is used to implement wctype(), but it is defined
56 * here because the ordering must agree with that of the enumeration
57 * below (ignoring unclassified). */
58 #define __CTYPE_TYPESTRING \
59 "\6alnum\0\6alpha\0\6blank\0\6cntrl\0\6digit\0\6graph\0\6lower\0" \
60 "\6print\0\6punct\0\6space\0\6upper\0\7xdigit\0\0"
63 /* The values for wctype_t. */
65 _CTYPE_unclassified = 0,
77 _CTYPE_isxdigit /* _MUST_ be last of the standard classes! */
80 /* The following is used to implement wctrans(). */
82 #define __CTYPE_TRANSTRING "\10tolower\0\10toupper\0\10totitle\0\0"
90 /*--------------------------------------------------------------------*/
92 #define _CTYPE_iswxdigit (_CTYPE_isxdigit)
94 /*--------------------------------------------------------------------*/
96 #ifdef __UCLIBC_MJN3_ONLY__
98 /* generates one warning */
99 # warning TODO: Fix WC* defines!
103 #define ENCODING (__UCLIBC_CURLOCALE->encoding)
105 #define WCctype (__UCLIBC_CURLOCALE->tblwctype)
106 #define WCuplow (__UCLIBC_CURLOCALE->tblwuplow)
107 #define WCcmob (__UCLIBC_CURLOCALE->tblwcomb)
108 #define WCuplow_diff (__UCLIBC_CURLOCALE->tblwuplow_diff)
111 #define WC_TABLE_DOMAIN_MAX __LOCALE_DATA_WC_TABLE_DOMAIN_MAX
113 #define WCctype_II_LEN __LOCALE_DATA_WCctype_II_LEN
114 #define WCctype_TI_LEN __LOCALE_DATA_WCctype_TI_LEN
115 #define WCctype_UT_LEN __LOCALE_DATA_WCctype_UT_LEN
116 #define WCctype_II_SHIFT __LOCALE_DATA_WCctype_II_SHIFT
117 #define WCctype_TI_SHIFT __LOCALE_DATA_WCctype_TI_SHIFT
119 #define WCuplow_II_LEN __LOCALE_DATA_WCuplow_II_LEN
120 #define WCuplow_TI_LEN __LOCALE_DATA_WCuplow_TI_LEN
121 #define WCuplow_UT_LEN __LOCALE_DATA_WCuplow_UT_LEN
122 #define WCuplow_II_SHIFT __LOCALE_DATA_WCuplow_II_SHIFT
123 #define WCuplow_TI_SHIFT __LOCALE_DATA_WCuplow_TI_SHIFT
126 #define WCctype_TI_MASK ((1 << (WCctype_TI_SHIFT)) - 1)
127 #define WCctype_II_MASK ((1 << (WCctype_II_SHIFT)) - 1)
129 /**********************************************************************/
133 #define __PASTE2(X,Y) X ## Y
134 #define __PASTE3(X,Y,Z) X ## Y ## Z
136 #ifdef __UCLIBC_DO_XLOCALE
138 #define ISW_FUNC_BODY(NAME) \
139 int __PASTE3(isw,NAME,_l) (wint_t wc, __locale_t l) \
141 return iswctype_l(wc, __PASTE2(_CTYPE_is,NAME), l); \
144 #else /* __UCLIBC_DO_XLOCALE */
146 #define ISW_FUNC_BODY(NAME) \
147 int __PASTE2(isw,NAME) (wint_t wc) \
149 return iswctype(wc, __PASTE2(_CTYPE_is,NAME)); \
152 #endif /* __UCLIBC_DO_XLOCALE */
153 /**********************************************************************/
154 #if defined(L_iswalnum) || defined(L_iswalnum_l)
156 ISW_FUNC_BODY(alnum);
158 libc_hidden_def(iswalnum)
162 /**********************************************************************/
163 #if defined(L_iswalpha) || defined(L_iswalpha_l)
165 ISW_FUNC_BODY(alpha);
168 /**********************************************************************/
169 #if defined(L_iswblank) || defined(L_iswblank_l)
171 ISW_FUNC_BODY(blank);
174 /**********************************************************************/
175 #if defined(L_iswcntrl) || defined(L_iswcntrl_l)
177 ISW_FUNC_BODY(cntrl);
180 /**********************************************************************/
181 #if defined(L_iswdigit) || defined(L_iswdigit_l)
183 ISW_FUNC_BODY(digit);
186 /**********************************************************************/
187 #if defined(L_iswgraph) || defined(L_iswgraph_l)
189 ISW_FUNC_BODY(graph);
192 /**********************************************************************/
193 #if defined(L_iswlower) || defined(L_iswlower_l)
195 ISW_FUNC_BODY(lower);
197 libc_hidden_def(iswlower)
201 /**********************************************************************/
202 #if defined(L_iswprint) || defined(L_iswprint_l)
204 ISW_FUNC_BODY(print);
207 /**********************************************************************/
208 #if defined(L_iswpunct) || defined(L_iswpunct_l)
210 ISW_FUNC_BODY(punct);
213 /**********************************************************************/
214 #if defined(L_iswspace) || defined(L_iswspace_l)
216 ISW_FUNC_BODY(space);
218 libc_hidden_def(iswspace)
220 libc_hidden_def(iswspace_l)
224 /**********************************************************************/
225 #if defined(L_iswupper) || defined(L_iswupper_l)
227 ISW_FUNC_BODY(upper);
229 libc_hidden_def(iswupper)
233 /**********************************************************************/
234 #if defined(L_iswxdigit) || defined(L_iswxdigit_l)
236 ISW_FUNC_BODY(xdigit);
239 /**********************************************************************/
240 #if defined(L_towlower) || defined(L_towlower_l)
243 # define TOWLOWER(w) towlower(w)
245 # define TOWLOWER(w) towlower_l(w, __locale_t locale)
246 # undef __UCLIBC_CURLOCALE
247 # define __UCLIBC_CURLOCALE (locale)
250 # ifdef __UCLIBC_HAS_XLOCALE__
251 # define TOWCTRANS(w,d) towctrans_l(w,d, __UCLIBC_CURLOCALE)
253 # define TOWCTRANS(w,d) towctrans(w,d)
256 # define __C_towlower(wc) \
257 (((__uwchar_t)(wc) <= 0x7f) ? (__C_ctype_tolower)[(wc)] : (wc))
259 # ifdef __LOCALE_C_ONLY
261 wint_t towlower(wint_t wc)
263 # ifdef __UCLIBC_HAS_CTYPE_TABLES__
264 return __C_towlower(wc);
266 return (wc == (unsigned)wc)
267 ? __C_tolower((unsigned)wc)
272 # else /* __LOCALE_C_ONLY */
276 # if defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__)
277 wint_t towlower(wint_t wc)
279 return towctrans_l(wc, _CTYPE_tolower, __UCLIBC_CURLOCALE);
281 # else /* defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) */
282 wint_t TOWLOWER(wint_t wc)
284 return TOWCTRANS(wc, _CTYPE_tolower);
286 # endif /* defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) */
288 # else /* SMALL_UPLOW */
290 # if defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__)
292 wint_t towlower(wint_t wc)
294 return towlower_l(wc, __UCLIBC_CURLOCALE);
297 # else /* defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) */
299 wint_t TOWLOWER(wint_t wc)
304 if (ENCODING == __ctype_encoding_7_bit) {
305 /* We're in the C/POSIX locale, so ignore the tables. */
306 return __C_towlower(wc);
309 if (u <= WC_TABLE_DOMAIN_MAX) {
310 sc = u & ((1 << WCuplow_TI_SHIFT) - 1);
311 u >>= WCuplow_TI_SHIFT;
312 n = u & ((1 << WCuplow_II_SHIFT) - 1);
313 u >>= WCuplow_II_SHIFT;
315 i = ((unsigned) WCuplow[u]) << WCuplow_II_SHIFT;
316 i = ((unsigned) WCuplow[WCuplow_II_LEN + i + n]) << WCuplow_TI_SHIFT;
317 i = ((unsigned) WCuplow[WCuplow_II_LEN + WCuplow_TI_LEN + i + sc]) << 1;
318 wc += WCuplow_diff[i + 1];
323 # endif /* defined(L_towlower) && defined(__UCLIBC_HAS_XLOCALE__) */
325 # endif /* SMALL_UPLOW */
328 libc_hidden_def(towlower_l)
331 # endif /* __LOCALE_C_ONLY */
333 # ifndef L_towlower_l
334 libc_hidden_def(towlower)
338 /**********************************************************************/
339 #if defined(L_towupper) || defined(L_towupper_l)
342 # define TOWUPPER(w) towupper(w)
344 # define TOWUPPER(w) towupper_l(w, __locale_t locale)
345 # undef __UCLIBC_CURLOCALE
346 # define __UCLIBC_CURLOCALE (locale)
349 # ifdef __UCLIBC_HAS_XLOCALE__
350 # define TOWCTRANS(w,d) towctrans_l(w,d, __UCLIBC_CURLOCALE)
352 # define TOWCTRANS(w,d) towctrans(w,d)
355 # define __C_towupper(wc) \
356 (((__uwchar_t)(wc) <= 0x7f) ? (__C_ctype_toupper)[(wc)] : (wc))
358 # ifdef __LOCALE_C_ONLY
360 wint_t towupper(wint_t wc)
362 # ifdef __UCLIBC_HAS_CTYPE_TABLES__
363 return __C_towupper(wc);
365 return (wc == (unsigned)wc)
366 ? __C_toupper((unsigned)wc)
371 # else /* __LOCALE_C_ONLY */
375 # if defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__)
376 wint_t towupper(wint_t wc)
378 return towctrans_l(wc, _CTYPE_toupper, __UCLIBC_CURLOCALE);
381 wint_t TOWUPPER(wint_t wc)
383 return TOWCTRANS(wc, _CTYPE_toupper);
387 # else /* SMALL_UPLOW */
389 # if defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__)
390 wint_t towupper(wint_t wc)
392 return towupper_l(wc, __UCLIBC_CURLOCALE);
394 # else /* defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) */
395 wint_t TOWUPPER(wint_t wc)
400 if (ENCODING == __ctype_encoding_7_bit) {
401 /* We're in the C/POSIX locale, so ignore the tables. */
402 return __C_towupper(wc);
405 if (u <= WC_TABLE_DOMAIN_MAX) {
406 sc = u & ((1 << WCuplow_TI_SHIFT) - 1);
407 u >>= WCuplow_TI_SHIFT;
408 n = u & ((1 << WCuplow_II_SHIFT) - 1);
409 u >>= WCuplow_II_SHIFT;
411 i = ((unsigned) WCuplow[u]) << WCuplow_II_SHIFT;
412 i = ((unsigned) WCuplow[WCuplow_II_LEN + i + n]) << WCuplow_TI_SHIFT;
413 i = ((unsigned) WCuplow[WCuplow_II_LEN + WCuplow_TI_LEN + i + sc]) << 1;
414 wc += WCuplow_diff[i];
418 # endif /* defined(L_towupper) && defined(__UCLIBC_HAS_XLOCALE__) */
420 # endif /* SMALL_UPLOW */
423 libc_hidden_def(towupper_l)
426 # endif /* __LOCALE_C_ONLY */
428 # ifndef L_towupper_l
429 libc_hidden_def(towupper)
433 /**********************************************************************/
436 static const unsigned char typestring[] = __CTYPE_TYPESTRING;
438 wctype_t wctype(const char *property)
440 const unsigned char *p;
446 if (!strcmp(property, (const char *) ++p)) {
453 /* TODO - Add locale-specific classifications. */
456 libc_hidden_def(wctype)
459 /**********************************************************************/
462 #ifdef __UCLIBC_MJN3_ONLY__
463 # warning REMINDER: Currently wctype_l simply calls wctype.
466 wctype_t wctype_l (const char *property, __locale_t locale)
468 return wctype(property);
472 /**********************************************************************/
473 #if defined(L_iswctype) || defined(L_iswctype_l)
475 #define __C_iswdigit(c) \
476 ((sizeof(c) == sizeof(char)) \
477 ? ((unsigned char)((c) - '0') < 10) \
478 : ((__uwchar_t)((c) - '0') < 10) \
480 #define __C_iswxdigit(c) \
482 || ((sizeof(c) == sizeof(char)) \
483 ? ((unsigned char)(((c) | 0x20) - 'a') < 6) \
484 : ((__uwchar_t)(((c) | 0x20) - 'a') < 6) \
488 #ifdef __UCLIBC_MJN3_ONLY__
490 # warning CONSIDER: Change to bit shift? would need to sync with wctype.h
494 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
495 # if !defined(__UCLIBC_HAS_XLOCALE__) || defined(L_iswctype_l)
496 static const unsigned short int desc2flag[] = {
497 [_CTYPE_unclassified] = 0,
498 [_CTYPE_isalnum] = (unsigned short int) _ISwalnum,
499 [_CTYPE_isalpha] = (unsigned short int) _ISwalpha,
500 [_CTYPE_isblank] = (unsigned short int) _ISwblank,
501 [_CTYPE_iscntrl] = (unsigned short int) _ISwcntrl,
502 [_CTYPE_isdigit] = (unsigned short int) _ISwdigit,
503 [_CTYPE_isgraph] = (unsigned short int) _ISwgraph,
504 [_CTYPE_islower] = (unsigned short int) _ISwlower,
505 [_CTYPE_isprint] = (unsigned short int) _ISwprint,
506 [_CTYPE_ispunct] = (unsigned short int) _ISwpunct,
507 [_CTYPE_isspace] = (unsigned short int) _ISwspace,
508 [_CTYPE_isupper] = (unsigned short int) _ISwupper,
509 [_CTYPE_isxdigit] = (unsigned short int) _ISwxdigit,
514 #ifdef __LOCALE_C_ONLY
516 #ifdef __UCLIBC_HAS_CTYPE_TABLES__
518 int iswctype(wint_t wc, wctype_t desc)
520 /* Note... wctype_t is unsigned. */
522 if ((__uwchar_t) wc <= 0x7f
523 && desc < (sizeof(desc2flag) / sizeof(desc2flag[0]))
525 return __isctype(wc, desc2flag[desc]);
530 #else /* __UCLIBC_HAS_CTYPE_TABLES__ */
532 int iswctype(wint_t wc, wctype_t desc)
534 /* This is lame, but it is here just to get it working for now. */
536 if (wc == (unsigned)wc) {
539 return __C_isupper((unsigned)wc);
541 return __C_islower((unsigned)wc);
543 return __C_isalpha((unsigned)wc);
545 return __C_isdigit((unsigned)wc);
546 case _CTYPE_isxdigit:
547 return __C_isxdigit((unsigned)wc);
549 return __C_isspace((unsigned)wc);
551 return __C_isprint((unsigned)wc);
553 return __C_isgraph((unsigned)wc);
555 return __C_isblank((unsigned)wc);
557 return __C_iscntrl((unsigned)wc);
559 return __C_ispunct((unsigned)wc);
561 return __C_isalnum((unsigned)wc);
569 #endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
571 #else /* __LOCALE_C_ONLY */
573 #ifdef __UCLIBC_MJN3_ONLY__
575 # warning CONSIDER: Handle combining class?
580 # define ISWCTYPE(w,d) iswctype(w,d)
582 # define ISWCTYPE(w,d) iswctype_l(w,d, __locale_t locale)
583 # undef __UCLIBC_CURLOCALE
584 # define __UCLIBC_CURLOCALE (locale)
587 #if defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__)
589 int iswctype(wint_t wc, wctype_t desc)
591 return iswctype_l(wc, desc, __UCLIBC_CURLOCALE);
594 #else /* defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) */
596 int ISWCTYPE(wint_t wc, wctype_t desc)
598 unsigned sc, n, i0, i1;
599 unsigned char d = __CTYPE_unclassified;
601 if ((ENCODING != __ctype_encoding_7_bit) || ((__uwchar_t)wc <= 0x7f)) {
602 if (desc < _CTYPE_iswxdigit) {
603 if ((__uwchar_t)wc <= WC_TABLE_DOMAIN_MAX) {
604 /* From here on, we know wc > 0. */
605 sc = wc & WCctype_TI_MASK;
606 wc >>= WCctype_TI_SHIFT;
607 n = wc & WCctype_II_MASK;
608 wc >>= WCctype_II_SHIFT;
611 i0 <<= WCctype_II_SHIFT;
612 i1 = WCctype[WCctype_II_LEN + i0 + n];
613 i1 <<= (WCctype_TI_SHIFT-1);
614 d = WCctype[WCctype_II_LEN + WCctype_TI_LEN + i1 + (sc >> 1)];
616 d = (sc & 1) ? (d >> 4) : (d & 0xf);
617 } else if ((__uwchar_t)(wc - 0xe0020UL) <= 0x5f
619 || (((__uwchar_t)(wc - 0xf0000UL) < 0x20000UL) && ((wc & 0xffffU) <= 0xfffdU))
625 return ((unsigned char)(d - ctype_range[2*desc]) <= ctype_range[2*desc + 1])
626 && ((desc != _CTYPE_iswblank) || (d & 1));
628 return __UCLIBC_CURLOCALE->code2flag[d] & desc2flag[desc];
632 #ifdef __UCLIBC_MJN3_ONLY__
633 # warning TODO: xdigit really needs to be handled better. Remember only for ascii!
635 /* TODO - Add locale-specific classifications. */
636 return (desc == _CTYPE_iswxdigit) ? __C_iswxdigit(wc) : 0;
641 #endif /* defined(L_iswctype) && defined(__UCLIBC_HAS_XLOCALE__) */
644 libc_hidden_def(iswctype_l)
647 #endif /* __LOCALE_C_ONLY */
650 libc_hidden_def(iswctype)
654 /**********************************************************************/
655 #if defined(L_towctrans) || defined(L_towctrans_l)
657 #ifdef __LOCALE_C_ONLY
659 /* Minimal support for C/POSIX locale. */
661 wint_t towctrans(wint_t wc, wctrans_t desc)
663 if ((unsigned)(desc - _CTYPE_tolower) <= (_CTYPE_toupper - _CTYPE_tolower)) {
664 /* Transliteration is either tolower or toupper. */
666 /* I think it's wrong: _toupper(c) assumes that c is a *lowercase* *letter* -
667 * it is defined as ((c) ^ 0x20)! */
668 if ((__uwchar_t) wc <= 0x7f) {
669 return (desc == _CTYPE_tolower) ? _tolower(wc) : _toupper(wc);
672 __uwchar_t c = wc | 0x20; /* lowercase if it's a letter */
673 if (c >= 'a' && c <= 'z') {
674 if (desc == _CTYPE_toupper)
675 c &= ~0x20; /* uppercase */
679 __set_errno(EINVAL); /* Invalid transliteration. */
684 #else /* __LOCALE_C_ONLY */
687 # define TOWCTRANS(w,d) towctrans(w,d)
689 # define TOWCTRANS(w,d) towctrans_l(w,d, __locale_t locale)
690 # undef __UCLIBC_CURLOCALE
691 # define __UCLIBC_CURLOCALE (locale)
694 #ifdef __UCLIBC_HAS_XLOCALE__
695 # define TOWLOWER(w,l) towlower_l(w,l)
696 # define TOWUPPER(w,l) towupper_l(w,l)
698 # define TOWLOWER(w,l) towlower(w)
699 # define TOWUPPER(w,l) towupper(w)
702 #if defined(L_towctrans) && defined(__UCLIBC_HAS_XLOCALE__)
704 wint_t towctrans(wint_t wc, wctrans_t desc)
706 return towctrans_l(wc, desc, __UCLIBC_CURLOCALE);
709 #else /* defined(L_towctrans) && defined(__UCLIBC_HAS_XLOCALE__) */
713 wint_t TOWCTRANS(wint_t wc, wctrans_t desc)
718 /* TODO - clean up */
719 if (ENCODING == __ctype_encoding_7_bit) {
720 if ((__uwchar_t)wc > 0x7f
721 || (unsigned)(desc - _CTYPE_tolower) > (_CTYPE_toupper - _CTYPE_tolower)
723 /* We're in the C/POSIX locale, so ignore non-ASCII values
724 * as well an any mappings other than toupper or tolower. */
729 if ((unsigned)(desc - _CTYPE_tolower) <= (_CTYPE_totitle - _CTYPE_tolower)) {
730 if (u <= WC_TABLE_DOMAIN_MAX) {
731 sc = u & ((1 << WCuplow_TI_SHIFT) - 1);
732 u >>= WCuplow_TI_SHIFT;
733 n = u & ((1 << WCuplow_II_SHIFT) - 1);
734 u >>= WCuplow_II_SHIFT;
736 i = ((unsigned) WCuplow[u]) << WCuplow_II_SHIFT;
737 i = ((unsigned) WCuplow[WCuplow_II_LEN + i + n]) << WCuplow_TI_SHIFT;
738 i = ((unsigned) WCuplow[WCuplow_II_LEN + WCuplow_TI_LEN + i + sc]) << 1;
739 if (desc == _CTYPE_tolower) {
742 wc += WCuplow_diff[i];
743 if (desc == _CTYPE_totitle) {
744 #ifdef __UCLIBC_MJN3_ONLY__
745 # warning TODO: Verify totitle special cases!
747 /* WARNING! These special cases work for glibc 2.2.4. Changes
748 * may be needed if the glibc locale tables are updated. */
749 if ((__uwchar_t)(wc - 0x1c4) <= (0x1cc - 0x1c4)
757 /* TODO - Deal with other transliterations. */
764 #else /* SMALL_UPLOW */
766 wint_t TOWCTRANS(wint_t wc, wctrans_t desc)
768 if (ENCODING == __ctype_encoding_7_bit) {
769 if ((__uwchar_t)wc > 0x7f
770 || (unsigned)(desc - _CTYPE_tolower) > (_CTYPE_toupper - _CTYPE_tolower)
772 /* We're in the C/POSIX locale, so ignore non-ASCII values
773 * as well an any mappings other than toupper or tolower. */
778 if (desc == _CTYPE_tolower) {
779 return TOWLOWER(wc, __UCLIBC_CURLOCALE);
781 if ((unsigned)(desc - _CTYPE_toupper) <= (_CTYPE_totitle - _CTYPE_toupper)) {
782 wc = TOWUPPER(wc, __UCLIBC_CURLOCALE);
783 if (desc == _CTYPE_totitle) {
784 #ifdef __UCLIBC_MJN3_ONLY__
785 # warning TODO: Verify totitle special cases!
787 /* WARNING! These special cases work for glibc 2.2.4. Changes
788 * may be needed if the glibc locale tables are updated. */
789 if ((__uwchar_t)(wc - 0x1c4) <= (0x1cc - 0x1c4)
796 /* TODO - Deal with other transliterations. */
802 #endif /* SMALL_UPLOW */
804 #endif /* defined(L_towctrans) && defined(__UCLIBC_HAS_XLOCALE__) */
807 libc_hidden_def(towctrans_l)
810 #endif /* __LOCALE_C_ONLY */
812 #ifndef L_towctrans_l
813 libc_hidden_def(towctrans)
817 /**********************************************************************/
820 static const char transstring[] = __CTYPE_TRANSTRING;
822 wctrans_t wctrans(const char *property)
824 const unsigned char *p;
827 p = (const unsigned char *) transstring;
830 if (!strcmp(property, (const char*) ++p)) {
837 /* TODO - Add locale-specific translations. */
840 libc_hidden_def(wctrans)
843 /**********************************************************************/
846 # ifdef __UCLIBC_MJN3_ONLY__
847 # warning REMINDER: Currently wctrans_l simply calls wctrans.
850 wctrans_t wctrans_l(const char *property, __locale_t locale)
852 return wctrans(property);
856 /**********************************************************************/