mirror of
https://github.com/sheumann/hush.git
synced 2024-12-28 07:30:23 +00:00
c5c006c10c
function old new delta read_line_input 4886 5003 +117 in_uint16_table - 97 +97 in_interval_table - 78 +78 static.rtl_b - 68 +68 unicode_isrtl - 55 +55 isrtl_str - 51 +51 static.rtl_p - 42 +42 unicode_conv_to_printable2 633 477 -156 ------------------------------------------------------------------------------ (add/remove: 6/0 grow/shrink: 1/1 up/down: 508/-156) Total: 352 bytes Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
107 lines
2.7 KiB
C
107 lines
2.7 KiB
C
/* 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_LOCALE_SUPPORT
|
|
# include <wchar.h>
|
|
# include <wctype.h>
|
|
#endif
|
|
|
|
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
|
|
|
|
enum {
|
|
UNICODE_UNKNOWN = 0,
|
|
UNICODE_OFF = 1,
|
|
UNICODE_ON = 2,
|
|
};
|
|
|
|
#define unicode_isrtl(wc) 0
|
|
|
|
#if !ENABLE_FEATURE_ASSUME_UNICODE
|
|
|
|
# define unicode_strlen(string) strlen(string)
|
|
# define unicode_status UNICODE_OFF
|
|
# define init_unicode() ((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
|
|
# endif
|
|
|
|
# if LAST_SUPPORTED_WCHAR < 0x590
|
|
# undef ENABLE_UNICODE_BIDI_SUPPORT
|
|
# define ENABLE_UNICODE_BIDI_SUPPORT 0
|
|
# endif
|
|
|
|
size_t FAST_FUNC unicode_strlen(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);
|
|
|
|
# if ENABLE_LOCALE_SUPPORT
|
|
|
|
extern uint8_t unicode_status;
|
|
void init_unicode(void) FAST_FUNC;
|
|
|
|
# else
|
|
|
|
/* Homegrown Unicode support. It knows only C and Unicode locales. */
|
|
|
|
# if !ENABLE_FEATURE_CHECK_UNICODE_IN_ENV
|
|
# define unicode_status UNICODE_ON
|
|
# define init_unicode() ((void)0)
|
|
# else
|
|
extern uint8_t unicode_status;
|
|
void init_unicode(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
|
|
# define wcwidth bb_wcwidth
|
|
|
|
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;
|
|
# if ENABLE_UNICODE_BIDI_SUPPORT
|
|
# undef unicode_isrtl
|
|
int unicode_isrtl(wint_t wc) FAST_FUNC;
|
|
# endif
|
|
|
|
|
|
# endif /* !LOCALE_SUPPORT */
|
|
|
|
#endif /* FEATURE_ASSUME_UNICODE */
|
|
|
|
POP_SAVED_FUNCTION_VISIBILITY
|
|
|
|
#endif
|