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