summaryrefslogtreecommitdiff
path: root/libc/stdlib/stdlib.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-07-03 17:24:17 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-07-03 17:24:17 +0000
commit599ad608ee3297bc1e2bb11656a97335e303877a (patch)
treec5b59cb5fa2c90f3b0c8b4d9831ae763f2825327 /libc/stdlib/stdlib.c
parentab579e469c6787df9bd2252b3de8b1700d5097d8 (diff)
Enable WCHAR support for C/POSIX stub locales.
Implemented unformatted wide i/o functions. (ungetwc still needs testing) Fix a few bugs in wchar.c. Modifications for bcc/elks support.
Diffstat (limited to 'libc/stdlib/stdlib.c')
-rw-r--r--libc/stdlib/stdlib.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index 4c9e8f039..689fdeb3b 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -638,7 +638,17 @@ void ssort (void *base,
#define UTF_8_MAX_LEN 3
#endif
+#ifdef __UCLIBC_HAS_LOCALE__
#define ENCODING (__global_locale.encoding)
+#warning implement __CTYPE_HAS_UTF_8_LOCALES!
+#define __CTYPE_HAS_UTF_8_LOCALES
+#else
+#define ENCODING (__ctype_encoding_7_bit)
+#undef __CTYPE_HAS_8_BIT_LOCALES
+#undef __CTYPE_HAS_UTF_8_LOCALES
+#undef L__wchar_utf8sntowcs
+#undef L__wchar_wcsntoutf8s
+#endif
#endif
@@ -647,16 +657,20 @@ void ssort (void *base,
size_t _stdlib_mb_cur_max(void)
{
+#ifdef __CTYPE_HAS_UTF_8_LOCALES
return __global_locale.mb_cur_max;
+#else
+#ifdef __CTYPE_HAS_8_BIT_LOCALES
+#warning need to change this when/if transliteration is implemented
+#endif
+ return 1;
+#endif
}
#endif
/**********************************************************************/
#ifdef L_mblen
-#warning implement __CTYPE_HAS_UTF_8_LOCALES!
-#define __CTYPE_HAS_UTF_8_LOCALES
-
int mblen(register const char *s, size_t n)
{
static mbstate_t state;
@@ -683,9 +697,6 @@ int mblen(register const char *s, size_t n)
/**********************************************************************/
#ifdef L_mbtowc
-#warning implement __CTYPE_HAS_UTF_8_LOCALES!
-#define __CTYPE_HAS_UTF_8_LOCALES
-
int mbtowc(wchar_t *__restrict pwc, register const char *__restrict s, size_t n)
{
static mbstate_t state;
@@ -712,9 +723,6 @@ int mbtowc(wchar_t *__restrict pwc, register const char *__restrict s, size_t n)
/**********************************************************************/
#ifdef L_wctomb
-#warning implement __CTYPE_HAS_UTF_8_LOCALES!
-#define __CTYPE_HAS_UTF_8_LOCALES
-
/* Note: We completely ignore state in all currently supported conversions. */
int wctomb(register char *__restrict s, wchar_t swc)