summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-08-01 20:08:59 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-08-01 20:08:59 +0000
commit1217289737588e65b088b3535428b27c7287d699 (patch)
tree6a292ac767d219702e26a6a2111737f84a96900c /libc
parent32b76c5ec3c257b7287913d0d1a96e0cbb2e9c6a (diff)
Add a new *scanf implementation, includeing the *wscanf functions.
Should be standards compliant and with several optional features, including support for hexadecimal float notation, locale awareness, glibc-like locale-specific digit grouping with the `'' flag, and positional arg support. I tested it pretty well (finding several bugs in glibc's scanf in the process), but it is brand new so be aware. The *wprintf functions now support floating point output. Also, a couple of bugs were squashed. Finally, %a/%A conversions are now implemented. Implement the glibc xlocale interface for thread-specific locale support. Also add the various *_l(args, locale_t loc_arg) funcs. NOTE!!! setlocale() is NOT threadsafe! NOTE!!! The strto{floating point} conversion functions are now locale aware. The also now support hexadecimal floating point notation. Add the wcsto{floating point} conversion functions. Fix a bug in mktime() related to dst. Note that unlike glibc's mktime, uClibc's version always normalizes the struct tm before attempting to determine the correct dst setting if tm_isdst == -1 on entry. Add a stub version of the libintl functions. (untested) Fixed a known memory leak in setlocale() related to the collation data. Add lots of new config options (which Erik agreed to sort out :-), including finally exposing some of the stripped down stdio configs. Be careful with those though, as they haven't been tested in a long time. (temporary) GOTCHAs... The ctype functions are currently incorrect for 8-bit locales. They will be fixed shortly. The ctype functions are now table-based, resulting in larger staticly linked binaries. I'll be adding an option to use the old approach in the stub locale configuration.
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/rpc/rcmd.c13
-rw-r--r--libc/misc/Makefile4
-rw-r--r--libc/misc/assert/__assert.c16
-rw-r--r--libc/misc/ctype/Makefile29
-rw-r--r--libc/misc/ctype/ctype.c1041
-rw-r--r--libc/misc/intl/Makefile50
-rw-r--r--libc/misc/intl/intl.c149
-rw-r--r--libc/misc/locale/Makefile31
-rw-r--r--libc/misc/locale/locale.c1103
-rw-r--r--libc/misc/time/Makefile13
-rw-r--r--libc/misc/time/time.c245
-rw-r--r--libc/misc/wchar/Makefile1
-rw-r--r--libc/misc/wchar/wchar.c111
-rw-r--r--libc/misc/wchar/wstdio.c37
-rw-r--r--libc/misc/wctype/Makefile20
-rw-r--r--libc/misc/wctype/wctype.c661
-rw-r--r--libc/stdio/Makefile12
-rw-r--r--libc/stdio/old_vfprintf.c9
-rw-r--r--libc/stdio/printf.c1151
-rw-r--r--libc/stdio/scanf.c2370
-rw-r--r--libc/stdio/stdio.c200
-rw-r--r--libc/stdlib/Makefile48
-rw-r--r--libc/stdlib/stdlib.c252
-rw-r--r--libc/stdlib/strtod.c711
-rw-r--r--libc/string/Makefile32
-rw-r--r--libc/string/wstring.c262
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_ctype.h2
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_fpmax.h132
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_locale.h129
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_stdio.h123
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_touplow.h44
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_uwchar.h56
-rw-r--r--libc/sysdeps/linux/common/bits/xopen_lim.h6
-rw-r--r--libc/unistd/getopt.c6
34 files changed, 6903 insertions, 2166 deletions
diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c
index b8138497c..618a6f1b2 100644
--- a/libc/inet/rpc/rcmd.c
+++ b/libc/inet/rpc/rcmd.c
@@ -38,11 +38,6 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#define __FORCE_GLIBC
#include <features.h>
-#ifdef __UCLIBC_HAS_THREADS__
-#undef __UCLIBC_HAS_THREADS__
-#warning FIXME I am not reentrant yet...
-#endif
-
#define __USE_GNU
#include <ctype.h>
#include <stdio.h>
@@ -62,10 +57,10 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#include <netinet/in.h>
#include <arpa/inet.h>
-
-
-/* hmm. uClibc seems to have that, but it doesn't work for some reason */
-#define getc_unlocked getc
+#ifdef __UCLIBC_HAS_THREADS__
+#undef __UCLIBC_HAS_THREADS__
+#warning FIXME I am not reentrant yet...
+#endif
/* some forward declarations */
diff --git a/libc/misc/Makefile b/libc/misc/Makefile
index 46de813da..037e2154d 100644
--- a/libc/misc/Makefile
+++ b/libc/misc/Makefile
@@ -26,8 +26,8 @@ include $(TOPDIR)Rules.mak
DIRS = assert ctype dirent file fnmatch glob internals \
- mntent syslog time utmp locale sysvipc statfs \
- error ttyent gnu search
+ mntent syslog time utmp sysvipc statfs \
+ error ttyent gnu search intl locale
ifeq ($(strip $(UCLIBC_HAS_REGEX)),y)
DIRS += regex
endif
diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c
index efffff1de..26bcc6516 100644
--- a/libc/misc/assert/__assert.c
+++ b/libc/misc/assert/__assert.c
@@ -37,15 +37,21 @@
#include <assert.h>
#undef assert
+
+#define ASSERT_SHOW_PROGNAME 1
+
+#ifdef ASSERT_SHOW_PROGNAME
+extern const char *__progname;
+#endif
+
#if 1
void __assert(const char *assertion, const char * filename,
int linenumber, register const char * function)
{
fprintf(stderr,
-#if 0
- /* TODO: support program_name like glibc? */
- "%s: %s: %d: %s: Assertion `%s' failed.\n", program_name,
+#ifdef ASSERT_SHOW_PROGNAME
+ "%s: %s: %d: %s: Assertion `%s' failed.\n", __progname,
#else
"%s: %d: %s: Assertion `%s' failed.\n",
#endif
@@ -66,8 +72,8 @@ void __assert(const char *assertion, const char * filename,
char buf[__BUFLEN_INT10TOSTR];
_stdio_fdout(STDERR_FILENO,
-#if 0
- program_name, /* TODO: support program_name like glibc? */
+#ifdef ASSERT_SHOW_PROGNAME
+ __progname,
": ",
#endif
filename,
diff --git a/libc/misc/ctype/Makefile b/libc/misc/ctype/Makefile
index 1d7c24535..2f1dd65f0 100644
--- a/libc/misc/ctype/Makefile
+++ b/libc/misc/ctype/Makefile
@@ -25,17 +25,26 @@ TOPDIR=../../../
include $(TOPDIR)Rules.mak
MSRC=ctype.c
-MOBJ= isalnum.o isalpha.o isascii.o iscntrl.o isdigit.o isgraph.o \
- islower.o isprint.o ispunct.o isspace.o isupper.o isxdigit.o \
- isxlower.o isxupper.o toascii.o tolower.o toupper.o isblank.o \
- __isctype_loc.o
+MOBJ= isalnum.o isalpha.o isascii.o iscntrl.o isdigit.o \
+ isgraph.o islower.o isprint.o ispunct.o isspace.o \
+ isupper.o isxdigit.o toascii.o tolower.o toupper.o \
+ isblank.o isctype.o isxlower.o isxupper.o \
+ __C_ctype_b.o __C_ctype_tolower.o __C_ctype_toupper.o \
+ __ctype_b_loc.o __ctype_tolower_loc.o __ctype_toupper_loc.o \
+ __ctype_assert.o
-CSRC=junk.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
+MOBJx= isalnum_l.o isalpha_l.o isascii_l.o iscntrl_l.o isdigit_l.o \
+ isgraph_l.o islower_l.o isprint_l.o ispunct_l.o isspace_l.o \
+ isupper_l.o isxdigit_l.o toascii_l.o tolower_l.o toupper_l.o \
+ isblank_l.o # isxlower_l.o isxupper_l.o
+OBJS=$(MOBJ)
-OBJS=$(MOBJ) $(COBJS)
-all: $(MOBJ) $(LIBC)
+ifeq ($(UCLIBC_HAS_XLOCALE),y)
+ OBJS += $(MOBJx)
+endif
+
+all: $(OBJS) $(LIBC)
$(LIBC): ar-target
@@ -46,8 +55,8 @@ $(MOBJ): $(MSRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
$(STRIPTOOL) -x -R .note -R .comment $*.o
-$(COBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
+$(MOBJx): $(MSRC)
+ $(CC) $(CFLAGS) -DL_$* -D__UCLIBC_DO_XLOCALE $< -c -o $*.o
$(STRIPTOOL) -x -R .note -R .comment $*.o
$(OBJS): Makefile
diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c
index dedd5c00a..0eb97140d 100644
--- a/libc/misc/ctype/ctype.c
+++ b/libc/misc/ctype/ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Manuel Novoa III
+/* Copyright (C) 2003 Manuel Novoa III
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -31,299 +31,1026 @@
#include <ctype.h>
#include <stdio.h>
+#include <stdlib.h>
#include <limits.h>
+#include <stdint.h>
#include <assert.h>
#include <locale.h>
+#ifdef __UCLIBC_HAS_XLOCALE__
+#include <xlocale.h>
+#endif /* __UCLIBC_HAS_XLOCALE__ */
+
/**********************************************************************/
-extern int __isctype_loc(int c, int ct);
+#ifdef __UCLIBC_HAS_CTYPE_SIGNED__
-/* Some macros used throughout the file. */
-#define U ((unsigned char)c)
-/* #define LCT (__cur_locale->ctype) */
-#define LCT (&__global_locale)
+#if EOF >= CHAR_MIN
+#define CTYPE_DOMAIN_CHECK(C) \
+ (((unsigned int)((C) - CHAR_MIN)) <= (UCHAR_MAX - CHAR_MIN))
+#else
+#define CTYPE_DOMAIN_CHECK(C) \
+ ((((unsigned int)((C) - CHAR_MIN)) <= (UCHAR_MAX - CHAR_MIN)) || ((C) == EOF))
+#endif
-/**********************************************************************/
+#else /* __UCLIBC_HAS_CTYPE_SIGNED__ */
-#ifndef __PASTE
-#define __PASTE(X,Y) X ## Y
+#if EOF == -1
+#define CTYPE_DOMAIN_CHECK(C) \
+ (((unsigned int)((C) - EOF)) <= (UCHAR_MAX - EOF))
+#else
+#define CTYPE_DOMAIN_CHECK(C) \
+ ((((unsigned int)(C)) <= UCHAR_MAX) || ((C) == EOF))
#endif
-#define C_MACRO(X) __PASTE(__C_,X)(c)
-
-#define CT_MACRO(X) __PASTE(__ctype_,X)(c)
+#endif /* __UCLIBC_HAS_CTYPE_SIGNED__ */
/**********************************************************************/
+#ifdef __UCLIBC_MJN3_ONLY__
+#ifdef L_isspace
+/* emit only once */
+#warning CONSIDER: Should we assert when debugging and __UCLIBC_HAS_CTYPE_CHECKED?
+#warning TODO: Fix asserts in to{upper|lower}{_l}.
+#warning TODO: Optimize the isx*() funcs.
+#endif
+#endif /* __UCLIBC_MJN3_ONLY__ */
+
+#undef CTYPE_NAME
+#undef ISCTYPE
+#undef CTYPE_ALIAS
+#ifdef __UCLIBC_DO_XLOCALE
+#define CTYPE_NAME(X) __is ## X ## _l
+#define ISCTYPE(C,F) __isctype_l( C, F, locale_arg)
+#define CTYPE_ALIAS(NAME) weak_alias( __is ## NAME ## _l , is ## NAME ## _l)
+#else
+#define CTYPE_NAME(X) is ## X
+#define ISCTYPE(C,F) __isctype( C, F )
+#define CTYPE_ALIAS(NAME)
+#endif
+#undef PASTE2
+#define PASTE2(X,Y) X ## Y
-#ifndef __CTYPE_HAS_8_BIT_LOCALES
-#define IS_FUNC_BODY(NAME) \
-int NAME (int c) \
-{ \
- return C_MACRO(NAME); \
-}
+#undef CTYPE_BODY
+
+#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
+/* Make sure assert is active for to*() funcs below. */
+#undef NDEBUG
+#include <assert.h>
+
+extern void __isctype_assert(int c, int mask) __attribute__ ((__noreturn__));
+
+#define CTYPE_BODY(NAME,C,MASK) \
+ if (CTYPE_DOMAIN_CHECK(C)) { \
+ return ISCTYPE(C, MASK); \
+ } \
+ __isctype_assert(C, MASK);
+
+#elif defined(__UCLIBC_HAS_CTYPE_CHECKED__)
+
+#define CTYPE_BODY(NAME,C,MASK) \
+ return CTYPE_DOMAIN_CHECK(C) \
+ ? ISCTYPE(C, MASK) \
+ : 0;
+
+#elif defined(__UCLIBC_HAS_CTYPE_UNSAFE__)
+
+#define CTYPE_BODY(NAME,C,MASK) \
+ return ISCTYPE(C, MASK);
+
+
+#else /* No checking done. */
+
+#error Unknown type of ctype checking!
+
+#endif
-#else
-/* It may be worth defining __isctype_loc over the whole range of char. */
-/* #define IS_FUNC_BODY(NAME) \ */
-/* int NAME (int c) \ */
-/* { \ */
-/* return __isctype_loc(c, __PASTE(_CTYPE_,NAME)); \ */
-/* } */
#define IS_FUNC_BODY(NAME) \
-int NAME (int c) \
+int CTYPE_NAME(NAME) (int c __LOCALE_PARAM ) \
{ \
- if (((unsigned int) c) <= 0x7f) { \
- return C_MACRO(NAME); \
- } \
- return __isctype_loc(c, __PASTE(_CTYPE_,NAME)); \
+ CTYPE_BODY(NAME,c,PASTE2(_IS,NAME)) \
+} \
+CTYPE_ALIAS(NAME)
+
+
+/**********************************************************************/
+#ifdef L___ctype_assert
+#ifdef __UCLIBC_HAS_CTYPE_ENFORCED__
+
+extern const char *__progname;
+
+void __isctype_assert(int c, int mask)
+{
+ fprintf(stderr, "%s: __is*{_l}(%d,%#x {locale})\n", __progname, c, mask);
+ abort();
}
-#endif /* __CTYPE_HAS_8_BIT_LOCALES */
+#endif
+#endif
+/**********************************************************************/
+#if defined(L_isalnum) || defined(L_isalnum_l)
+
+IS_FUNC_BODY(alnum);
+
+#endif
+/**********************************************************************/
+#if defined(L_isalpha) || defined(L_isalpha_l)
+IS_FUNC_BODY(alpha);
+
+#endif
/**********************************************************************/
-#ifdef L_isalnum
+#if defined(L_isblank) || defined(L_isblank_l)
-IS_FUNC_BODY(isalnum);
+IS_FUNC_BODY(blank);
#endif
/**********************************************************************/
-#ifdef L_isalpha
+#if defined(L_iscntrl) || defined(L_iscntrl_l)
-IS_FUNC_BODY(isalpha);
+IS_FUNC_BODY(cntrl);
#endif
/**********************************************************************/
-#ifdef L_isblank
+#if defined(L_isdigit) || defined(L_isdigit_l)
-/* Warning!!! This is correct for all the currently supported 8-bit locales.
- * If any are added though, this will need to be verified. */
+/* The standards require EOF < 0. */
+#if EOF >= CHAR_MIN
+#define __isdigit_char_or_EOF(C) __isdigit_char((C))
+#else
+#define __isdigit_char_or_EOF(C) __isdigit_int((C))
+#endif
-int isblank(int c)
+int CTYPE_NAME(digit) (int C __LOCALE_PARAM)
{
- return __isblank(c);
+#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
+ if (CTYPE_DOMAIN_CHECK(C)) {
+ return __isdigit_char_or_EOF(C); /* C is (unsigned) char or EOF. */
+ }
+ __isctype_assert(C, _ISdigit);
+#else
+ return __isdigit_int(C); /* C could be invalid. */
+#endif
}
+CTYPE_ALIAS(digit)
+
#endif
/**********************************************************************/
-#ifdef L_iscntrl
+#if defined(L_isgraph) || defined(L_isgraph_l)
-IS_FUNC_BODY(iscntrl);
+IS_FUNC_BODY(graph);
#endif
/**********************************************************************/
-#ifdef L_isdigit
+#if defined(L_islower) || defined(L_islower_l)
-int isdigit(int c)
-{
- return __isdigit(c);
-}
+IS_FUNC_BODY(lower);
#endif
/**********************************************************************/
-#ifdef L_isgraph
+#if defined(L_isprint) || defined(L_isprint_l)
-IS_FUNC_BODY(isgraph);
+IS_FUNC_BODY(print);
#endif
/**********************************************************************/
-#ifdef L_islower
+#if defined(L_ispunct) || defined(L_ispunct_l)
-IS_FUNC_BODY(islower);
+IS_FUNC_BODY(punct);
#endif
/**********************************************************************/
-#ifdef L_isprint
+#if defined(L_isspace) || defined(L_isspace_l)
-IS_FUNC_BODY(isprint);
+IS_FUNC_BODY(space);
#endif
/**********************************************************************/
-#ifdef L_ispunct
+#if defined(L_isupper) || defined(L_isupper_l)
-IS_FUNC_BODY(ispunct);
+IS_FUNC_BODY(upper);
#endif
/**********************************************************************/
-#ifdef L_isspace
+#if defined(L_isxdigit) || defined(L_isxdigit_l)
-/* Warning!!! This is correct for all the currently supported 8-bit locales.
- * If any are added though, this will need to be verified. */
+IS_FUNC_BODY(xdigit);
-int isspace(int c)
+#endif
+/**********************************************************************/
+#ifdef L_tolower
+
+int tolower(int c)
{
- return __isspace(c);
+#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
+ assert(CTYPE_DOMAIN_CHECK(c));
+#endif
+ return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? (__UCLIBC_CTYPE_TOLOWER)[c] : c;
}
#endif
/**********************************************************************/
-#ifdef L_isupper
+#ifdef L_tolower_l
+
+#undef tolower_l
-IS_FUNC_BODY(isupper);
+int tolower_l(int c, __locale_t l)
+{
+#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
+ assert(CTYPE_DOMAIN_CHECK(c));
+#endif
+ return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_tolower[c] : c;
+}
#endif
/**********************************************************************/
-#ifdef L_isxdigit
+#ifdef L_toupper
-int isxdigit(int c)
+int toupper(int c)
{
- return __isxdigit(c);
+#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
+ assert(CTYPE_DOMAIN_CHECK(c));
+#endif
+ return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? (__UCLIBC_CTYPE_TOUPPER)[c] : c;
}
#endif
/**********************************************************************/
-#ifdef L_tolower
+#ifdef L_toupper_l
-#ifdef __CTYPE_HAS_8_BIT_LOCALES
+#undef toupper_l
-int tolower(int c)
+int toupper_l(int c, __locale_t l)
{
- return ((((unsigned int) c) <= 0x7f)
- || (LCT->encoding != __ctype_encoding_8_bit))
- ? __C_tolower(c)
- : ( __isctype_loc(c, _CTYPE_isupper)
- ? (unsigned char)
- ( U - LCT->tbl8uplow[ ((int)
- (LCT->idx8uplow[(U & 0x7f)
- >> Cuplow_IDX_SHIFT])
- << Cuplow_IDX_SHIFT)
- + (U & ((1 << Cuplow_IDX_SHIFT) - 1)) ])
- : c );
+#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
+ assert(CTYPE_DOMAIN_CHECK(c));
+#endif
+ return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c;
}
-#else /* __CTYPE_HAS_8_BIT_LOCALES */
+#endif
+/**********************************************************************/
+#if defined(L_isascii) || defined(L_isascii_l)
-int tolower(int c)
+int __XL(isascii)(int c)
{
- return __C_tolower(c);
+ return __isascii(c); /* locale-independent */
}
-#endif /* __CTYPE_HAS_8_BIT_LOCALES */
-
#endif
/**********************************************************************/
-#ifdef L_toupper
-
-#ifdef __CTYPE_HAS_8_BIT_LOCALES
+#if defined(L_toascii) || defined(L_toascii_l)
-int toupper(int c)
+int __XL(toascii)(int c)
{
- return ((((unsigned int) c) <= 0x7f)
- || (LCT->encoding != __ctype_encoding_8_bit))
- ? __C_toupper(c)
- : ( __isctype_loc(c, _CTYPE_islower)
- ? (unsigned char)
- ( U + LCT->tbl8uplow[ ((int)
- (LCT->idx8uplow[(U & 0x7f)
- >> Cuplow_IDX_SHIFT])
- << Cuplow_IDX_SHIFT)
- + (U & ((1 << Cuplow_IDX_SHIFT) - 1)) ])
- : c );
+ return __toascii(c); /* locale-independent */
}
-#else /* __CTYPE_HAS_8_BIT_LOCALES */
+#endif
+/**********************************************************************/
+/* old uClibc extensions */
+/**********************************************************************/
+#ifdef L_isxlower
-int toupper(int c)
+int isxlower(int C)
{
- return __C_toupper(c);
+#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
+ assert(CTYPE_DOMAIN_CHECK(C));
+ return (__isctype(C, (_ISxdigit|_ISupper)) == _ISxdigit);
+#elif defined(__UCLIBC_HAS_CTYPE_CHECKED__)
+ return CTYPE_DOMAIN_CHECK(C)
+ ? (__isctype(C, (_ISxdigit|_ISupper)) == _ISxdigit)
+ : 0;
+#elif defined(__UCLIBC_HAS_CTYPE_UNSAFE__)
+ return (__isctype(C, (_ISxdigit|_ISupper)) == _ISxdigit);
+#else /* No checking done. */
+#error Unknown type of ctype checking!
+#endif
}
-#endif /* __CTYPE_HAS_8_BIT_LOCALES */
+#endif
+/**********************************************************************/
+#ifdef L_isxupper
+
+int isxupper(int C)
+{
+#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
+ assert(CTYPE_DOMAIN_CHECK(C));
+ return (__isctype(C, (_ISxdigit|_ISlower)) == _ISxdigit);
+#elif defined(__UCLIBC_HAS_CTYPE_CHECKED__)
+ return CTYPE_DOMAIN_CHECK(C)
+ ? (__isctype(C, (_ISxdigit|_ISlower)) == _ISxdigit)
+ : 0;
+#elif defined(__UCLIBC_HAS_CTYPE_UNSAFE__)
+ return (__isctype(C, (_ISxdigit|_ISlower)) == _ISxdigit);
+#else /* No checking done. */
+#error Unknown type of ctype checking!
+#endif
+}
#endif
/**********************************************************************/
-#ifdef L_isascii
+/* glibc extensions */
+/**********************************************************************/
+#ifdef L_isctype
-int isascii(int c)
+int isctype(int c, int mask)
{
- return __isascii(c);
+ CTYPE_BODY(NAME,c,mask)
}
#endif
/**********************************************************************/
-#ifdef L_toascii
+#if L___ctype_b_loc
+
+#ifdef __UCLIBC_HAS_XLOCALE__
-int toascii(int c)
+const uint16_t **__ctype_b_loc(void)
{
- return __toascii(c);
+ return &(__UCLIBC_CURLOCALE_DATA).__ctype_b;
}
#endif
+
+#endif
/**********************************************************************/
-#ifdef L_isxlower
+#if L___ctype_tolower_loc
+
+#ifdef __UCLIBC_HAS_XLOCALE__
-int isxlower(int c)
+const __ctype_touplow_t **__ctype_tolower_loc(void)
{
- return __isxlower(c);
+ return &(__UCLIBC_CURLOCALE_DATA).__ctype_tolower;
}
#endif
+
+#endif
/**********************************************************************/
-#ifdef L_isxupper
+#if L___ctype_toupper_loc
+
+#ifdef __UCLIBC_HAS_XLOCALE__
-int isxupper(int c)
+const __ctype_touplow_t **__ctype_toupper_loc(void)
{
- return __isxupper(c);
+ return &(__UCLIBC_CURLOCALE_DATA).__ctype_toupper;
}
#endif
+
+#endif
/**********************************************************************/
-#ifdef L___isctype_loc
-#ifdef __CTYPE_HAS_8_BIT_LOCALES
+#ifdef L___C_ctype_b
+
+const uint16_t __C_ctype_b_data[] = {
+#ifdef __UCLIBC_HAS_CTYPE_SIGNED__
+ /* -128 M-^@ */ 0,
+ /* -127 M-^A */ 0,
+ /* -126 M-^B */ 0,
+ /* -125 M-^C */ 0,
+ /* -124 M-^D */ 0,
+ /* -123 M-^E */ 0,
+ /* -122 M-^F */ 0,
+ /* -121 M-^G */ 0,
+ /* -120 M-^H */ 0,
+ /* -119 M-^I */ 0,
+ /* -118 M-^J */ 0,
+ /* -117 M-^K */ 0,
+ /* -116 M-^L */ 0,
+ /* -115 M-^M */ 0,
+ /* -114 M-^N */ 0,
+ /* -113 M-^O */ 0,
+ /* -112 M-^P */ 0,
+ /* -111 M-^Q */ 0,
+ /* -110 M-^R */ 0,
+ /* -109 M-^S */ 0,
+ /* -108 M-^T */ 0,
+ /* -107 M-^U */ 0,
+ /* -106 M-^V */ 0,
+ /* -105 M-^W */ 0,
+ /* -104 M-^X */ 0,
+ /* -103 M-^Y */ 0,
+ /* -102 M-^Z */ 0,
+ /* -101 M-^[ */ 0,
+ /* -100 M-^\ */ 0,
+ /* -99 M-^] */ 0,
+ /* -98 M-^^ */ 0,
+ /* -97 M-^_ */ 0,
+ /* -96 M- */ 0,
+ /* -95 M-! */ 0,
+ /* -94 M-" */ 0,
+ /* -93 M-# */ 0,
+ /* -92 M-$ */ 0,
+ /* -91 M-% */ 0,
+ /* -90 M-& */ 0,
+ /* -89 M-' */ 0,
+ /* -88 M-( */ 0,
+ /* -87 M-) */ 0,
+ /* -86 M-* */ 0,
+ /* -85 M-+ */ 0,
+ /* -84 M-, */ 0,
+ /* -83 M-- */ 0,
+ /* -82 M-. */ 0,
+ /* -81 M-/ */ 0,
+ /* -80 M-0 */ 0,
+ /* -79 M-1 */ 0,
+ /* -78 M-2 */ 0,
+ /* -77 M-3 */ 0,
+ /* -76 M-4 */ 0,
+ /* -75 M-5 */ 0,
+ /* -74 M-6 */ 0,
+ /* -73 M-7 */ 0,
+ /* -72 M-8 */ 0,
+ /* -71 M-9 */ 0,
+ /* -70 M-: */ 0,
+ /* -69 M-; */ 0,
+ /* -68 M-< */ 0,
+ /* -67 M-= */ 0,
+ /* -66 M-> */ 0,
+ /* -65 M-? */ 0,
+ /* -64 M-@ */ 0,
+ /* -63 M-A */ 0,
+ /* -62 M-B */ 0,
+ /* -61 M-C */ 0,
+ /* -60 M-D */ 0,
+ /* -59 M-E */ 0,
+ /* -58 M-F */ 0,
+ /* -57 M-G */ 0,
+ /* -56 M-H */ 0,
+ /* -55 M-I */ 0,
+ /* -54 M-J */ 0,
+ /* -53 M-K */ 0,
+ /* -52 M-L */ 0,
+ /* -51 M-M */ 0,
+ /* -50 M-N */ 0,
+ /* -49 M-O */ 0,
+ /* -48 M-P */ 0,
+ /* -47 M-Q */ 0,
+ /* -46 M-R */ 0,
+ /* -45 M-S */ 0,
+ /* -44 M-T */ 0,
+ /* -43 M-U */ 0,
+ /* -42 M-V */ 0,
+ /* -41 M-W */ 0,
+ /* -40 M-X */ 0,
+ /* -39 M-Y */ 0,
+ /* -38 M-Z */ 0,
+ /* -37 M-[ */ 0,
+ /* -36 M-\ */ 0,
+ /* -35 M-] */ 0,
+ /* -34 M-^ */ 0,
+ /* -33 M-_ */ 0,
+ /* -32 M-` */ 0,
+ /* -31 M-a */ 0,
+ /* -30 M-b */ 0,
+ /* -29 M-c */ 0,
+ /* -28 M-d */ 0,
+ /* -27 M-e */ 0,
+ /* -26 M-f */ 0,
+ /* -25 M-g */ 0,
+ /* -24 M-h */ 0,
+ /* -23 M-i */ 0,
+ /* -22 M-j */ 0,
+ /* -21 M-k */ 0,
+ /* -20 M-l */ 0,
+ /* -19 M-m */ 0,
+ /* -18 M-n */ 0,
+ /* -17 M-o */ 0,
+ /* -16 M-p */ 0,
+ /* -15 M-q */ 0,
+ /* -14 M-r */ 0,
+ /* -13 M-s */ 0,
+ /* -12 M-t */ 0,
+ /* -11 M-u */ 0,
+ /* -10 M-v */ 0,
+ /* -9 M-w */ 0,
+ /* -8 M-x */ 0,
+ /* -7 M-y */ 0,
+ /* -6 M-z */ 0,
+ /* -5 M-{ */ 0,
+ /* -4 M-| */ 0,
+ /* -3 M-} */ 0,
+ /* -2 M-~ */ 0,
+#endif /* __UCLIBC_HAS_CTYPE_SIGNED__*/
+ /* -1 M-^? */ 0,
+ /* 0 ^@ */ _IScntrl,
+ /* 1 ^A */ _IScntrl,
+ /* 2 ^B */ _IScntrl,
+ /* 3 ^C */ _IScntrl,
+ /* 4 ^D */ _IScntrl,
+ /* 5 ^E */ _IScntrl,
+ /* 6 ^F */ _IScntrl,
+ /* 7 ^G */ _IScntrl,
+ /* 8 ^H */ _IScntrl,
+ /* 9 ^I */ _ISspace|_ISblank|_IScntrl,
+ /* 10 ^J */ _ISspace|_IScntrl,
+ /* 11 ^K */ _ISspace|_IScntrl,
+ /* 12 ^L */ _ISspace|_IScntrl,
+ /* 13 ^M */ _ISspace|_IScntrl,
+ /* 14 ^N */ _IScntrl,
+ /* 15 ^O */ _IScntrl,
+ /* 16 ^P */ _IScntrl,
+ /* 17 ^Q */ _IScntrl,
+ /* 18 ^R */ _IScntrl,
+ /* 19 ^S */ _IScntrl,
+ /* 20 ^T */ _IScntrl,
+ /* 21 ^U */ _IScntrl,
+ /* 22 ^V */ _IScntrl,
+ /* 23 ^W */ _IScntrl,
+ /* 24 ^X */ _IScntrl,
+ /* 25 ^Y */ _IScntrl,
+ /* 26 ^Z */ _IScntrl,
+ /* 27 ^[ */ _IScntrl,
+ /* 28 ^\ */ _IScntrl,
+ /* 29 ^] */ _IScntrl,
+ /* 30 ^^ */ _IScntrl,
+ /* 31 ^_ */ _IScntrl,
+ /* 32 */ _ISspace|_ISprint|_ISblank,
+ /* 33 ! */ _ISprint|_ISgraph|_ISpunct,
+ /* 34 " */ _ISprint|_ISgraph|_ISpunct,
+ /* 35 # */ _ISprint|_ISgraph|_ISpunct,
+ /* 36 $ */ _ISprint|_ISgraph|_ISpunct,
+ /* 37 % */ _ISprint|_ISgraph|_ISpunct,
+ /* 38 & */ _ISprint|_ISgraph|_ISpunct,
+ /* 39 ' */ _ISprint|_ISgraph|_ISpunct,
+ /* 40 ( */ _ISprint|_ISgraph|_ISpunct,
+ /* 41 ) */ _ISprint|_ISgraph|_ISpunct,
+ /* 42 * */ _ISprint|_ISgraph|_ISpunct,
+ /* 43 + */ _ISprint|_ISgraph|_ISpunct,
+ /* 44 , */ _ISprint|_ISgraph|_ISpunct,
+ /* 45 - */ _ISprint|_ISgraph|_ISpunct,
+ /* 46 . */ _ISprint|_ISgraph|_ISpunct,
+ /* 47 / */ _ISprint|_ISgraph|_ISpunct,
+ /* 48 0 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 49 1 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 50 2 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 51 3 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 52 4 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 53 5 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 54 6 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 55 7 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 56 8 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 57 9 */ _ISdigit|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 58 : */ _ISprint|_ISgraph|_ISpunct,
+ /* 59 ; */ _ISprint|_ISgraph|_ISpunct,
+ /* 60 < */ _ISprint|_ISgraph|_ISpunct,
+ /* 61 = */ _ISprint|_ISgraph|_ISpunct,
+ /* 62 > */ _ISprint|_ISgraph|_ISpunct,
+ /* 63 ? */ _ISprint|_ISgraph|_ISpunct,
+ /* 64 @ */ _ISprint|_ISgraph|_ISpunct,
+ /* 65 A */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 66 B */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 67 C */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 68 D */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 69 E */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 70 F */ _ISupper|_ISalpha|_ISxdigit|_ISprint|_ISgraph|_ISalnum,
+ /* 71 G */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
+ /* 72 H */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
+ /* 73 I */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
+ /* 74 J */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
+ /* 75 K */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
+ /* 76 L */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
+ /* 77 M */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
+ /* 78 N */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,
+ /* 79 O */ _ISupper|_ISalpha|_ISprint|_ISgraph|_ISalnum,