aboutsummaryrefslogtreecommitdiff
path: root/include/unicode.h
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-11 21:36:13 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-07-11 21:36:13 +0200
commit42a8fd0db08ab8b45fec6eab4af841f99576b260 (patch)
tree55f0600298da0c83c638c985d0c8b6d803be926b /include/unicode.h
parent883cea47518a171ab83f8e41def3aec92207519e (diff)
downloadbusybox-42a8fd0db08ab8b45fec6eab4af841f99576b260.tar.gz
added simplified Unicode support for non-locale-enabled builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include/unicode.h')
-rw-r--r--include/unicode.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/include/unicode.h b/include/unicode.h
new file mode 100644
index 000000000..be64a50e2
--- /dev/null
+++ b/include/unicode.h
@@ -0,0 +1,57 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Licensed under the GPL version 2, see the file LICENSE in this tarball.
+ */
+#ifndef UNICODE_H
+#define UNICODE_H 1
+
+#if !ENABLE_FEATURE_ASSUME_UNICODE
+
+# define check_unicode_in_env() ((void)0)
+
+#else
+
+# if ENABLE_LOCALE_SUPPORT
+
+# include <wchar.h>
+# include <wctype.h>
+# define check_unicode_in_env() ((void)0)
+
+# else
+
+# if !ENABLE_FEATURE_CHECK_UNICODE_IN_ENV
+# define check_unicode_in_env() ((void)0)
+# else
+void check_unicode_in_env(void) FAST_FUNC;
+# endif
+
+# undef MB_CUR_MAX
+# define MB_CUR_MAX 6
+
+/* Prevent name collisions */
+# define wint_t bb_wint_t
+# define mbstate_t bb_mbstate_t
+# define mbstowcs bb_mbstowcs
+# define wcstombs bb_wcstombs
+# define wcrtomb bb_wcrtomb
+# define iswspace bb_iswspace
+# define iswalnum bb_iswalnum
+# define iswpunct bb_iswpunct
+
+typedef int32_t wint_t;
+typedef struct {
+ char bogus;
+} mbstate_t;
+
+size_t mbstowcs(wchar_t *dest, const char *src, size_t n) FAST_FUNC;
+size_t wcstombs(char *dest, const wchar_t *src, size_t n) FAST_FUNC;
+size_t wcrtomb(char *s, wchar_t wc, mbstate_t *ps) FAST_FUNC;
+int iswspace(wint_t wc) FAST_FUNC;
+int iswalnum(wint_t wc) FAST_FUNC;
+int iswpunct(wint_t wc) FAST_FUNC;
+
+# endif
+
+#endif
+
+#endif