1 /* vi: set sw=4 ts=4: */
3 * Licensed under the GPL version 2, see the file LICENSE in this tarball.
8 #if ENABLE_UNICODE_USING_LOCALE
13 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
21 #define unicode_bidi_isrtl(wc) 0
22 #define unicode_bidi_is_neutral_wchar(wc) (wc <= 126 && !isalpha(wc))
24 #if !ENABLE_UNICODE_SUPPORT
26 # define unicode_strlen(string) strlen(string)
27 # define unicode_status UNICODE_OFF
28 # define init_unicode() ((void)0)
32 # if CONFIG_LAST_SUPPORTED_WCHAR < 126 || CONFIG_LAST_SUPPORTED_WCHAR >= 0x30000
33 # define LAST_SUPPORTED_WCHAR 0x2ffff
35 # define LAST_SUPPORTED_WCHAR CONFIG_LAST_SUPPORTED_WCHAR
38 # if LAST_SUPPORTED_WCHAR < 0x590
39 # undef ENABLE_UNICODE_BIDI_SUPPORT
40 # define ENABLE_UNICODE_BIDI_SUPPORT 0
43 size_t FAST_FUNC unicode_strlen(const char *string);
45 UNI_FLAG_PAD = (1 << 0),
47 //UNUSED: unsigned FAST_FUNC unicode_padding_to_width(unsigned width, const char *src);
48 //UNUSED: char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats, const char *src, unsigned width, int flags);
49 char* FAST_FUNC unicode_conv_to_printable(uni_stat_t *stats, const char *src);
50 char* FAST_FUNC unicode_conv_to_printable_maxwidth(uni_stat_t *stats, const char *src, unsigned maxwidth);
51 char* FAST_FUNC unicode_conv_to_printable_fixedwidth(uni_stat_t *stats, const char *src, unsigned width);
53 # if ENABLE_UNICODE_USING_LOCALE
55 extern uint8_t unicode_status;
56 void init_unicode(void) FAST_FUNC;
60 /* Homegrown Unicode support. It knows only C and Unicode locales. */
62 # if !ENABLE_FEATURE_CHECK_UNICODE_IN_ENV
63 # define unicode_status UNICODE_ON
64 # define init_unicode() ((void)0)
66 extern uint8_t unicode_status;
67 void init_unicode(void) FAST_FUNC;
73 /* Prevent name collisions */
74 # define wint_t bb_wint_t
75 # define mbstate_t bb_mbstate_t
76 # define mbstowcs bb_mbstowcs
77 # define wcstombs bb_wcstombs
78 # define wcrtomb bb_wcrtomb
79 # define iswspace bb_iswspace
80 # define iswalnum bb_iswalnum
81 # define iswpunct bb_iswpunct
82 # define wcwidth bb_wcwidth
84 typedef int32_t wint_t;
89 size_t mbstowcs(wchar_t *dest, const char *src, size_t n) FAST_FUNC;
90 size_t wcstombs(char *dest, const wchar_t *src, size_t n) FAST_FUNC;
91 size_t wcrtomb(char *s, wchar_t wc, mbstate_t *ps) FAST_FUNC;
92 int iswspace(wint_t wc) FAST_FUNC;
93 int iswalnum(wint_t wc) FAST_FUNC;
94 int iswpunct(wint_t wc) FAST_FUNC;
95 # if ENABLE_UNICODE_BIDI_SUPPORT
96 # undef unicode_bidi_isrtl
97 int unicode_bidi_isrtl(wint_t wc) FAST_FUNC;
98 # if ENABLE_UNICODE_NEUTRAL_TABLE
99 # undef unicode_bidi_is_neutral_wchar
100 int unicode_bidi_is_neutral_wchar(wint_t wc) FAST_FUNC;
105 # endif /* !UNICODE_USING_LOCALE */
107 #endif /* UNICODE_SUPPORT */
109 POP_SAVED_FUNCTION_VISIBILITY