2009-07-12 01:06:13 +05:30
|
|
|
/* 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
|
|
|
|
|
2010-01-05 01:19:58 +05:30
|
|
|
enum {
|
|
|
|
UNICODE_UNKNOWN = 0,
|
|
|
|
UNICODE_OFF = 1,
|
|
|
|
UNICODE_ON = 2,
|
|
|
|
};
|
|
|
|
|
2009-07-12 01:06:13 +05:30
|
|
|
#if !ENABLE_FEATURE_ASSUME_UNICODE
|
|
|
|
|
2009-07-12 01:56:48 +05:30
|
|
|
# define bb_mbstrlen(string) strlen(string)
|
2010-01-05 01:19:58 +05:30
|
|
|
# define unicode_status UNICODE_OFF
|
|
|
|
# define init_unicode() ((void)0)
|
2009-07-12 01:06:13 +05:30
|
|
|
|
|
|
|
#else
|
|
|
|
|
2009-07-12 01:56:48 +05:30
|
|
|
size_t bb_mbstrlen(const char *string) FAST_FUNC;
|
|
|
|
|
2009-07-12 01:06:13 +05:30
|
|
|
# if ENABLE_LOCALE_SUPPORT
|
|
|
|
|
|
|
|
# include <wchar.h>
|
|
|
|
# include <wctype.h>
|
2010-01-05 01:19:58 +05:30
|
|
|
extern uint8_t unicode_status;
|
|
|
|
void init_unicode(void) FAST_FUNC;
|
2009-07-12 01:06:13 +05:30
|
|
|
|
|
|
|
# else
|
|
|
|
|
2009-07-12 01:56:48 +05:30
|
|
|
/* Crude "locale support" which knows only C and Unicode locales */
|
|
|
|
|
2009-07-12 01:06:13 +05:30
|
|
|
# if !ENABLE_FEATURE_CHECK_UNICODE_IN_ENV
|
2010-01-05 01:19:58 +05:30
|
|
|
# define unicode_status UNICODE_ON
|
|
|
|
# define init_unicode() ((void)0)
|
2009-07-12 01:06:13 +05:30
|
|
|
# else
|
2010-01-05 01:19:58 +05:30
|
|
|
extern uint8_t unicode_status;
|
|
|
|
void init_unicode(void) FAST_FUNC;
|
2009-07-12 01:06:13 +05:30
|
|
|
# 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;
|
|
|
|
|
2009-07-12 01:56:48 +05:30
|
|
|
# endif /* !LOCALE_SUPPORT */
|
2009-07-12 01:06:13 +05:30
|
|
|
|
2009-07-12 01:56:48 +05:30
|
|
|
#endif /* FEATURE_ASSUME_UNICODE */
|
2009-07-12 01:06:13 +05:30
|
|
|
|
|
|
|
#endif
|