diff options
Diffstat (limited to 'wctype/wcfuncs.c')
-rw-r--r-- | wctype/wcfuncs.c | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/wctype/wcfuncs.c b/wctype/wcfuncs.c index 3adb9b015e..3b9296c9a7 100644 --- a/wctype/wcfuncs.c +++ b/wctype/wcfuncs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,33 +20,71 @@ #include <wctype.h> #include <ctype.h> /* For __ctype_tolower and __ctype_toupper. */ +#include "cname-lookup.h" + /* Provide real-function versions of all the wctype macros. */ #define func(name, type) \ - int name (wc) wint_t wc; { return __iswctype (wc, type); } + int \ + __##name (wint_t wc) \ + { \ + size_t idx; \ + \ + idx = cname_lookup (wc); \ + if (idx == ~((size_t) 0)) \ + return 0; \ + \ + return __ctype32_b[idx] & type; \ + } \ + weak_alias (__##name, name) +#undef iswalnum func (iswalnum, _ISwalnum) +#undef iswalpha func (iswalpha, _ISwalpha) +#undef iswcntrl func (iswcntrl, _ISwcntrl) +#undef iswdigit func (iswdigit, _ISwdigit) +#undef iswlower func (iswlower, _ISwlower) +#undef iswgraph func (iswgraph, _ISwgraph) +#undef iswprint func (iswprint, _ISwprint) +#undef iswpunct func (iswpunct, _ISwpunct) +#undef iswspace func (iswspace, _ISwspace) +#undef iswupper func (iswupper, _ISwupper) +#undef iswxdigit func (iswxdigit, _ISwxdigit) wint_t -towlower (wc) +(towlower) (wc) wint_t wc; { - return __towctrans (wc, __ctype_tolower); + size_t idx; + + idx = cname_lookup (wc); + if (idx == ~((size_t) 0)) + /* Character is not known. Default action is to simply return it. */ + return wc; + + return (wint_t) __ctype_toupper[idx]; } wint_t -towupper (wc) +(towupper) (wc) wint_t wc; { - return __towctrans (wc, __ctype_toupper); + size_t idx; + + idx = cname_lookup (wc); + if (idx == ~((size_t) 0)) + /* Character is not known. Default action is to simply return it. */ + return wc; + + return (wint_t) __ctype_toupper[idx]; } |