summaryrefslogtreecommitdiff
path: root/wctype
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-01 19:36:44 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-01 19:36:44 +0000
commit4c7d276eb123523c66c1d8cbf7dbb10fac674cd2 (patch)
tree05a73708dde7dc5e9bf16bbd35c82233c7f2afdc /wctype
parentaebb1faa198634a318bc14cf1e577f5806fafc38 (diff)
Update.
2000-08-31 Bruno Haible <haible@clisp.cons.org> * wctype/wcfuncs.c (iswblank): New function. * wctype/wcfuncs_l.c (__iswblank_l): New function. * wctype/wcextra.c: Remove file. * wctype/wcextra_l.c: Remove file. * wctype/Makefile (distribute): Remove wcextra and wcextra_l. 2000-08-31 Bruno Haible <haible@clisp.cons.org> * locale/programs/ld-collate.c (collate_output): Remove redundant assert call. * string/strcoll.c: Likewise. * string/strxfrm.c: Include assert.h. Add assert calls like in string/strcoll.c. 2000-08-31 Bruno Haible <haible@clisp.cons.org> * locale/categories.def (_NL_COLLATE_HASH_SIZE, _NL_COLLATE_HASH_LAYERS, _NL_COLLATE_NAMES, _NL_CTYPE_NAMES, _NL_CTYPE_HASH_SIZE, _NL_CTYPE_HASH_LAYERS): Remove definitions. * locale/langinfo.h (_NL_COLLATE_HASH_SIZE, _NL_COLLATE_HASH_LAYERS, _NL_COLLATE_NAMES): Rename to _NL_COLLATE_GAP1/2/3 respectively. (_NL_CTYPE_NAMES): Rename to _NL_CTYPE_GAP3. (_NL_CTYPE_GAP3): Rename to _NL_CTYPE_GAP4. (_NL_CTYPE_HASH_SIZE, _NL_CTYPE_HASH_LAYERS): Rename to _NL_CTYPE_GAP5/6 respectively. * locale/C-ctype.c (_nl_C_LC_CTYPE): Update. * ctype/ctype-info.c (__ctype_names, __ctype_width): Remove variables. * locale/lc-ctype.c (_nl_postload_ctype): Assume new locale format. Don't initialize __ctype_names and __ctype_width. * wctype/cname-lookup.h: Remove file. * wctype/Makefile (distribute): Remove cname-lookup.h. * wctype/wchar-lookup.h: Include stdint.h. * wctype/wctype.c (__wctype): Assume new locale format. * wctype/wctype_l.c (__wctype_l): Likewise. * wctype/iswctype.c: Don't include cname-lookup.h. (__iswctype): Assume new locale format. * wctype/iswctype_l.c: Don't include cname-lookup.h. (__iswctype_l): Assume new locale format. * wctype/wctrans.c: Don't include ctype.h. (wctrans): Assume new locale format. * wctype/wctrans_l.c (__wctrans_l): Likewise. * wctype/towctrans.c: Don't include cname-lookup.h. (__towctrans): Assume new locale format. * wctype/towctrans_l.c: Don't include cname-lookup.h. (__towctrans_l): Assume new locale format. * wctype/wcfuncs.c: Don't include ctype.h and cname-lookup.h. Include localeinfo.h instead. (__NO_WCTYPE): Remove unused macro. (__ctype32_b, __ctype32_toupper, __ctype32_tolower): Remove declarations. (iswalnum, iswalpha, iswcntrl, iswdigit, iswlower, iswgraph, iswprint, iswpunct, iswspace, iswupper, iswxdigit): Assume new locale format. (towlower, towupper): Likewise. * wctype/wcfuncs_l.c: 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. * wcsmbs/wcwidth.h: Don't include cname-lookup.h. (__ctype32_b): Remove declaration. (internal_wcwidth): Assume new locale format. * locale/programs/ld-ctype.c (struct locale_ctype_t): Remove fields plane_size, plane_cnt, names, width. Rename map to map_b, rename map32 to map32_b, rename width_3level to width. (ctype_output): Always create new locale format. Don't emit _NL_CTYPE_NAMES, _NL_CTYPE_HASH_SIZE, _NL_CTYPE_HASH_LAYERS any more. (allocate_arrays): Always create new locale format. * locale/C-collate.c (_nl_C_LC_COLLATE): Update. * locale/weightwc.h (findidx): Assume new locale format. * string/strcoll.c (wcscoll): Remove local variables size, layers, names. * string/strxfrm.c (wcsxfrm): Likewise. * posix/fnmatch_loop.c (internal_fnwmatch): Likewise. Change type of local variable collseq to 'const char *'. (SUFFIX): Don't use, don't undefine. * posix/fnmatch.c: Remove SUFFIX definition. * locale/programs/ld-collate.c (struct locale_collate_t): Remove fields plane_size, plane_cnt, wcheads, wcseqorder. Rename wcheads_3level to wcheads, rename wcseqorder_3level to wcseqorder. (collate_finish): Always create new locale format. Remove local variables min_total, act_size. (collate_output): Always create new locale format. Remove local variables table_size, names, tablewc. Rename tablewc_3level to tablewc. 2000-08-31 Bruno Haible <haible@clisp.cons.org> * locale/programs/ld-collate.c (obstack_int32_grow, obstack_int32_grow_fast): New inline functions. (output_weightwc, collate_output): Use them where possible.
Diffstat (limited to 'wctype')
-rw-r--r--wctype/Makefile7
-rw-r--r--wctype/cname-lookup.h62
-rw-r--r--wctype/iswctype.c31
-rw-r--r--wctype/iswctype_l.c32
-rw-r--r--wctype/towctrans.c19
-rw-r--r--wctype/towctrans_l.c19
-rw-r--r--wctype/wcextra.c54
-rw-r--r--wctype/wcextra_l.c55
-rw-r--r--wctype/wcfuncs.c65
-rw-r--r--wctype/wcfuncs_l.c79
-rw-r--r--wctype/wchar-lookup.h4
-rw-r--r--wctype/wctrans.c25
-rw-r--r--wctype/wctrans_l.c20
-rw-r--r--wctype/wctype.c20
-rw-r--r--wctype/wctype_l.c20
15 files changed, 49 insertions, 463 deletions
diff --git a/wctype/Makefile b/wctype/Makefile
index 78f66e7aed..c1a2de7e6b 100644
--- a/wctype/Makefile
+++ b/wctype/Makefile
@@ -22,10 +22,9 @@
subdir := wctype
headers := wctype.h
-distribute := cname-lookup.h wchar-lookup.h
-routines := wcfuncs wctype iswctype wctrans towctrans wcextra \
- wcfuncs_l wctype_l iswctype_l wctrans_l towctrans_l \
- wcextra_l
+distribute := wchar-lookup.h
+routines := wcfuncs wctype iswctype wctrans towctrans \
+ wcfuncs_l wctype_l iswctype_l wctrans_l towctrans_l
tests := test_wctype test_wcfuncs
diff --git a/wctype/cname-lookup.h b/wctype/cname-lookup.h
deleted file mode 100644
index 62111b60d1..0000000000
--- a/wctype/cname-lookup.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <endian.h>
-#include "../locale/localeinfo.h"
-
-/* Some words on the runtime of this functions. Although there is a
- loop in the function the runtime is asymptotically quasi constant.
- The reason is that even for the largest character sets HASH_LAYERS
- will not grow beyond 15 (a guess!). */
-#ifndef USE_IN_EXTENDED_LOCALE_MODEL
-static __inline size_t
-cname_lookup (wint_t wc)
-#else
-static __inline size_t
-cname_lookup (wint_t wc, __locale_t locale)
-#endif
-{
- unsigned int hash_size, hash_layers;
- size_t result, cnt;
-
-#ifndef USE_IN_EXTENDED_LOCALE_MODEL
- extern unsigned int *__ctype_names;
- hash_size = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE);
- hash_layers = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_LAYERS);
-
-#else
- struct locale_data *current = locale->__locales[LC_CTYPE];
- unsigned int *__ctype_names =
- (unsigned int *) current->values[_NL_ITEM_INDEX (_NL_CTYPE_NAMES)].string;
- hash_size =
- current->values[_NL_ITEM_INDEX (_NL_CTYPE_HASH_SIZE)].word;
- hash_layers =
- current->values[_NL_ITEM_INDEX (_NL_CTYPE_HASH_LAYERS)].word;
-#endif
-
- result = wc % hash_size;
- for (cnt = 0; cnt < hash_layers; ++cnt)
- {
- if (__ctype_names[result] == wc)
- break;
- result += hash_size;
- }
-
- return cnt < hash_layers ? result : ~((size_t) 0);
-}
diff --git a/wctype/iswctype.c b/wctype/iswctype.c
index 60475d0192..82d7ad14c4 100644
--- a/wctype/iswctype.c
+++ b/wctype/iswctype.c
@@ -20,36 +20,17 @@
#include <ctype.h>
#include <wctype.h>
-#include "cname-lookup.h"
#include "wchar-lookup.h"
-extern unsigned int *__ctype32_b;
-
-
int
__iswctype (wint_t wc, wctype_t desc)
{
- if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0)
- {
- /* Old locale format. */
- size_t idx;
-
- idx = cname_lookup (wc);
- if (idx == ~((size_t) 0))
- return 0;
-
- return __ctype32_b[idx] & desc;
- }
- else
- {
- /* If the user passes in an invalid DESC valid (the one returned from
- `wctype' in case of an error) simply return 0. */
- if (desc == (wctype_t) 0)
- return 0;
-
- /* New locale format. */
- return wctype_table_lookup ((const char *) desc, wc);
- }
+ /* If the user passes in an invalid DESC valid (the one returned from
+ `wctype' in case of an error) simply return 0. */
+ if (desc == (wctype_t) 0)
+ return 0;
+
+ return wctype_table_lookup ((const char *) desc, wc);
}
weak_alias (__iswctype, iswctype)
diff --git a/wctype/iswctype_l.c b/wctype/iswctype_l.c
index 192001e033..3bc25fdb6f 100644
--- a/wctype/iswctype_l.c
+++ b/wctype/iswctype_l.c
@@ -21,36 +21,16 @@
#include <wctype.h>
#define USE_IN_EXTENDED_LOCALE_MODEL 1
-#include "cname-lookup.h"
#include "wchar-lookup.h"
int
__iswctype_l (wint_t wc, wctype_t desc, __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] & desc;
- }
- else
- {
- /* If the user passes in an invalid DESC valid (the one returned from
- `__wctype_l' in case of an error) simply return 0. */
- if (desc == (wctype_t) 0)
- return 0;
-
- /* New locale format. */
- return wctype_table_lookup ((const char *) desc, wc);
- }
+ /* If the user passes in an invalid DESC valid (the one returned from
+ `__wctype_l' in case of an error) simply return 0. */
+ if (desc == (wctype_t) 0)
+ return 0;
+
+ return wctype_table_lookup ((const char *) desc, wc);
}
diff --git a/wctype/towctrans.c b/wctype/towctrans.c
index 498417b80a..86814477de 100644
--- a/wctype/towctrans.c
+++ b/wctype/towctrans.c
@@ -20,7 +20,6 @@
#include <wctype.h>
/* Define the lookup function. */
-#include "cname-lookup.h"
#include "wchar-lookup.h"
wint_t
@@ -31,22 +30,6 @@ __towctrans (wint_t wc, wctrans_t desc)
if (desc == (wctrans_t) 0)
return wc;
- if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0)
- {
- /* Old locale format. */
- 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) desc[idx];
- }
- else
- {
- /* New locale format. */
- return wctrans_table_lookup ((const char *) desc, wc);
- }
+ return wctrans_table_lookup ((const char *) desc, wc);
}
weak_alias (__towctrans, towctrans)
diff --git a/wctype/towctrans_l.c b/wctype/towctrans_l.c
index e3624441ca..ae8f2ac3f0 100644
--- a/wctype/towctrans_l.c
+++ b/wctype/towctrans_l.c
@@ -21,7 +21,6 @@
/* Define the lookup function. */
#define USE_IN_EXTENDED_LOCALE_MODEL 1
-#include "cname-lookup.h"
#include "wchar-lookup.h"
wint_t
@@ -32,21 +31,5 @@ __towctrans_l (wint_t wc, wctrans_t desc, __locale_t locale)
if (desc == (wctrans_t) 0)
return wc;
- if (locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_HASH_SIZE)].word != 0)
- {
- /* Old locale format. */
- size_t idx;
-
- idx = cname_lookup (wc, locale);
- if (idx == ~((size_t) 0))
- /* Character is not known. Default action is to simply return it. */
- return wc;
-
- return (wint_t) desc[idx];
- }
- else
- {
- /* New locale format. */
- return wctrans_table_lookup ((const char *) desc, wc);
- }
+ return wctrans_table_lookup ((const char *) desc, wc);
}
diff --git a/wctype/wcextra.c b/wctype/wcextra.c
deleted file mode 100644
index 581c6807de..0000000000
--- a/wctype/wcextra.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Additional non standardized wide character classification functions.
- Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <stdint.h>
-#define __NO_WCTYPE 1
-#include <wctype.h>
-
-#include "cname-lookup.h"
-#include "wchar-lookup.h"
-
-/* If the program is compiled without optimization the following declaration
- is not visible in the header. */
-extern unsigned int *__ctype32_b;
-
-/* This is not exported. */
-extern const char *__ctype32_wctype[12];
-
-int
-(iswblank) (wint_t wc)
-{
- if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0)
- {
- /* Old locale format. */
- size_t idx;
-
- idx = cname_lookup (wc);
- if (idx == ~((size_t) 0))
- return 0;
-
- return __ctype32_b[idx] & _ISwblank;
- }
- else
- {
- /* New locale format. */
- return wctype_table_lookup (__ctype32_wctype[__ISwblank], wc);
- }
-}
diff --git a/wctype/wcextra_l.c b/wctype/wcextra_l.c
deleted file mode 100644
index 8fc9c2733d..0000000000
--- a/wctype/wcextra_l.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Additional non standardized wide character classification functions.
- Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <stdint.h>
-#define __NO_WCTYPE 1
-#include <wctype.h>
-
-#define USE_IN_EXTENDED_LOCALE_MODEL 1
-#include "cname-lookup.h"
-#include "wchar-lookup.h"
-
-
-int
-(__iswblank_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 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 (__ISwblank);
- }
- else
- {
- /* New locale format. */
- size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + __ISwblank;
- const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
- return wctype_table_lookup (desc, wc);
- }
-}
diff --git a/wctype/wcfuncs.c b/wctype/wcfuncs.c
index ea697c2729..bed70b37de 100644
--- a/wctype/wcfuncs.c
+++ b/wctype/wcfuncs.c
@@ -16,20 +16,12 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define __NO_WCTYPE
#include <wctype.h>
-#include <ctype.h> /* For __ctype_tolower and __ctype_toupper. */
+#include <locale/localeinfo.h>
-#include "cname-lookup.h"
#include "wchar-lookup.h"
-/* If the program is compiled without optimization the following declaration
- is not visible in the header. */
-extern unsigned int *__ctype32_b;
-
/* These are not exported. */
-extern const uint32_t *__ctype32_toupper;
-extern const uint32_t *__ctype32_tolower;
extern const char *__ctype32_wctype[12];
extern const char *__ctype32_wctrans[2];
@@ -39,22 +31,7 @@ extern const char *__ctype32_wctrans[2];
int \
__##name (wint_t wc) \
{ \
- if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0) \
- { \
- /* Old locale format. */ \
- size_t idx; \
- \
- idx = cname_lookup (wc); \
- if (idx == ~((size_t) 0)) \
- return 0; \
- \
- return __ctype32_b[idx] & _ISwbit (type); \
- } \
- else \
- { \
- /* New locale format. */ \
- return wctype_table_lookup (__ctype32_wctype[type], wc); \
- } \
+ return wctype_table_lookup (__ctype32_wctype[type], wc); \
} \
weak_alias (__##name, name)
@@ -62,6 +39,8 @@ extern const char *__ctype32_wctrans[2];
func (iswalnum, __ISwalnum)
#undef iswalpha
func (iswalpha, __ISwalpha)
+#undef iswblank
+func (iswblank, __ISwblank)
#undef iswcntrl
func (iswcntrl, __ISwcntrl)
#undef iswdigit
@@ -85,44 +64,12 @@ wint_t
(towlower) (wc)
wint_t wc;
{
- if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0)
- {
- /* Old locale format. */
- 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) __ctype32_tolower[idx];
- }
- else
- {
- /* New locale format. */
- return wctrans_table_lookup (__ctype32_wctrans[__TOW_tolower], wc);
- }
+ return wctrans_table_lookup (__ctype32_wctrans[__TOW_tolower], wc);
}
wint_t
(towupper) (wc)
wint_t wc;
{
- if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0)
- {
- /* Old locale format. */
- 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) __ctype32_toupper[idx];
- }
- else
- {
- /* New locale format. */
- return wctrans_table_lookup (__ctype32_wctrans[__TOW_toupper], wc);
- }
+ return wctrans_table_lookup (__ctype32_wctrans[__TOW_toupper], wc);
}
diff --git a/wctype/wcfuncs_l.c b/wctype/wcfuncs_l.c
index 5ef543cc47..a552895316 100644
--- a/wctype/wcfuncs_l.c
+++ b/wctype/wcfuncs_l.c
@@ -16,12 +16,11 @@
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. */
@@ -29,32 +28,14 @@
#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);
}
diff --git a/wctype/wchar-lookup.h b/wctype/wchar-lookup.h
index 1d08492035..6941d21479 100644
--- a/wctype/wchar-lookup.h
+++ b/wctype/wchar-lookup.h
@@ -17,9 +17,11 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <stdint.h>
+
/* Tables indexed by a wide character are compressed through the use
of a multi-level lookup. The compression effect comes from blocks
- that don't need particular data and from block that can share their
+ that don't need particular data and from blocks that can share their
data. */
/* Bit tables are accessed by cutting wc in four blocks of bits:
diff --git a/wctype/wctrans.c b/wctype/wctrans.c
index 6c61c0b630..c35fe0ec17 100644
--- a/wctype/wctrans.c
+++ b/wctype/wctrans.c
@@ -17,21 +17,17 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <ctype.h>
#include <inttypes.h>
#include <string.h>
#include <wctype.h>
#include "../locale/localeinfo.h"
-/* These are not exported. */
-extern const uint32_t *__ctype32_toupper;
-extern const uint32_t *__ctype32_tolower;
-
wctrans_t
wctrans (const char *property)
{
const char *names;
size_t cnt;
+ size_t i;
names = _NL_CURRENT (LC_CTYPE, _NL_CTYPE_MAP_NAMES);
cnt = 0;
@@ -47,21 +43,6 @@ wctrans (const char *property)
if (names[0] == '\0')
return 0;
- if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0)
- {
- /* Old locale format. */
- if (cnt == __TOW_toupper)
- return (wctrans_t) __ctype32_toupper;
- else if (cnt == __TOW_tolower)
- return (wctrans_t) __ctype32_tolower;
-
- /* We have to search the table. */
- return (wctrans_t) (const int32_t *) _NL_CURRENT (LC_CTYPE, _NL_NUM_LC_CTYPE + cnt - 2);
- }
- else
- {
- /* New locale format. */
- size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + cnt;
- return (wctrans_t) _nl_current_LC_CTYPE->values[i].string;
- }
+ i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + cnt;
+ return (wctrans_t) _nl_current_LC_CTYPE->values[i].string;
}
diff --git a/wctype/wctrans_l.c b/wctype/wctrans_l.c
index 3b8b6050b5..94e2451926 100644
--- a/wctype/wctrans_l.c
+++ b/wctype/wctrans_l.c
@@ -25,6 +25,7 @@ __wctrans_l (const char *property, __locale_t locale)
{
const char *names;
size_t cnt;
+ size_t i;
names = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_NAMES)].string;
cnt = 0;
@@ -40,21 +41,6 @@ __wctrans_l (const char *property, __locale_t locale)
if (names[0] == '\0')
return 0;
- if (locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_HASH_SIZE)].word == 0)
- {
- /* Old locale format. */
- if (cnt == __TOW_toupper)
- return (wctrans_t) locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER32)].string;
- else if (cnt == __TOW_tolower)
- return (wctrans_t) locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER32)].string;
-
- /* We have to search the table. */
- return (wctrans_t) (const int32_t *) locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_NUM_LC_CTYPE + cnt - 2)].string;
- }
- else
- {
- /* New locale format. */
- size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + cnt;
- return (wctrans_t) locale->__locales[LC_CTYPE]->values[i].string;
- }
+ i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + cnt;
+ return (wctrans_t) locale->__locales[LC_CTYPE]->values[i].string;
}
diff --git a/wctype/wctype.c b/wctype/wctype.c
index 476707cfd2..7f2112e6ff 100644
--- a/wctype/wctype.c
+++ b/wctype/wctype.c
@@ -28,6 +28,7 @@ __wctype (const char *property)
const char *names;
unsigned int result;
size_t proplen = strlen (property);
+ size_t i;
names = _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS_NAMES);
for (result = 0; ; result++)
@@ -42,22 +43,7 @@ __wctype (const char *property)
return 0;
}
- if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_HASH_SIZE) != 0)
- {
- /* Old locale format. */
-#if __BYTE_ORDER == __BIG_ENDIAN
- return 1 << result;
-#else
-# define SWAPU32(w) \
- (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
- return 1 << (result ^ 0x18); /* = SWAPU32 (1 << result); */
-#endif
- }
- else
- {
- /* New locale format. */
- size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + result;
- return (wctype_t) _nl_current_LC_CTYPE->values[i].string;
- }
+ i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + result;
+ return (wctype_t) _nl_current_LC_CTYPE->values[i].string;
}
weak_alias (__wctype, wctype)
diff --git a/wctype/wctype_l.c b/wctype/wctype_l.c
index fdbd1ff451..72d79659dd 100644
--- a/wctype/wctype_l.c
+++ b/wctype/wctype_l.c
@@ -28,6 +28,7 @@ __wctype_l (const char *property, __locale_t locale)
const char *names;
unsigned int result;
size_t proplen = strlen (property);
+ size_t i;
names = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_NAMES)].string;
for (result = 0; ; result++)
@@ -42,21 +43,6 @@ __wctype_l (const char *property, __locale_t locale)
return 0;
}
- if (locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_HASH_SIZE)].word == 0)
- {
- /* Old locale format. */
-#if __BYTE_ORDER == __BIG_ENDIAN
- return 1 << result;
-#else
-# define SWAPU32(w) \
- (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
- return 1 << (result ^ 0x18); /* = SWAPU32 (1 << result); */
-#endif
- }
- else
- {
- /* New locale format. */
- size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + result;
- return (wctype_t) locale->__locales[LC_CTYPE]->values[i].string;
- }
+ i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + result;
+ return (wctype_t) locale->__locales[LC_CTYPE]->values[i].string;
}