Commit Graph

31 Commits

Author SHA1 Message Date
Yaakov Selkowitz 70ee6b17df ansification: remove _EXFUN, _EXFUN_NOTHROW
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:29 -06:00
Yaakov Selkowitz 0bda30e1ff ansification: remove _CONST
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:08 -06:00
Yaakov Selkowitz 90e35b1eb3 Rename <sys/_locale.h> to <xlocale.h>
The locale_t type is provided by <xlocale.h> on Linux, FreeBSD, and Darwin.
While, like on some of those systems, it is automatically included by
<locale.h> with the proper feature test macros, its presence under this
particular name is still presumed in real-world software.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-03-22 10:03:45 +01:00
Corinna Vinschen b0d341442c Constify __locale_ctype_ptr and __locale_ctype_ptr_l
Remove _MB_CAPABLE-only _CONST in ctype.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-17 09:40:28 +02:00
Corinna Vinschen 1a5d08014b setlocale.h: Fix current locale handling for !__HAVE_LOCALE_INFO__ targets
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:59 +02:00
Corinna Vinschen 7156bf842e Add sys/_locale.h header and fix up headers
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 8493c16316 Implement all per-locale ctype functions
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen a6a477fa81 POSIX-1.2008 per-thread locales, groundwork part 1
Introduce first cut of struct _thr_locale_t used for the locale_t definition.
Introduce global instance called __global_locale used by default.
Introduce internal inline functions __get_global_locale, __get_locale_r,
__get_current_locale.

Remove usage of global variables in favor of accessor functions pointing to
__global_locale for now.  Include all local headers in locale subdir from
setlocale.h to get single include for internal locale access.

Introduce __CTYPE_PTR macro to replace direct access to __ctype_ptr__
and use throughout in isxxx functions.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:56 +02:00
Yaakov Selkowitz 575608b202 Feature test macros overhaul: ctype.h
Simplify C99 test for isblank.  isascii and toascii are BSD|SVID|XSI.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:08:50 -05:00
Eric Blake 73db6db783 * libc/include/ctype.h (__ctype_lookup): Fix precedence. 2009-11-06 03:27:19 +00:00
Eric Blake 9b2b7c4a6b Fix isalpha(0x100000001LL) and friends on 64-bit machines.
* libc/include/ctype.h (__ctype_lookup): New macro.
(isalpha, isupper, islower, isdigit, isxdigit, isspace, ispunct)
(isalnum, isprint, isgraph, iscntrl, isblank): Use it to fix bug
on 64-bit machines.
2009-10-24 13:24:29 +00:00
Eric Blake 82b77480f7 Allow gcc warning for toupper even with extended charsets.
* libc/include/ctype.h (toupper, tolower)
[_MB_EXTENDED_CHARSETS_ISO]: Allow gcc warning when called with
'char' even when we must call the function for correct behavior.
[!_MB_EXTENDED_CHARSETS_ISO]: Fix regression in result type.
2009-04-30 22:53:00 +00:00
Eric Blake 190ccfc18c Be namespace clean in ctype.h.
* libc/include/ctype.h (_tolower, _toupper, isalpha, isupper)
(islower, isdigit, isxdigit, isspace, ispunct, isalnum)
(isprint, isgraph, iscntrl, isblank, toupper, tolower)
(isascii, toascii): Don't use 'c' as macro parameter name.
2009-04-24 12:27:36 +00:00
Eric Blake 1335bf3c5d Trigger gcc warning if isFoo macros are called with plain char.
* libc/include/ctype.h (isalpha, isupper, islower, isdigit)
(isxdigit, isspace, ispunct, isalnum, isprint, isgraph)
(iscntrl, isblank, toupper, tolower): Rewrite to let 'gcc -Wall'
warn when user calls macro with a char argument.
2009-04-24 12:20:07 +00:00
Corinna Vinschen a29a769342 * libc/ctype/ctype_.c (_CTYPE_DATA_0_127): Remove _B flag from TAB.
* libc/ctype/ctype_cp.h: Mark non-cased letters in tables for codepages
	720, 862, 874, 1255, and 1256 to _U|_L.  Fix a couple of incorrect
	class mappings.
	* libc/ctype/ctype_iso.h: Mark non-cased letters in ISO-8859 tables
	6, 8, and 11 to _U|_L.  Fix a couple of incorrect class mappings.
	* libc/ctype/isblank.c (isblank): Special case TAB.
	* libc/ctype/islower.c (islower): Check explicitely for _L flag only
	in (_U|_L).
	* libc/ctype/isupper.c (isupper): Ditto, but check for _U flag.
	* libc/include/ctype.h (islower): Same in macro.
	(isupper): Ditto.
	(isblank): Special case TAB.  Redefine macro for GCC only.
