Intial commit
[profile/ivi/w3m.git] / libwc / ucs.h
1
2 #ifndef _WC_UCS_H
3 #define _WC_UCS_H
4
5 #define WC_C_UCS2_NBSP          0xA0
6 #define WC_C_UCS2_BOM           0xFEFF
7 #define WC_C_UCS2_REPLACE       0xFFFD
8 #define WC_C_UCS2_END           0xFFFF
9 #define WC_C_UCS2_SURROGATE     0xD800
10 #define WC_C_UCS2_SURROGATE_LOW 0xDC00
11 #define WC_C_UCS2_SURROGATE_END 0xDFFF
12 #define WC_C_UCS2_HANGUL        0xAC00
13 #define WC_C_UCS2_HANGUL_END    0xD7A3
14 #define WC_C_UCS2_EURO          0x20AC
15 #define WC_C_UCS4_END           0x7FFFFFFF
16 #define WC_C_UCS4_ERROR         0xFFFFFFFFU
17 #define WC_C_UNICODE_END        0x10FFFF
18 #define WC_C_UNICODE_MASK       0x1FFFFF
19 #define WC_C_LANGUAGE_TAG0      0xE0000
20 #define WC_C_LANGUAGE_TAG       0xE0001
21 #define WC_C_TAG_SPACE          0xE0020
22 #define WC_C_CANCEL_TAG         0xE007F
23 #define WC_C_UCS4_PLANE1        0x10000
24 #define WC_C_UCS4_PLANE2        0x20000
25 #define WC_C_UCS4_PLANE3        0x30000
26
27 #define wc_ucs_tag_to_ucs(c)            ((c) & WC_C_UNICODE_MASK)
28 #define wc_ucs_tag_to_tag(c)            ((c) >> 24)
29 #define wc_ucs_to_ucs_tag(c,tag)        ((c) | ((tag) << 24))
30 #define wc_ccs_ucs_to_ccs_ucs_tag(ccs)  (WC_CCS_UCS_TAG | ((ccs) & ~WC_CCS_A_SET))
31 #define wc_ucs_to_utf16(ucs) \
32         ((((((ucs) - WC_C_UCS4_PLANE1) >> 10) | WC_C_UCS2_SURROGATE) << 16) \
33         | ((((ucs) - WC_C_UCS4_PLANE1) & 0x3ff) | WC_C_UCS2_SURROGATE_LOW))
34 #define wc_utf16_to_ucs(high, low) \
35         (((((high) & 0x3ff) << 10) | ((low) & 0x3ff)) + WC_C_UCS4_PLANE1)
36
37 extern wc_table  *wc_get_ucs_table(wc_ccs ccs);
38 extern wc_wchar_t wc_ucs_to_any(wc_uint32 ucs, wc_table *t);
39 extern wc_uint32  wc_any_to_ucs(wc_wchar_t cc);
40 extern wc_wchar_t wc_any_to_any(wc_wchar_t cc, wc_table *t);
41 extern wc_wchar_t wc_ucs_to_any_list(wc_uint32 ucs, wc_table **tlist);
42 extern wc_wchar_t wc_any_to_any_ces(wc_wchar_t cc, wc_status *st);
43 extern wc_wchar_t wc_any_to_iso2022(wc_wchar_t cc, wc_status *st);
44 extern wc_wchar_t wc_ucs_to_iso2022(wc_uint32 ucs);
45 extern wc_wchar_t wc_ucs_to_iso2022w(wc_uint32 ucs);
46 extern wc_ccs     wc_ucs_to_ccs(wc_uint32 ucs);
47 extern wc_bool    wc_is_ucs_wide(wc_uint32 ucs);
48 extern wc_bool    wc_is_ucs_combining(wc_uint32 ucs);
49 extern wc_bool    wc_is_ucs_hangul(wc_uint32 ucs);
50 extern wc_uint32  wc_ucs_precompose(wc_uint32 ucs1, wc_uint32 ucs2);
51 extern wc_uint32  wc_ucs_to_fullwidth(wc_uint32 ucs);
52 extern int        wc_ucs_put_tag(char *tag);
53 extern char      *wc_ucs_get_tag(int ntag);
54 extern void       wtf_push_ucs(Str os, wc_uint32 ucs, wc_status *st);
55
56 #endif