Contents of /tags/mkinitrd-6_2_0/include/unicode.h
Parent Directory | Revision Log
Revision 994 -
(show annotations)
(download)
Sun May 30 11:53:18 2010 UTC (14 years, 4 months ago) by niro
File MIME type: text/plain
File size: 1840 byte(s)
Sun May 30 11:53:18 2010 UTC (14 years, 4 months ago) by niro
File MIME type: text/plain
File size: 1840 byte(s)
tagged 'mkinitrd-6_2_0'
1 | /* vi: set sw=4 ts=4: */ |
2 | /* |
3 | * Licensed under the GPL version 2, see the file LICENSE in this tarball. |
4 | */ |
5 | #ifndef UNICODE_H |
6 | #define UNICODE_H 1 |
7 | |
8 | enum { |
9 | UNICODE_UNKNOWN = 0, |
10 | UNICODE_OFF = 1, |
11 | UNICODE_ON = 2, |
12 | }; |
13 | |
14 | #if !ENABLE_FEATURE_ASSUME_UNICODE |
15 | |
16 | # define unicode_strlen(string) strlen(string) |
17 | # define unicode_scrlen(string) TODO |
18 | # define unicode_status UNICODE_OFF |
19 | # define init_unicode() ((void)0) |
20 | |
21 | #else |
22 | |
23 | size_t FAST_FUNC unicode_strlen(const char *string); |
24 | char* FAST_FUNC unicode_cut_nchars(unsigned width, const char *src); |
25 | unsigned FAST_FUNC unicode_padding_to_width(unsigned width, const char *src); |
26 | |
27 | # if ENABLE_LOCALE_SUPPORT |
28 | |
29 | # include <wchar.h> |
30 | # include <wctype.h> |
31 | extern uint8_t unicode_status; |
32 | void init_unicode(void) FAST_FUNC; |
33 | |
34 | # else |
35 | |
36 | /* Homegrown Unicode support. It knows only C and Unicode locales. */ |
37 | |
38 | # if !ENABLE_FEATURE_CHECK_UNICODE_IN_ENV |
39 | # define unicode_status UNICODE_ON |
40 | # define init_unicode() ((void)0) |
41 | # else |
42 | extern uint8_t unicode_status; |
43 | void init_unicode(void) FAST_FUNC; |
44 | # endif |
45 | |
46 | # undef MB_CUR_MAX |
47 | # define MB_CUR_MAX 6 |
48 | |
49 | /* Prevent name collisions */ |
50 | # define wint_t bb_wint_t |
51 | # define mbstate_t bb_mbstate_t |
52 | # define mbstowcs bb_mbstowcs |
53 | # define wcstombs bb_wcstombs |
54 | # define wcrtomb bb_wcrtomb |
55 | # define iswspace bb_iswspace |
56 | # define iswalnum bb_iswalnum |
57 | # define iswpunct bb_iswpunct |
58 | # define wcwidth bb_wcwidth |
59 | |
60 | typedef int32_t wint_t; |
61 | typedef struct { |
62 | char bogus; |
63 | } mbstate_t; |
64 | |
65 | size_t mbstowcs(wchar_t *dest, const char *src, size_t n) FAST_FUNC; |
66 | size_t wcstombs(char *dest, const wchar_t *src, size_t n) FAST_FUNC; |
67 | size_t wcrtomb(char *s, wchar_t wc, mbstate_t *ps) FAST_FUNC; |
68 | int iswspace(wint_t wc) FAST_FUNC; |
69 | int iswalnum(wint_t wc) FAST_FUNC; |
70 | int iswpunct(wint_t wc) FAST_FUNC; |
71 | |
72 | |
73 | # endif /* !LOCALE_SUPPORT */ |
74 | |
75 | #endif /* FEATURE_ASSUME_UNICODE */ |
76 | |
77 | #endif |