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.9 by pcg, Wed Mar 10 18:42:58 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_1983_0 }, // also wrongly matches -1990-0 (check Encode::JP)
49 { "JISX0212*", CS_JIS0212_1990_0 }, 50 { "JISX0212*", CS_JIS0212_1990_0 },
50 { "JISX0221*", CS_UNICODE }, 51 { "JISX0221*", CS_UNICODE },
129struct rxvt_codeset_conv_unicode_16 : rxvt_codeset_conv { 130struct rxvt_codeset_conv_unicode_16 : rxvt_codeset_conv {
130 uint32_t to_unicode (uint32_t enc) const { return enc; } 131 uint32_t to_unicode (uint32_t enc) const { return enc; }
131 uint32_t from_unicode (uint32_t unicode) const { return unicode <= 65535 ? unicode : NOCHAR; } 132 uint32_t from_unicode (uint32_t unicode) const { return unicode <= 65535 ? unicode : NOCHAR; }
132} rxvt_codeset_conv_unicode_16; 133} rxvt_codeset_conv_unicode_16;
133 134
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
145#define ENCODING_DEFAULT 135#define ENCODING_DEFAULT
146 136
147#include "table/iso8859_1.h" 137#include "table/iso8859_1.h"
148#include "table/iso8859_15.h" 138#include "table/iso8859_15.h"
149 139
204#include "table/jis0213_2.h" 194#include "table/jis0213_2.h"
205 195
206// order must match table in encoding.h(!) 196// order must match table in encoding.h(!)
207const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS] = { 197const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS] = {
208 &rxvt_codeset_conv_unknown, 198 &rxvt_codeset_conv_unknown,
209 &rxvt_codeset_conv_special,
210 199
211 &rxvt_codeset_conv_us_ascii, 200 &rxvt_codeset_conv_us_ascii,
212 201
213 &rxvt_codeset_conv_iso8859_1, 202 &rxvt_codeset_conv_iso8859_1,
214 &rxvt_codeset_conv_iso8859_2, 203 &rxvt_codeset_conv_iso8859_2,
256 245
257 &rxvt_codeset_conv_unicode_16, 246 &rxvt_codeset_conv_unicode_16,
258 &rxvt_codeset_conv_unicode 247 &rxvt_codeset_conv_unicode
259}; 248};
260 249
250//#define ENCODING_COMPOSE
251
252#include "table/compose.h"
253
254uint32_t
255rxvt_compose (uint32_t c1, uint32_t c2)
256{
257 int l = 0;
258 int r = sizeof (rxvt_compose_table) / sizeof (rxvt_compose_entry) - 1;
259 int m;
260
261 while (r > l)
262 {
263 m = (l + r) / 2;
264 rxvt_compose_entry &c = rxvt_compose_table[m];
265
266 if (c.c1 < c1 || (c.c1 == c1 && c.c2 < c2))
267 l = m + 1;
268 else if (c.c1 > c1 || (c.c1 == c1 && c.c2 > c2))
269 r = m - 1;
270 else
271 return c.r;
272 }
273
274 return NOCHAR;
275}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines