Update docs/tcp.txt
[oweals/busybox.git] / include / unicode.h
index 747026abeef1fd6038779bf7510bd6bcc847fc65..0317a215171e9f5299c1b0384f0e32a3d6ca6709 100644 (file)
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * Licensed under the GPL version 2, see the file LICENSE in this tarball.
+ * Licensed under GPLv2, see file LICENSE in this source tree.
  */
 #ifndef UNICODE_H
 #define UNICODE_H 1
@@ -23,47 +23,52 @@ enum {
 
 #if !ENABLE_UNICODE_SUPPORT
 
-# define unicode_strlen(string) strlen(string)
+# define unicode_strlen(string)   strlen(string)
+# define unicode_strwidth(string) strlen(string)
 # define unicode_status UNICODE_OFF
 # define init_unicode() ((void)0)
+# define reinit_unicode(LANG) ((void)0)
 
 #else
 
 # if CONFIG_LAST_SUPPORTED_WCHAR < 126 || CONFIG_LAST_SUPPORTED_WCHAR >= 0x30000
-#  define LAST_SUPPORTED_WCHAR 0x2ffff
-# else
-#  define LAST_SUPPORTED_WCHAR CONFIG_LAST_SUPPORTED_WCHAR
+#  undef CONFIG_LAST_SUPPORTED_WCHAR
+#  define CONFIG_LAST_SUPPORTED_WCHAR 0x2ffff
 # endif
 
-# if LAST_SUPPORTED_WCHAR < 0x300
+# if CONFIG_LAST_SUPPORTED_WCHAR < 0x300
 #  undef ENABLE_UNICODE_COMBINING_WCHARS
 #  define ENABLE_UNICODE_COMBINING_WCHARS 0
 # endif
 
-# if LAST_SUPPORTED_WCHAR < 0x1100
+# if CONFIG_LAST_SUPPORTED_WCHAR < 0x1100
 #  undef ENABLE_UNICODE_WIDE_WCHARS
 #  define ENABLE_UNICODE_WIDE_WCHARS 0
 # endif
 
-# if LAST_SUPPORTED_WCHAR < 0x590
+# if CONFIG_LAST_SUPPORTED_WCHAR < 0x590
 #  undef  ENABLE_UNICODE_BIDI_SUPPORT
 #  define ENABLE_UNICODE_BIDI_SUPPORT 0
 # endif
 
+/* Number of unicode chars. Falls back to strlen() on invalid unicode */
 size_t FAST_FUNC unicode_strlen(const char *string);
+/* Width on terminal */
+size_t FAST_FUNC unicode_strwidth(const char *string);
 enum {
        UNI_FLAG_PAD = (1 << 0),
 };
 //UNUSED: unsigned FAST_FUNC unicode_padding_to_width(unsigned width, const char *src);
 //UNUSED: char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats, const char *src, unsigned width, int flags);
 char* FAST_FUNC unicode_conv_to_printable(uni_stat_t *stats, const char *src);
-char* FAST_FUNC unicode_conv_to_printable_maxwidth(uni_stat_t *stats, const char *src, unsigned maxwidth);
-char* FAST_FUNC unicode_conv_to_printable_fixedwidth(uni_stat_t *stats, const char *src, unsigned width);
+//UNUSED: char* FAST_FUNC unicode_conv_to_printable_maxwidth(uni_stat_t *stats, const char *src, unsigned maxwidth);
+char* FAST_FUNC unicode_conv_to_printable_fixedwidth(/*uni_stat_t *stats,*/ const char *src, unsigned width);
 
 # if ENABLE_UNICODE_USING_LOCALE
 
 extern uint8_t unicode_status;
 void init_unicode(void) FAST_FUNC;
+void reinit_unicode(const char *LANG) FAST_FUNC;
 
 # else
 
@@ -72,9 +77,11 @@ void init_unicode(void) FAST_FUNC;
 #  if !ENABLE_FEATURE_CHECK_UNICODE_IN_ENV
 #   define unicode_status UNICODE_ON
 #   define init_unicode() ((void)0)
+#   define reinit_unicode(LANG) ((void)0)
 #  else
 extern uint8_t unicode_status;
 void init_unicode(void) FAST_FUNC;
+void reinit_unicode(const char *LANG) FAST_FUNC;
 #  endif
 
 #  undef MB_CUR_MAX