ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/encoding.C
(Generate patch)

Comparing rxvt-unicode/src/encoding.C (file contents):
Revision 1.3 by pcg, Wed Mar 3 17:15:49 2004 UTC vs.
Revision 1.15 by pcg, Mon Mar 15 01:27:46 2004 UTC

26 { "ISO885914", CS_ISO8859_14 }, 26 { "ISO885914", CS_ISO8859_14 },
27 { "ISO885915", CS_ISO8859_15 }, 27 { "ISO885915", CS_ISO8859_15 },
28 { "FCD885915", CS_ISO8859_15 }, 28 { "FCD885915", CS_ISO8859_15 },
29 { "ISO885916", CS_ISO8859_16 }, 29 { "ISO885916", CS_ISO8859_16 },
30 30
31 { "TIS620*", CS_ISO8859_11 }, // close enough
32
31 { "ISO10646*", CS_UNICODE }, 33 { "ISO10646*", CS_UNICODE },
32 { "UNICODE", CS_UNICODE }, 34 { "UNICODE", CS_UNICODE },
33 { "UTF8", CS_UNICODE }, 35 { "UTF8", CS_UNICODE },
34 36
35 { "ASCII", CS_US_ASCII }, 37 { "ASCII", CS_US_ASCII },
40 { "GOST1976874*", CS_KOI8_R }, 42 { "GOST1976874*", CS_KOI8_R },
41 { "KOI8RU", CS_KOI8_U }, 43 { "KOI8RU", CS_KOI8_U },
42 { "KOI8U", CS_KOI8_U }, 44 { "KOI8U", CS_KOI8_U },
43 45
44 { "VISCII*", CS_VISCII }, 46 { "VISCII*", CS_VISCII },
45 { "TIS62025291", CS_VISCII }, // close enough
46 47
47 { "JISX0201*", CS_JIS0201_1976_0 }, 48 { "JISX0201*", CS_JIS0201_1976_0 },
48 { "JISX0208*", CS_JIS0208_1983_0 }, // also wrongly matches -1990-0 (check Encode::JP) 49 { "JISX0208*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP)
49 { "JISX0212*", CS_JIS0212_1990_0 }, 50 { "JISX0212*", CS_JIS0212_1990_0 },
51 { "JISX021320001", CS_JIS0213_1 },
52 { "JISX021320002", CS_JIS0213_2 },
50 { "JISX0221*", CS_UNICODE }, 53 { "JISX0221*", CS_UNICODE }, // _very_ close
51 54
52 { "KSC5601*", CS_KSC5601_1987_0 }, 55 { "KSC5601*", CS_KSC5601_1987_0 },
53 { "KSX1001*", CS_KSC5601_1987_0 }, 56 { "KSX1001*", CS_KSC5601_1987_0 },
54 { "KSC5700*", CS_UNICODE }, // unicode plus extensions 57 { "KSC5700*", CS_UNICODE }, // unicode plus extensions
55 58
112 115
113 return CS_UNKNOWN; 116 return CS_UNKNOWN;
114} 117}
115 118
116struct rxvt_codeset_conv_unknown : rxvt_codeset_conv { 119struct rxvt_codeset_conv_unknown : rxvt_codeset_conv {
117 uint32_t to_unicode (uint32_t enc) const { return NOCHAR; } 120 unicode_t to_unicode (uint32_t enc) const { return NOCHAR; }
118 uint32_t from_unicode (uint32_t unicode) const { return NOCHAR; } 121 uint32_t from_unicode (unicode_t unicode) const { return NOCHAR; }
119} rxvt_codeset_conv_unknown; 122} rxvt_codeset_conv_unknown;
120 123
121struct rxvt_codeset_conv_us_ascii : rxvt_codeset_conv { 124struct rxvt_codeset_conv_us_ascii : rxvt_codeset_conv {
122 uint32_t from_unicode (uint32_t unicode) const { return unicode <= 127 ? unicode : NOCHAR; } 125 uint32_t from_unicode (unicode_t unicode) const { return unicode <= 127 ? unicode : NOCHAR; }
123} rxvt_codeset_conv_us_ascii; 126} rxvt_codeset_conv_us_ascii;
124 127
125struct rxvt_codeset_conv_unicode : rxvt_codeset_conv { 128struct rxvt_codeset_conv_unicode : rxvt_codeset_conv {
126 /* transparent */ 129 /* transparent */
127} rxvt_codeset_conv_unicode; 130} rxvt_codeset_conv_unicode;
128 131
129struct rxvt_codeset_conv_unicode_16 : rxvt_codeset_conv { 132struct rxvt_codeset_conv_unicode_16 : rxvt_codeset_conv {
130 uint32_t to_unicode (uint32_t enc) const { return enc; } 133 unicode_t to_unicode (uint32_t enc) const { return enc; }
131 uint32_t from_unicode (uint32_t unicode) const { return unicode <= 65535 ? unicode : NOCHAR; } 134 uint32_t from_unicode (unicode_t unicode) const { return unicode <= 65535 ? unicode : NOCHAR; }
132} rxvt_codeset_conv_unicode_16; 135} rxvt_codeset_conv_unicode_16;
133
134/* block character set, must conform to the dec special pseudofont in defaultfont.C */
135struct rxvt_codeset_conv_special : rxvt_codeset_conv {
136 uint32_t to_unicode (uint32_t enc) const {
137 return enc;
138 }
139
140 uint32_t from_unicode (uint32_t unicode) const {
141 return unicode;
142 }
143} rxvt_codeset_conv_special;
144 136
145#define ENCODING_DEFAULT 137#define ENCODING_DEFAULT
146 138
147#include "table/iso8859_1.h" 139#include "table/iso8859_1.h"
148#include "table/iso8859_15.h" 140#include "table/iso8859_15.h"
193#include "table/viscii.h" 185#include "table/viscii.h"
194 186
195//#define ENCODING_JP 187//#define ENCODING_JP
196 188
197#include "table/jis0201_1976_0.h" 189#include "table/jis0201_1976_0.h"
198#include "table/jis0208_1983_0.h" 190#include "table/jis0208_1990_0.h"
199#include "table/jis0212_1990_0.h" 191#include "table/jis0212_1990_0.h"
200 192
201//#define ENCODING_JP_EXT 193//#define ENCODING_JP_EXT
202 194
203#include "table/jis0213_1.h" 195#include "table/jis0213_1.h"
204#include "table/jis0213_2.h" 196#include "table/jis0213_2.h"
205 197
206// order must match table in encoding.h(!) 198// order must match table in encoding.h(!)
207const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS] = { 199const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS] = {
208 &rxvt_codeset_conv_unknown, 200 &rxvt_codeset_conv_unknown,
209 &rxvt_codeset_conv_special,
210 201
211 &rxvt_codeset_conv_us_ascii, 202 &rxvt_codeset_conv_us_ascii,
212 203
213 &rxvt_codeset_conv_iso8859_1, 204 &rxvt_codeset_conv_iso8859_1,
214 &rxvt_codeset_conv_iso8859_2, 205 &rxvt_codeset_conv_iso8859_2,
228 219
229 &rxvt_codeset_conv_koi8_r, 220 &rxvt_codeset_conv_koi8_r,
230 &rxvt_codeset_conv_koi8_u, 221 &rxvt_codeset_conv_koi8_u,
231 222
232 &rxvt_codeset_conv_jis0201_1976_0, 223 &rxvt_codeset_conv_jis0201_1976_0,
233 &rxvt_codeset_conv_jis0208_1983_0, 224 &rxvt_codeset_conv_jis0208_1990_0,
234 &rxvt_codeset_conv_jis0212_1990_0, 225 &rxvt_codeset_conv_jis0212_1990_0,
235 226
236 &rxvt_codeset_conv_jis0213_1, 227 &rxvt_codeset_conv_jis0213_1,
237 &rxvt_codeset_conv_jis0213_2, 228 &rxvt_codeset_conv_jis0213_2,
238 229
256 247
257 &rxvt_codeset_conv_unicode_16, 248 &rxvt_codeset_conv_unicode_16,
258 &rxvt_codeset_conv_unicode 249 &rxvt_codeset_conv_unicode
259}; 250};
260 251
252#if ENABLE_COMBINING
253# define ENCODING_COMPOSE
254#endif
255
256#include "table/compose.h"
257
258unicode_t
259rxvt_compose (unicode_t c1, unicode_t c2)
260{
261 int l = 0;
262 int r = sizeof (rxvt_compose_table) / sizeof (rxvt_compose_entry) - 1;
263 int m;
264
265 while (r > l)
266 {
267 m = (l + r) / 2;
268 rxvt_compose_entry &c = rxvt_compose_table[m];
269
270 if (c.c1 < c1 || (c.c1 == c1 && c.c2 < c2))
271 l = m + 1;
272 else if (c.c1 > c1 || (c.c1 == c1 && c.c2 > c2))
273 r = m - 1;
274 else
275 return c.r;
276 }
277
278 return NOCHAR;
279}
280
281#include "table/category.h"
282
283bool unicode::is_space (unicode_t c)
284{
285 return IS_SPACE (c);
286}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines