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