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.17 by root, Mon Jun 21 18:19:28 2004 UTC vs.
Revision 1.22 by root, Thu Sep 15 21:13:39 2005 UTC

58 58
59 { "ASCII", CS_US_ASCII }, 59 { "ASCII", CS_US_ASCII },
60 { "USASCII", CS_US_ASCII }, 60 { "USASCII", CS_US_ASCII },
61 { "ANSIX341968", CS_US_ASCII }, 61 { "ANSIX341968", CS_US_ASCII },
62 62
63 { "KOI8R", CS_KOI8_R }, 63 { "KOI8R*", CS_KOI8_R },
64 { "GOST1976874*", CS_KOI8_R }, 64 { "GOST1976874*", CS_KOI8_R },
65 { "KOI8RU", CS_KOI8_U }, 65 { "KOI8RU", CS_KOI8_U },
66 { "KOI8U", CS_KOI8_U }, 66 { "KOI8U", CS_KOI8_U },
67 67
68 { "VISCII*", CS_VISCII }, 68 { "VISCII*", CS_VISCII },
81 81
82 { "BIG5P*", CS_BIG5_PLUS }, 82 { "BIG5P*", CS_BIG5_PLUS },
83 { "BIG5ETEN*", CS_BIG5_EXT }, 83 { "BIG5ETEN*", CS_BIG5_EXT },
84 { "BIG5*", CS_BIG5 }, 84 { "BIG5*", CS_BIG5 },
85 { "GB2312*", CS_GB2312_1980_0 }, 85 { "GB2312*", CS_GB2312_1980_0 },
86 { "GBK*", CS_GBK_0 },
86 { "GB6345*", CS_GB2312_1980_0 }, // slightly different to gb2312?? 87 { "GB6345*", CS_GB2312_1980_0 }, // slightly different to gb2312??
87 { "GB8565*", CS_GB2312_1980_0 }, // a superset of gb2312?? 88 { "GB8565*", CS_GB2312_1980_0 }, // a superset of gb2312??
88 { "GB13000*", CS_UNICODE }, 89 { "GB13000*", CS_UNICODE },
89 { "CNS1164319921", CS_CNS11643_1992_1 }, 90 { "CNS1164319921", CS_CNS11643_1992_1 },
90 { "CNS1164319922", CS_CNS11643_1992_2 }, 91 { "CNS1164319922", CS_CNS11643_1992_2 },
137 } while ((++i)->name); 138 } while ((++i)->name);
138 139
139 return CS_UNKNOWN; 140 return CS_UNKNOWN;
140} 141}
141 142
142struct rxvt_codeset_conv_unknown : rxvt_codeset_conv {
143 unicode_t to_unicode (uint32_t enc) const { return NOCHAR; } 143static unicode_t cs_unknown_to_unicode (uint32_t enc) { return NOCHAR; }
144 uint32_t from_unicode (unicode_t unicode) const { return NOCHAR; } 144static uint32_t cs_unknown_from_unicode (unicode_t unicode) { return NOCHAR; }
145} rxvt_codeset_conv_unknown;
146 145
147struct rxvt_codeset_conv_us_ascii : rxvt_codeset_conv { 146static unicode_t cs_unicode_to_unicode (uint32_t enc) { return enc; }
147static uint32_t cs_unicode_from_unicode (unicode_t unicode) { return unicode; }
148
149#define cs_us_ascii_to_unicode cs_unicode_to_unicode
148 uint32_t from_unicode (unicode_t unicode) const { return unicode <= 127 ? unicode : NOCHAR; } 150static uint32_t cs_us_ascii_from_unicode (unicode_t unicode) { return unicode <= 127 ? unicode : NOCHAR; }
149} rxvt_codeset_conv_us_ascii;
150 151
151struct rxvt_codeset_conv_unicode : rxvt_codeset_conv { 152#define cs_us_ascii_to_unicode_16 cs_unicode_to_unicode
152 /* transparent */
153} rxvt_codeset_conv_unicode;
154
155struct rxvt_codeset_conv_unicode_16 : rxvt_codeset_conv {
156 unicode_t to_unicode (uint32_t enc) const { return enc; }
157 uint32_t from_unicode (unicode_t unicode) const { return unicode <= 65535 ? unicode : NOCHAR; } 153static uint32_t cs_unicode_16_from_unicode (unicode_t unicode) { return unicode <= 65535 ? unicode : NOCHAR; }
158} rxvt_codeset_conv_unicode_16;
159 154
160#define ENCODING_DEFAULT 155#define ENCODING_DEFAULT
161 156
162#include "table/iso8859_1.h" 157#include "table/iso8859_1.h"
163#include "table/iso8859_15.h" 158#include "table/iso8859_15.h"
183 178
184//#define ENCODING_KR 179//#define ENCODING_KR
185 180
186#include "table/ksc5601_1987_0.h" 181#include "table/ksc5601_1987_0.h"
187 182
188//#define ENCODING_CN 183//#define ENCODING_ZH
189 184
185#include "table/big5.h"
186#include "table/gbk_0.h"
190#include "table/gb2312_1980_0.h" 187#include "table/gb2312_1980_0.h"
191#include "table/big5.h"
192 188
193//#define ENCODING_CN_EXT 189//#define ENCODING_ZH_EXT
194 190
195#include "table/cns11643_1992_1.h" 191#include "table/cns11643_1992_1.h"
196#include "table/cns11643_1992_2.h" 192#include "table/cns11643_1992_2.h"
197#include "table/cns11643_1992_3.h" 193#include "table/cns11643_1992_3.h"
198#include "table/cns11643_1992_4.h" 194#include "table/cns11643_1992_4.h"
216//#define ENCODING_JP_EXT 212//#define ENCODING_JP_EXT
217 213
218#include "table/jis0213_1.h" 214#include "table/jis0213_1.h"
219#include "table/jis0213_2.h" 215#include "table/jis0213_2.h"
220 216
217#if ENCODING_TO_UNICODE
218# define ENC(base) { cs_ ## base ## _from_unicode, cs_ ## base ## _to_unicode }
219#else
220# define ENC(base) { cs_ ## base ## _from_unicode }
221#endif
222
223
221// order must match table in encoding.h(!) 224// order must match table in encoding.h(!)
222const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS] = { 225const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS] = {
223 &rxvt_codeset_conv_unknown, 226 ENC (unknown),
224 227
225 &rxvt_codeset_conv_us_ascii, 228 ENC (us_ascii),
226 229
227 &rxvt_codeset_conv_iso8859_1, 230 ENC (iso8859_1),
228 &rxvt_codeset_conv_iso8859_2, 231 ENC (iso8859_2),
229 &rxvt_codeset_conv_iso8859_3, 232 ENC (iso8859_3),
230 &rxvt_codeset_conv_iso8859_4, 233 ENC (iso8859_4),
231 &rxvt_codeset_conv_iso8859_5, 234 ENC (iso8859_5),
232 &rxvt_codeset_conv_iso8859_6, 235 ENC (iso8859_6),
233 &rxvt_codeset_conv_iso8859_7, 236 ENC (iso8859_7),
234 &rxvt_codeset_conv_iso8859_8, 237 ENC (iso8859_8),
235 &rxvt_codeset_conv_iso8859_9, 238 ENC (iso8859_9),
236 &rxvt_codeset_conv_iso8859_10, 239 ENC (iso8859_10),
237 &rxvt_codeset_conv_iso8859_11, 240 ENC (iso8859_11),
238 &rxvt_codeset_conv_iso8859_13, 241 ENC (iso8859_13),
239 &rxvt_codeset_conv_iso8859_14, 242 ENC (iso8859_14),
240 &rxvt_codeset_conv_iso8859_15, 243 ENC (iso8859_15),
241 &rxvt_codeset_conv_iso8859_16, 244 ENC (iso8859_16),
242 245
243 &rxvt_codeset_conv_koi8_r, 246 ENC (koi8_r),
244 &rxvt_codeset_conv_koi8_u, 247 ENC (koi8_u),
245 248
246 &rxvt_codeset_conv_jis0201_1976_0, 249 ENC (jis0201_1976_0),
247 &rxvt_codeset_conv_jis0208_1990_0, 250 ENC (jis0208_1990_0),
248 &rxvt_codeset_conv_jis0212_1990_0, 251 ENC (jis0212_1990_0),
249 252
250 &rxvt_codeset_conv_jis0213_1, 253 ENC (jis0213_1),
251 &rxvt_codeset_conv_jis0213_2, 254 ENC (jis0213_2),
252 255
253 &rxvt_codeset_conv_ksc5601_1987_0, 256 ENC (ksc5601_1987_0),
254 257
255 &rxvt_codeset_conv_gb2312_1980_0, 258 ENC (gb2312_1980_0),
259 ENC (gbk_0),
256 260
257 &rxvt_codeset_conv_cns11643_1992_1, 261 ENC (cns11643_1992_1),
258 &rxvt_codeset_conv_cns11643_1992_2, 262 ENC (cns11643_1992_2),
259 &rxvt_codeset_conv_cns11643_1992_3, 263 ENC (cns11643_1992_3),
260 &rxvt_codeset_conv_cns11643_1992_4, 264 ENC (cns11643_1992_4),
261 &rxvt_codeset_conv_cns11643_1992_5, 265 ENC (cns11643_1992_5),
262 &rxvt_codeset_conv_cns11643_1992_6, 266 ENC (cns11643_1992_6),
263 &rxvt_codeset_conv_cns11643_1992_7, 267 ENC (cns11643_1992_7),
264 &rxvt_codeset_conv_cns11643_1992_f, 268 ENC (cns11643_1992_f),
265 &rxvt_codeset_conv_big5, 269 ENC (big5),
266 &rxvt_codeset_conv_big5_ext, 270 ENC (big5_ext),
267 &rxvt_codeset_conv_big5_plus, 271 ENC (big5_plus),
268 272
269 &rxvt_codeset_conv_viscii, 273 ENC (viscii),
270 274
271 &rxvt_codeset_conv_unicode_16, 275 ENC (unicode_16),
272 &rxvt_codeset_conv_unicode 276 ENC (unicode),
273}; 277};
274 278
275#if ENABLE_COMBINING 279#if ENABLE_COMBINING
276# define ENCODING_COMPOSE 280# define ENCODING_COMPOSE
277#endif 281#endif
303 307
304#include "table/category.h" 308#include "table/category.h"
305 309
306bool unicode::is_space (unicode_t c) 310bool unicode::is_space (unicode_t c)
307{ 311{
308 return IS_SPACE (c); 312 return IS_SPACE (c)
313 || c == 0x09; // exclude tabs, too, as we store them in the buffer
309} 314}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines