1 | #ifndef ENCODING_H |
1 | #ifndef ENCODING_H |
2 | #define ENCODING_H |
2 | #define ENCODING_H |
3 | |
3 | |
4 | #include <stdint.h> |
4 | #include <stdint.h> |
5 | |
5 | |
|
|
6 | // order must match the table in encoding.C(!) |
6 | enum codeset { |
7 | enum codeset { |
7 | CS_UNKNOWN = 0, |
8 | CS_UNKNOWN = 0, |
8 | CS_SPECIAL, |
|
|
9 | CS_US_ASCII, |
9 | CS_US_ASCII, |
10 | |
10 | |
11 | CS_ISO8859_1, |
11 | CS_ISO8859_1, |
12 | CS_ISO8859_2, |
12 | CS_ISO8859_2, |
13 | CS_ISO8859_3, |
13 | CS_ISO8859_3, |
… | |
… | |
44 | CS_CNS11643_1992_5, |
44 | CS_CNS11643_1992_5, |
45 | CS_CNS11643_1992_6, |
45 | CS_CNS11643_1992_6, |
46 | CS_CNS11643_1992_7, |
46 | CS_CNS11643_1992_7, |
47 | CS_CNS11643_1992_F, |
47 | CS_CNS11643_1992_F, |
48 | |
48 | |
|
|
49 | CS_BIG5, |
49 | CS_BIG5_EXT, |
50 | CS_BIG5_EXT, |
50 | CS_BIG5_PLUS, |
51 | CS_BIG5_PLUS, |
51 | |
52 | |
52 | CS_VISCII, |
53 | CS_VISCII, |
53 | |
54 | |
… | |
… | |
59 | |
60 | |
60 | codeset codeset_from_name (const char *name); |
61 | codeset codeset_from_name (const char *name); |
61 | |
62 | |
62 | enum { |
63 | enum { |
63 | ZERO_WIDTH_CHAR = 0x200b, |
64 | ZERO_WIDTH_CHAR = 0x200b, |
|
|
65 | REPLACEMENT_CHAR = 0xfffd, |
64 | NOCHAR = 65535, // must be invalid in ANY codeset (!) |
66 | NOCHAR = 65535, // must be invalid in ANY codeset (!) |
65 | }; |
67 | }; |
66 | |
68 | |
67 | struct rxvt_codeset_conv { |
69 | struct rxvt_codeset_conv { |
68 | virtual uint32_t from_unicode (uint32_t unicode) const { return unicode; } |
70 | virtual uint32_t from_unicode (uint32_t unicode) const { return unicode; } |
69 | virtual uint32_t to_unicode (uint32_t enc) const { return enc; } |
71 | virtual uint32_t to_unicode (uint32_t enc) const { return enc; } |
70 | }; |
72 | }; |
71 | |
73 | |
72 | extern const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS]; |
74 | extern const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS]; |
73 | |
75 | |
|
|
76 | extern uint32_t rxvt_compose (uint32_t c1, uint32_t c2); |
|
|
77 | |
74 | #define FROM_UNICODE(cs,code) rxvt_codeset[cs]->from_unicode (code) |
78 | #define FROM_UNICODE(cs,code) rxvt_codeset[cs]->from_unicode (code) |
75 | #define TO_UNICODE(cs,code) rxvt_codeset[cs]->to_unicode (code) |
79 | #define TO_UNICODE(cs,code) rxvt_codeset[cs]->to_unicode (code) |
76 | |
80 | |
77 | #endif |
81 | #endif |
78 | |
82 | |