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