1 |
#ifndef ENCODING_H |
2 |
#define ENCODING_H |
3 |
|
4 |
#include <stdint.h> |
5 |
|
6 |
typedef uint32_t unicode_t; |
7 |
|
8 |
// order must match the table in encoding.C(!) |
9 |
enum codeset { |
10 |
CS_UNKNOWN = 0, |
11 |
CS_US_ASCII, |
12 |
|
13 |
CS_ISO8859_1, |
14 |
CS_ISO8859_2, |
15 |
CS_ISO8859_3, |
16 |
CS_ISO8859_4, |
17 |
CS_ISO8859_5, |
18 |
CS_ISO8859_6, |
19 |
CS_ISO8859_7, |
20 |
CS_ISO8859_8, |
21 |
CS_ISO8859_9, |
22 |
CS_ISO8859_10, |
23 |
CS_ISO8859_11, |
24 |
CS_ISO8859_13, |
25 |
CS_ISO8859_14, |
26 |
CS_ISO8859_15, |
27 |
CS_ISO8859_16, |
28 |
|
29 |
CS_KOI8_R, |
30 |
CS_KOI8_U, |
31 |
CS_JIS0201_1976_0, |
32 |
CS_JIS0208_1990_0, |
33 |
CS_JIS0212_1990_0, |
34 |
CS_JIS0213_1, |
35 |
CS_JIS0213_2, |
36 |
|
37 |
CS_KSC5601_1987_0, |
38 |
|
39 |
CS_GB2312_1980_0, |
40 |
|
41 |
CS_CNS11643_1992_1, |
42 |
CS_CNS11643_1992_2, |
43 |
CS_CNS11643_1992_3, |
44 |
CS_CNS11643_1992_4, |
45 |
CS_CNS11643_1992_5, |
46 |
CS_CNS11643_1992_6, |
47 |
CS_CNS11643_1992_7, |
48 |
CS_CNS11643_1992_F, |
49 |
|
50 |
CS_BIG5, |
51 |
CS_BIG5_EXT, |
52 |
CS_BIG5_PLUS, |
53 |
|
54 |
CS_VISCII, |
55 |
|
56 |
CS_UNICODE_16, /* 16-bit subset of unicode, for X11 */ |
57 |
CS_UNICODE, |
58 |
|
59 |
NUM_CODESETS |
60 |
}; |
61 |
|
62 |
codeset codeset_from_name (const char *name); |
63 |
|
64 |
enum { |
65 |
ZERO_WIDTH_CHAR = 0x200b, |
66 |
REPLACEMENT_CHAR = 0xfffd, |
67 |
NOCHAR = 65535, // must be invalid in ANY codeset (!) |
68 |
}; |
69 |
|
70 |
struct rxvt_codeset_conv { |
71 |
virtual uint32_t from_unicode (unicode_t unicode) const { return unicode; } |
72 |
#if ENCODING_TO_UNICODE |
73 |
virtual unicode_t to_unicode (uint32_t enc) const { return enc; } |
74 |
#endif |
75 |
}; |
76 |
|
77 |
extern const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS]; |
78 |
|
79 |
extern unicode_t rxvt_compose (unicode_t c1, unicode_t c2); |
80 |
|
81 |
#define FROM_UNICODE(cs,code) rxvt_codeset[cs]->from_unicode (code) |
82 |
#define TO_UNICODE(cs,code) rxvt_codeset[cs]->to_unicode (code) |
83 |
|
84 |
struct unicode { // namespace für arme |
85 |
static bool is_space (unicode_t c); |
86 |
}; |
87 |
|
88 |
#endif |
89 |
|