2009-04-09 10:37:58 +00:00
Corinna Vinschen 72c79be10e * libc/ctype/ctype_c.c: Move inclusion of ctype_iso.h and
ctype_cp.h out of ALLOW_NEGATIVE_CTYPE_INDEX case.
	(__ctype_ptr__): Constify in !_MB_CAPABLE case.  Otherwise,
	de-constify in !ALLOW_NEGATIVE_CTYPE_INDEX case, too.  Add comment.
	(__set_ctype): Set __ctype_ptr__ pointer according to definition
	of ALLOW_NEGATIVE_CTYPE_INDEX.
	* libc/include/ctype.h (__ctype_ptr__): Constify in !_MB_CAPABLE case.
2009-04-02 07:53:12 +00:00
Corinna Vinschen 4bc42c05aa * libc/ctype/Makefile.am: Remove _tolower.c and _toupper.c
source files.  Add a dependency rule for ctype_o to note
	changes in ctype_iso.h and ctype_cp.h.
	* libc/ctype/Makefile.in: Regenerate.
	* libc/ctype/_tolower.c: Remove file.
	* libc/ctype/_toupper.c: Remove file.
	* libc/ctype/ctype_.c: Make sure ALLOW_NEGATIVE_CTYPE_INDEX
	is always defined on Cygwin.
	(_ctype_b): Don't make `static const' on Cygwin.
	(ctype_iso.h): Include if _MB_EXTENDED_CHARSETS_ISO is set.
	(ctype_cp.h): Include if _MB_EXTENDED_CHARSETS_WINDOWS is set.
	(__ctype_ptr): Drop definition.
	(__ctype_ptr__): De-constify.  Mark as __EXPORT symbol.
	(_ctype_): Add Cygwin-specifc asm define.
	(__set_ctype): New function to set __ctype_ptr__ according to
	current charset.
	* libc/ctype/ctype_cp.h: New file containing Windows codepage
	specific character class tables.
	* libc/ctype/ctype_iso.h: New file containing ISO-8859-x
	specific character class tables.
	* libc/ctype/tolower.c (tolower): Reimplement to support any singlebyte
	charset if one of the extended charsets is enabled.
	* libc/ctype/toupper.c (toupper): Ditto.
	* libc/include/ctype.h (_tolower): Define as macro per POSIX.
	(_toupper): Ditto.
	(__ctype_ptr__): De-constify.
	(toupper): Disable macro on systems supporting extended charsets.
	(tolower): Ditto.
	* libc/include/sys/config.h (__EXPORT): Define empty if not defined.
	* libc/locale/locale.c (__mb_cur_max): Mark as __EXPORT symbol.
	(__set_ctype): Declare unconditionally.
	(loadlocale): Remove __CYGWIN__ guard around __set_ctype call.
2009-03-31 09:31:38 +00:00
Corinna Vinschen 7ca98b4901 * libc/ctype/ctype_.c (_CTYPE_DATA_0_127): Mark TAB as blank character.
* libc/ctype/isblank.c: Replace hardcoded test with test for having _B
	marker in ctype array.
	* libc/include/ctype.h (isblank): Add macro.
2009-03-26 09:45:11 +00:00
Jeff Johnston 6b35caa257 Fix typo and make C99 check the same as is used in math.h 2008-10-15 20:49:56 +00:00
Jeff Johnston bc5585e6e5 2008-10-15 Craig Howland <howland@LGSInnovations.com>
* libc/include/ctype.h (isblank):  isblank is C99.
	* libc/ctype/isblank.c (isblank comments):  ditto.  isblank does not
	have a macro version (as was claimed in the description).
2008-10-15 20:36:26 +00:00
Jeff Johnston 410c1d122d 2008-07-24 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/ctype.h (_ctype_): Restore for C++ backward
        compatability only.
2008-07-24 17:55:26 +00:00
Jeff Johnston fa914bf8ab 2008-07-21 Jeff Johnston <jjohnstn@redhat.com>
* libc/ctype/ctype_.c: Add new pointer __ctype_ptr__ which is one
        less than the old __ctype_ptr.
        * libc/ctype/isalnum.c: Use __ctype_ptr__.
        * libc/ctype/isalpha.c: Ditto.
        * libc/ctype/iscntrl.c: Ditto.
        * libc/ctype/isdigit.c: Ditto.
        * libc/ctype/islower.c: Ditto.
        * libc/ctype/isprint.c: Ditto.
        * libc/ctype/ispunct.c: Ditto.
        * libc/ctype/isspace.c: Ditto.
        * libc/ctype/isupper.c: Ditto.
        * libc/ctype/isxdigit.c: Ditto.
        * libc/include/ctype.h: Change ctype macros to use new __ctype_ptr__
        and add declaration of __ctype_ptr__.  Remove older ctype table pointers
        from here even though they can still work.
