(__iswblank_l): New function.
authordrepper <drepper>
Fri, 1 Sep 2000 19:28:58 +0000 (19:28 +0000)
committerdrepper <drepper>
Fri, 1 Sep 2000 19:28:58 +0000 (19:28 +0000)
Don't include cname-lookup.h. Include localeinfo.h instead.
(__NO_WCTYPE): Remove unused macro.
(__iswalnum_l, __iswalpha_l, __iswcntrl_l, __iswdigit_l, __iswlower_l,
__iswgraph_l, __iswprint_l, __iswpunct_l, __iswspace_l, __iswupper_l,
__iswxdigit_l): Assume new locale format.
(__towlower_l, __towupper_l): Likewise.

wctype/wcfuncs_l.c

index 5ef543c..a552895 100644 (file)
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define        __NO_WCTYPE
 #include <wctype.h>
 #include <stdint.h>
+#include <locale/localeinfo.h>
 
 #define USE_IN_EXTENDED_LOCALE_MODEL
-#include "cname-lookup.h"
 #include "wchar-lookup.h"
 
 /* Provide real-function versions of all the wctype macros.  */
 #define        func(name, type) \
   int name (wint_t wc, __locale_t locale)                                    \
   {                                                                          \
-    if (locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_HASH_SIZE)].word != 0) \
-      {                                                                              \
-       /* Old locale format.  */                                             \
-       const uint32_t *class32_b;                                            \
-       size_t idx;                                                           \
-                                                                             \
-       idx = cname_lookup (wc, locale);                                      \
-       if (idx == ~((size_t) 0))                                             \
-         return 0;                                                           \
-                                                                             \
-       class32_b = (uint32_t *)                                              \
-         locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS32)].string; \
-                                                                             \
-       return class32_b[idx] & _ISwbit (type);                               \
-      }                                                                              \
-    else                                                                     \
-      {                                                                              \
-       /* New locale format.  */                                             \
-       size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + type; \
-       const char *desc = locale->__locales[LC_CTYPE]->values[i].string;     \
-       return wctype_table_lookup (desc, wc);                                \
-      }                                                                              \
+    size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + type; \
+    const char *desc = locale->__locales[LC_CTYPE]->values[i].string;        \
+    return wctype_table_lookup (desc, wc);                                   \
   }
 
 func (__iswalnum_l, __ISwalnum)
 func (__iswalpha_l, __ISwalpha)
+func (__iswblank_l, __ISwblank)
 func (__iswcntrl_l, __ISwcntrl)
 func (__iswdigit_l, __ISwdigit)
 func (__iswlower_l, __ISwlower)
@@ -68,53 +49,15 @@ func (__iswxdigit_l, __ISwxdigit)
 wint_t
 (__towlower_l) (wint_t wc, __locale_t locale)
 {
-  if (locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_HASH_SIZE)].word != 0)
-    {
-      /* Old locale format.  */
-      const int32_t *class32_tolower;
-      size_t idx;
-
-      idx = cname_lookup (wc, locale);
-      if (idx == ~((size_t) 0))
-       return 0;
-
-      class32_tolower = (const int32_t *)
-       locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER32)].string;
-
-      return class32_tolower[idx];
-    }
-  else
-    {
-      /* New locale format.  */
-      size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_tolower;
-      const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
-      return wctrans_table_lookup (desc, wc);
-    }
+  size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_tolower;
+  const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
+  return wctrans_table_lookup (desc, wc);
 }
 
 wint_t
 (__towupper_l) (wint_t wc, __locale_t locale)
 {
-  if (locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_HASH_SIZE)].word != 0)
-    {
-      /* Old locale format.  */
-      const int32_t *class32_toupper;
-      size_t idx;
-
-      idx = cname_lookup (wc, locale);
-      if (idx == ~((size_t) 0))
-       return 0;
-
-      class32_toupper = (const int32_t *)
-       locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER32)].string;
-
-      return class32_toupper[idx];
-    }
-  else
-    {
-      /* New locale format.  */
-      size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_toupper;
-      const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
-      return wctrans_table_lookup (desc, wc);
-    }
+  size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_toupper;
+  const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
+  return wctrans_table_lookup (desc, wc);
 }