diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-01-11 20:13:43 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-01-11 20:13:43 +0000 |
commit | 390955cbdeb674bead490fc3f74a8a0893ea83cf (patch) | |
tree | 2900fdc697f52133f633c09edbbe712882736bf0 /wctype | |
parent | 68ef28edc2f1bafa417da1ac8d35a3bf2a1b565b (diff) | |
download | glibc-390955cbdeb674bead490fc3f74a8a0893ea83cf.tar glibc-390955cbdeb674bead490fc3f74a8a0893ea83cf.tar.gz glibc-390955cbdeb674bead490fc3f74a8a0893ea83cf.tar.bz2 glibc-390955cbdeb674bead490fc3f74a8a0893ea83cf.zip |
Update.
1999-01-11 Ulrich Drepper <drepper@cygnus.com>
* ctype/Versions [GLIBC_2.0]: Export __ctype32_b.
* include/wctype.h: Declare __iswctype.
* stdio-common/vfscanf.c (__vfscanf): Use __iswspace instead of
iswspace.
* wctype/Makefile (routines): Add wcextra_l.
* wctype/wcextra.c (iswblank): Implement function here and don't use
__iswctype.
(__iswblank_l): Move definition to...
* wctype/wcextra_l.c: ...here. New file.
* wctype/wcfuncs.c: Really implement functions and don't call
__iswctype or __towctrans.
* wctype/wctype.h: Change isw* and tow* macros. Don't call
__iswctype or __towctrans. Instead optimize constant argument case.
* iconv/gconv.h: Fix typos.
* iconv/skeleton.c: Fix typos. Optimize init function a bit.
Correctly emit escape sequence to return to initial state in
conversion function.
* iconvdata/iso-2022-jp.c (gconv_init): Correctly initialize
max_needed_to element.
* manual/mbyte.texi: Removed. This is now described in charset.texi.
* manual/charset.texi: New file.
* manual/Makefile (chapters): Replace mbyte by charset.
* manual/ctype.texi: Document wide character functions.
* manual/intro.texi: Fix reference to mbyte chapter.
* manual/lang.texi: Likewise.
* manual/locale.texi: Likewise.
* manual/stdio.texi: Likewise.
* manual/string.texi: Fix @node line for new charset chapter.
* manual/libc.texinfo (UPDATED): Updated. Also update copyright years.
* manual/memory.texi (savestring): Optimize code to give a good
example.
* manual/filesys.texi: Fix wording. Patches by Jim Meyering.
* nscd/nscd_getgr_r.c: Include stdint.h to get uintptr_t definition.
* nscd/nscd_getpw_r.c: Likewise.
* nscd/nscd_gethst_r.c: Likewise.
* stdlib/stdtold_l.c: Always include xlocale.h.
1999-01-11 Geoffrey Keating <geoffk@ozemail.com.au>
* stdlib/fpioconst.h (LDBL_MAX_10_EXP_LOG): Define to be same as
DBL_MAX_10_EXP_LOG if there is no long double.
(_fpioconst_pow10): Always use size as LDBL_MAX_10_EXP_LOG to match
printf_fp.c.
1999-01-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* timezone/Makefile ($(testdata)/GB): Changed to ...
($(testdata)/Europe/London): ... for tst-timezone test.
($(objpfx)tst-timezone.out): Change GB to Europe/London.
* timezone/tst-timezone.c (main): Enable DST switching test,
change GB to Europe/London.
1999-01-10 Philip Blundell <philb@gnu.org>
* socket/Makefile (headers): Remove bits/sockunion.h.
1999-01-09 Philip Blundell <philb@gnu.org>
* socket/sys/socket.h: Don't include <bits/sockunion.h>.
* sysdeps/generic/bits/sockunion.h: Deleted.
* sysdeps/unix/sysv/linux/bits/sockunion.h: Likewise.
1999-01-08 H.J. Lu <hjl@gnu.org>
* io/fts.c (fts_close): Don't access memory after having it freed.
Diffstat (limited to 'wctype')
-rw-r--r-- | wctype/Makefile | 4 | ||||
-rw-r--r-- | wctype/wcextra.c | 18 | ||||
-rw-r--r-- | wctype/wcextra_l.c | 43 | ||||
-rw-r--r-- | wctype/wcfuncs.c | 50 | ||||
-rw-r--r-- | wctype/wctype.h | 108 |
5 files changed, 160 insertions, 63 deletions
diff --git a/wctype/Makefile b/wctype/Makefile index 16a7f329fa..3484ea5d68 100644 --- a/wctype/Makefile +++ b/wctype/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 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 @@ -24,7 +24,7 @@ subdir := wctype headers := wctype.h distribute := cname-lookup.h routines := wcfuncs wctype iswctype wctrans towctrans wcextra \ - wcfuncs_l iswctype_l towctrans_l wctype_l + wcfuncs_l iswctype_l towctrans_l wctype_l wcextra_l tests := test_wctype diff --git a/wctype/wcextra.c b/wctype/wcextra.c index 111f7ec5d2..7f63e7efeb 100644 --- a/wctype/wcextra.c +++ b/wctype/wcextra.c @@ -1,5 +1,5 @@ /* Additional non standardized wide character classification functions. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -18,18 +18,20 @@ 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" + int -iswblank (wint_t wc) +(iswblank) (wint_t wc) { - return __iswctype (wc, _ISwblank); -} + size_t idx; + idx = cname_lookup (wc); + if (idx == ~((size_t) 0)) + return 0; -int -(__iswblank_l) (wint_t wc, __locale_t locale) -{ - return __iswctype_l (wc, _ISwblank, locale); + return __ctype32_b[idx] & _ISwblank; } diff --git a/wctype/wcextra_l.c b/wctype/wcextra_l.c new file mode 100644 index 0000000000..d326327954 --- /dev/null +++ b/wctype/wcextra_l.c @@ -0,0 +1,43 @@ +/* Additional non standardized wide character classification functions. + Copyright (C) 1997, 1999 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" + + +int +(__iswblank_l) (wint_t wc, __locale_t locale) +{ + const unsigned int *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] & _ISwblank; +} 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]; } diff --git a/wctype/wctype.h b/wctype/wctype.h index c4f4f6ca02..0ecb69d6bd 100644 --- a/wctype/wctype.h +++ b/wctype/wctype.h @@ -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 @@ -166,6 +166,56 @@ extern wctype_t wctype __P ((__const char *__property)); extern int __iswctype __P ((wint_t __wc, wctype_t __desc)); extern int iswctype __P ((wint_t __wc, wctype_t __desc)); +#if __GNUC__ >= 2 && defined __OPTIMIZE__ +/* The tables are always organized in a way which allows direct access + for single byte characters. */ +extern unsigned int *__ctype32_b; + +# define iswalnum(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwalnum) : iswalnum (wc)) +# define iswalpha(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwalpha) : iswalpha (wc)) +# define iswcntrl(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwcntrl) : iswcntrl (wc)) +# define iswdigit(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwdigit) : iswdigit (wc)) +# define iswlower(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwlower) : iswlower (wc)) +# define iswgraph(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwgraph) : iswgraph (wc)) +# define iswprint(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwprint) : iswprint (wc)) +# define iswpunct(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwpunct) : iswpunct (wc)) +# define iswspace(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwspace) : iswspace (wc)) +# define iswupper(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwupper) : iswupper (wc)) +# define iswxdigit(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwxdigit) : iswxdigit (wc)) + +# ifdef __USE_GNU +# define iswblank(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & _ISwblank) : iswblank (wc)) +# endif + +# define iswctype(wc, desc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (int) (__ctype32_b[wc] & desc) : iswctype (wc, desc)) + +#endif /* gcc && optimizing */ /* * Wide-character case-mapping functions: 7.15.3.1. @@ -184,33 +234,20 @@ extern wint_t towupper __P ((wint_t __wc)); /* Map the wide character WC using the mapping described by DESC. */ extern wint_t __towctrans __P ((wint_t __wc, wctrans_t __desc)); - -# ifndef __NO_WCTYPE -# define iswalnum(wc) __iswctype ((wc), _ISwalnum) -# define iswalpha(wc) __iswctype ((wc), _ISwalpha) -# define iswcntrl(wc) __iswctype ((wc), _ISwcntrl) -# define iswdigit(wc) __iswctype ((wc), _ISwdigit) -# define iswlower(wc) __iswctype ((wc), _ISwlower) -# define iswgraph(wc) __iswctype ((wc), _ISwgraph) -# define iswprint(wc) __iswctype ((wc), _ISwprint) -# define iswpunct(wc) __iswctype ((wc), _ISwpunct) -# define iswspace(wc) __iswctype ((wc), _ISwspace) -# define iswupper(wc) __iswctype ((wc), _ISwupper) -# define iswxdigit(wc) __iswctype ((wc), _ISwxdigit) - -# ifdef __USE_GNU -# define iswblank(wc) __iswctype ((wc), _ISwblank) -# endif - - -/* Pointer to conversion tables. */ +#if __GNUC__ >= 2 && defined __OPTIMIZE__ +/* The tables are always organized in a way which allows direct access + for single byte characters. */ extern __const __int32_t *__ctype_tolower; /* Case conversions. */ extern __const __int32_t *__ctype_toupper; /* Case conversions. */ -# define towlower(wc) __towctrans ((wc), __ctype_tolower) -# define towupper(wc) __towctrans ((wc), __ctype_toupper) +# define towlower(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (wint_t) __ctype_tolower[wc] : towlower (wc)) +# define towuppert(wc) \ + (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \ + ? (wint_t) __ctype_toupper[wc] : towupper (wc)) -# endif /* Not __NO_WCTYPE. */ +#endif /* gcc && optimizing */ __END_DECLS @@ -317,29 +354,6 @@ extern wint_t __towupper_l __P ((wint_t __wc, __locale_t __locale)); extern wint_t __towctrans_l __P ((wint_t __wc, wctrans_t __desc, __locale_t __locale)); - -# ifndef __NO_WCTYPE -# define __iswalnum_l(wc, loc) __iswctype_l ((wc), _ISwalnum, (loc)) -# define __iswalpha_l(wc, loc) __iswctype_l ((wc), _ISwalpha, (loc)) -# define __iswcntrl_l(wc, loc) __iswctype_l ((wc), _ISwcntrl, (loc)) -# define __iswdigit_l(wc, loc) __iswctype_l ((wc), _ISwdigit, (loc)) -# define __iswlower_l(wc, loc) __iswctype_l ((wc), _ISwlower, (loc)) -# define __iswgraph_l(wc, loc) __iswctype_l ((wc), _ISwgraph, (loc)) -# define __iswprint_l(wc, loc) __iswctype_l ((wc), _ISwprint, (loc)) -# define __iswpunct_l(wc, loc) __iswctype_l ((wc), _ISwpunct, (loc)) -# define __iswspace_l(wc, loc) __iswctype_l ((wc), _ISwspace, (loc)) -# define __iswupper_l(wc, loc) __iswctype_l ((wc), _ISwupper, (loc)) -# define __iswxdigit_l(wc, loc) __iswctype_l ((wc), _ISwxdigit, (loc)) - -# define __iswblank_l(wc, loc) __iswctype_l ((wc), _ISwblank, (loc)) - -# define __towlower_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_tolower, \ - (loc)) -# define __towupper_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_toupper, \ - (loc)) - -# endif /* Not __NO_WCTYPE. */ - # endif /* Use GNU. */ __END_DECLS |