2008-07-21 21:28:34 +00:00
Jeff Johnston 45030958d3 2005-03-18 Hans-Peter Nilsson <hp@axis.com>
Corinna Vinschen  <corinna@vinschen.de>

        * libc/include/ctype.h: Remove invalid +1 offset from
        ctype macro references to __ctype_ptr.
        (_ctype_): Move declaration outside #ifndef __cplusplus.
2005-03-18 17:18:59 +00:00
Jeff Johnston dd801fdabd 2005-03-17 Jeff Johnston <jjohnstn@redhat.com>
* configure.in: Add new check to see if compiler supports
        aliasing of arrays and define _HAVE_ARRAY_ALIASING if true.
        * configure: Regenerated.
        * Makefile.in: Ditto.
        * newlib.hin: Add _HAVE_ARRAY_ALIASING.
        * libc/ctype/ctype_.c: Check for _HAVE_ARRAY_ALIASING before
        aliasing the _ctype_ array to _ctype_b.
        * libc/include/ctype.h: Change macros to use __ctype_ptr.  Mark
        _ctype_ as deprecated.
2005-03-17 20:11:23 +00:00
Jeff Johnston c1a3171f2d 2002-06-27 Benjamin Kosnik <bkoz@redhat.com>
* libc/include/stdio.h: Untangle, add _BEGIN_STD_C and _END_STD_C.
        * libc/include/time.h: Same.
        * libc/include/string.h: Same.
        * libc/include/stdlib.h: Same.
        * libc/include/signal.h: Same.
        * libc/include/setjmp.h: Same.
        * libc/include/math.h: Same.
        * libc/include/locale.h: Same.
        * libc/include/ctype.h: Same.
        * libc/include/machine/setjmp.h: Same.
        * libc/include/_ansi.h (_BEGIN_STD_C): Add.
        (_END_STD_C): Add.
2002-06-27 23:58:38 +00:00
Thomas Fitzsimmons af1c257a9b * libc/include/ctype.h: Remove isblank macro.
* libc/ctype/Makefile.am (LIB_SOURCES): Add isblank.c.
	* libc/ctype/isblank.c: New file.
	* libc/include/ctype.h [!__STRICT_ANSI__]: Add isblank
	declaration.  Add isblank macro.
2002-06-18 18:49:17 +00:00
Jeff Johnston 25842b68c7 2001-06-11 Danny Smith <dannysmith@users.sourceforge.net>
* /libc/include/ctype.h (is* and to* macros): Do not define if C++.
2001-06-11 21:51:41 +00:00
DJ Delorie 749d9bcd4b * libc/include/sys/config.h: define __IMPORT appropriately
* libc/include/ctype.h (_ctype_): use __IMPORT
* libc/include/math.h (__infinity, signam, _LIB_VERSION): ditto
* libc/include/math.h (__mb_cur_max): ditto
* libc/include/time.h (_timezone, _daylight, _tzname): ditto
* libc/include/unctrl.h (__unctrl, __unctrllen): ditto
* libc/include/errno.h (_sys_errlist, _sys_nerr): ditto
* libc/include/unistd.h (environ): ditto
2000-08-01 20:51:51 +00:00
Christopher Faylor d2dd57657c * libc/include/ctype.h: __CYGWIN32__ -> __CYGWIN__
* libc/include/malloc.h: Ditto.
* libc/include/process.h: Ditto.
* libc/include/stdio.h: Ditto.
* libc/include/stdlib.h: Ditto.
* libc/include/time.h: Ditto.
* libc/include/machine/setjmp.h: Ditto.
* libc/include/sys/errno.h: Ditto.
* libc/include/sys/signal.h: Ditto.
* libc/include/sys/stat.h: Ditto.
* libc/include/sys/time.h: Ditto.
* libc/include/sys/unistd.h: Ditto.
* libc/include/string.h: Ditto.  strsignal should return a const char *.
2000-05-30 17:18:05 +00:00
Jeff Johnston 2b533fac14 Mon May 15 18:54:00 2000 Jeff Johnston <jjohnstn@cygnus.com>
* libc/include/ctype.h: Changed tolower and toupper macros
        to use __extension__ to prevent pedantic warnings.
2000-05-15 23:00:24 +00:00
Christopher Faylor 8a0efa53e4 import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00