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.16 by pcg, Thu Apr 8 20:31:45 2004 UTC vs.
Revision 1.20 by root, Sun Sep 5 09:32:59 2004 UTC

66 { "KOI8U", CS_KOI8_U }, 66 { "KOI8U", CS_KOI8_U },
67 67
68 { "VISCII*", CS_VISCII }, 68 { "VISCII*", CS_VISCII },
69 69
70 { "JISX0201*", CS_JIS0201_1976_0 }, 70 { "JISX0201*", CS_JIS0201_1976_0 },
71 { "JISC6226*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP)
71 { "JISX0208*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP) 72 { "JISX0208*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP)
72 { "JISX0212*", CS_JIS0212_1990_0 }, 73 { "JISX0212*", CS_JIS0212_1990_0 },
73 { "JISX021320001", CS_JIS0213_1 }, 74 { "JISX021320001", CS_JIS0213_1 },
74 { "JISX021320002", CS_JIS0213_2 }, 75 { "JISX021320002", CS_JIS0213_2 },
75 { "JISX0221*", CS_UNICODE }, // _very_ close 76 { "JISX0221*", CS_UNICODE }, // _very_ close
136 } while ((++i)->name); 137 } while ((++i)->name);
137 138
138 return CS_UNKNOWN; 139 return CS_UNKNOWN;
139} 140}
140 141
141struct rxvt_codeset_conv_unknown : rxvt_codeset_conv {
142 unicode_t to_unicode (uint32_t enc) const { return NOCHAR; } 142static unicode_t cs_unknown_to_unicode (uint32_t enc) { return NOCHAR; }
143 uint32_t from_unicode (unicode_t unicode) const { return NOCHAR; } 143static uint32_t cs_unknown_from_unicode (unicode_t unicode) { return NOCHAR; }
144} rxvt_codeset_conv_unknown;
145 144
146struct rxvt_codeset_conv_us_ascii : rxvt_codeset_conv { 145static unicode_t cs_unicode_to_unicode (uint32_t enc) { return enc; }
146static uint32_t cs_unicode_from_unicode (unicode_t unicode) { return unicode; }
147
148#define cs_us_ascii_to_unicode cs_unicode_to_unicode
147 uint32_t from_unicode (unicode_t unicode) const { return unicode <= 127 ? unicode : NOCHAR; } 149static uint32_t cs_us_ascii_from_unicode (unicode_t unicode) { return unicode <= 127 ? unicode : NOCHAR; }
148} rxvt_codeset_conv_us_ascii;
149 150
150struct rxvt_codeset_conv_unicode : rxvt_codeset_conv { 151#define cs_us_ascii_to_unicode_16 cs_unicode_to_unicode
151 /* transparent */
152} rxvt_codeset_conv_unicode;
153
154struct rxvt_codeset_conv_unicode_16 : rxvt_codeset_conv {
155 unicode_t to_unicode (uint32_t enc) const { return enc; }
156 uint32_t from_unicode (unicode_t unicode) const { return unicode <= 65535 ? unicode : NOCHAR; } 152static uint32_t cs_unicode_16_from_unicode (unicode_t unicode) { return unicode <= 65535 ? unicode : NOCHAR; }
157} rxvt_codeset_conv_unicode_16;
158 153
159#define ENCODING_DEFAULT 154#define ENCODING_DEFAULT
160 155
161#include "table/iso8859_1.h" 156#include "table/iso8859_1.h"
162#include "table/iso8859_15.h" 157#include "table/iso8859_15.h"
182 177
183//#define ENCODING_KR 178//#define ENCODING_KR
184 179
185#include "table/ksc5601_1987_0.h" 180#include "table/ksc5601_1987_0.h"
186 181
187//#define ENCODING_CN 182//#define ENCODING_ZH
188 183
189#include "table/gb2312_1980_0.h" 184#include "table/gb2312_1980_0.h"
190#include "table/big5.h" 185#include "table/big5.h"
191 186
192//#define ENCODING_CN_EXT 187//#define ENCODING_ZH_EXT
193 188
194#include "table/cns11643_1992_1.h" 189#include "table/cns11643_1992_1.h"
195#include "table/cns11643_1992_2.h" 190#include "table/cns11643_1992_2.h"
196#include "table/cns11643_1992_3.h" 191#include "table/cns11643_1992_3.h"
197#include "table/cns11643_1992_4.h" 192#include "table/cns11643_1992_4.h"
215//#define ENCODING_JP_EXT 210//#define ENCODING_JP_EXT
216 211
217#include "table/jis0213_1.h" 212#include "table/jis0213_1.h"
218#include "table/jis0213_2.h" 213#include "table/jis0213_2.h"
219 214
215#if ENCODING_TO_UNICODE
216# define ENC(base) { cs_ ## base ## _from_unicode, cs_ ## base ## _to_unicode }
217#else
218# define ENC(base) { cs_ ## base ## _from_unicode }
219#endif
220
221
220// order must match table in encoding.h(!) 222// order must match table in encoding.h(!)
221const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS] = { 223const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS] = {
222 &rxvt_codeset_conv_unknown, 224 ENC (unknown),
223 225
224 &rxvt_codeset_conv_us_ascii, 226 ENC (us_ascii),
225 227
226 &rxvt_codeset_conv_iso8859_1, 228 ENC (iso8859_1),
227 &rxvt_codeset_conv_iso8859_2, 229 ENC (iso8859_2),
228 &rxvt_codeset_conv_iso8859_3, 230 ENC (iso8859_3),
229 &rxvt_codeset_conv_iso8859_4, 231 ENC (iso8859_4),
230 &rxvt_codeset_conv_iso8859_5, 232 ENC (iso8859_5),
231 &rxvt_codeset_conv_iso8859_6, 233 ENC (iso8859_6),
232 &rxvt_codeset_conv_iso8859_7, 234 ENC (iso8859_7),
233 &rxvt_codeset_conv_iso8859_8, 235 ENC (iso8859_8),
234 &rxvt_codeset_conv_iso8859_9, 236 ENC (iso8859_9),
235 &rxvt_codeset_conv_iso8859_10, 237 ENC (iso8859_10),
236 &rxvt_codeset_conv_iso8859_11, 238 ENC (iso8859_11),
237 &rxvt_codeset_conv_iso8859_13, 239 ENC (iso8859_13),
238 &rxvt_codeset_conv_iso8859_14, 240 ENC (iso8859_14),
239 &rxvt_codeset_conv_iso8859_15, 241 ENC (iso8859_15),
240 &rxvt_codeset_conv_iso8859_16, 242 ENC (iso8859_16),
241 243
242 &rxvt_codeset_conv_koi8_r, 244 ENC (koi8_r),
243 &rxvt_codeset_conv_koi8_u, 245 ENC (koi8_u),
244 246
245 &rxvt_codeset_conv_jis0201_1976_0, 247 ENC (jis0201_1976_0),
246 &rxvt_codeset_conv_jis0208_1990_0, 248 ENC (jis0208_1990_0),
247 &rxvt_codeset_conv_jis0212_1990_0, 249 ENC (jis0212_1990_0),
248 250
249 &rxvt_codeset_conv_jis0213_1, 251 ENC (jis0213_1),
250 &rxvt_codeset_conv_jis0213_2, 252 ENC (jis0213_2),
251 253
252 &rxvt_codeset_conv_ksc5601_1987_0, 254 ENC (ksc5601_1987_0),
253 255
254 &rxvt_codeset_conv_gb2312_1980_0, 256 ENC (gb2312_1980_0),
255 257
256 &rxvt_codeset_conv_cns11643_1992_1, 258 ENC (cns11643_1992_1),
257 &rxvt_codeset_conv_cns11643_1992_2, 259 ENC (cns11643_1992_2),
258 &rxvt_codeset_conv_cns11643_1992_3, 260 ENC (cns11643_1992_3),
259 &rxvt_codeset_conv_cns11643_1992_4, 261 ENC (cns11643_1992_4),
260 &rxvt_codeset_conv_cns11643_1992_5, 262 ENC (cns11643_1992_5),
261 &rxvt_codeset_conv_cns11643_1992_6, 263 ENC (cns11643_1992_6),
262 &rxvt_codeset_conv_cns11643_1992_7, 264 ENC (cns11643_1992_7),
263 &rxvt_codeset_conv_cns11643_1992_f, 265 ENC (cns11643_1992_f),
264 &rxvt_codeset_conv_big5, 266 ENC (big5),
265 &rxvt_codeset_conv_big5_ext, 267 ENC (big5_ext),
266 &rxvt_codeset_conv_big5_plus, 268 ENC (big5_plus),
267 269
268 &rxvt_codeset_conv_viscii, 270 ENC (viscii),
269 271
270 &rxvt_codeset_conv_unicode_16, 272 ENC (unicode_16),
271 &rxvt_codeset_conv_unicode 273 ENC (unicode),
272}; 274};
273 275
274#if ENABLE_COMBINING 276#if ENABLE_COMBINING
275# define ENCODING_COMPOSE 277# define ENCODING_COMPOSE
276#endif 278#endif
302 304
303#include "table/category.h" 305#include "table/category.h"
304 306
305bool unicode::is_space (unicode_t c) 307bool unicode::is_space (unicode_t c)
306{ 308{
307 return IS_SPACE (c); 309 return IS_SPACE (c)
310 || c == 0x09; // exclude tabs, too, as we store them in the buffer
308} 311}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines