2010-06-21 Atsushi Enomoto <atsushi@ximian.com>
[mcs.git] / class / I18N / Other / CP874.cs
blob1f08062fbb4c9023b705f4d0a2574e09c95804cf
1 /*
2 * CP874.cs - Thai (Windows) code page.
4 * Copyright (c) 2002 Southern Storm Software, Pty Ltd
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
25 // Generated from "ibm-874.ucm".
27 namespace I18N.Other
30 using System;
31 using System.Text;
32 using I18N.Common;
34 [Serializable]
35 public class CP874 : ByteEncoding
37 public CP874()
38 : base(874, ToChars, "Thai (Windows)",
39 "windows-874", "windows-874", "windows-874",
40 true, true, true, true, 874)
43 private static readonly char[] ToChars = {
44 '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
45 '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B',
46 '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
47 '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017',
48 '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D',
49 '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023',
50 '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029',
51 '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F',
52 '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
53 '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B',
54 '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041',
55 '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047',
56 '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D',
57 '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053',
58 '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059',
59 '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F',
60 '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065',
61 '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B',
62 '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071',
63 '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077',
64 '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D',
65 '\u007E', '\u001A', '\u003F', '\u003F', '\u003F', '\u003F',
66 '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
67 '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
68 '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
69 '\u003F', '\u003F', '\u003F', '\u003F', '\u003F', '\u003F',
70 '\u003F', '\u003F', '\u003F', '\u003F', '\u0E48', '\u0E01',
71 '\u0E02', '\u0E03', '\u0E04', '\u0E05', '\u0E06', '\u0E07',
72 '\u0E08', '\u0E09', '\u0E0A', '\u0E0B', '\u0E0C', '\u0E0D',
73 '\u0E0E', '\u0E0F', '\u0E10', '\u0E11', '\u0E12', '\u0E13',
74 '\u0E14', '\u0E15', '\u0E16', '\u0E17', '\u0E18', '\u0E19',
75 '\u0E1A', '\u0E1B', '\u0E1C', '\u0E1D', '\u0E1E', '\u0E1F',
76 '\u0E20', '\u0E21', '\u0E22', '\u0E23', '\u0E24', '\u0E25',
77 '\u0E26', '\u0E27', '\u0E28', '\u0E29', '\u0E2A', '\u0E2B',
78 '\u0E2C', '\u0E2D', '\u0E2E', '\u0E2F', '\u0E30', '\u0E31',
79 '\u0E32', '\u0E33', '\u0E34', '\u0E35', '\u0E36', '\u0E37',
80 '\u0E38', '\u0E39', '\u0E3A', '\u0E49', '\u0E4A', '\u0E4B',
81 '\u0E4C', '\u0E3F', '\u0E40', '\u0E41', '\u0E42', '\u0E43',
82 '\u0E44', '\u0E45', '\u0E46', '\u0E47', '\u0E48', '\u0E49',
83 '\u0E4A', '\u0E4B', '\u0E4C', '\u0E4D', '\u0E4E', '\u0E4F',
84 '\u0E50', '\u0E51', '\u0E52', '\u0E53', '\u0E54', '\u0E55',
85 '\u0E56', '\u0E57', '\u0E58', '\u0E59', '\u0E5A', '\u0E5B',
86 '\u00A2', '\u00AC', '\u00A6', '\u00A0',
89 protected unsafe override void ToBytes(char* chars, int charCount,
90 byte* bytes, int byteCount)
92 int ch;
93 int charIndex = 0;
94 int byteIndex = 0;
95 #if NET_2_0
96 EncoderFallbackBuffer buffer = null;
97 #endif
98 while(charCount > 0)
100 ch = (int)(chars[charIndex++]);
101 if(ch >= 26) switch(ch)
103 case 0x001B:
104 case 0x001D:
105 case 0x001E:
106 case 0x001F:
107 case 0x0020:
108 case 0x0021:
109 case 0x0022:
110 case 0x0023:
111 case 0x0024:
112 case 0x0025:
113 case 0x0026:
114 case 0x0027:
115 case 0x0028:
116 case 0x0029:
117 case 0x002A:
118 case 0x002B:
119 case 0x002C:
120 case 0x002D:
121 case 0x002E:
122 case 0x002F:
123 case 0x0030:
124 case 0x0031:
125 case 0x0032:
126 case 0x0033:
127 case 0x0034:
128 case 0x0035:
129 case 0x0036:
130 case 0x0037:
131 case 0x0038:
132 case 0x0039:
133 case 0x003A:
134 case 0x003B:
135 case 0x003C:
136 case 0x003D:
137 case 0x003E:
138 case 0x003F:
139 case 0x0040:
140 case 0x0041:
141 case 0x0042:
142 case 0x0043:
143 case 0x0044:
144 case 0x0045:
145 case 0x0046:
146 case 0x0047:
147 case 0x0048:
148 case 0x0049:
149 case 0x004A:
150 case 0x004B:
151 case 0x004C:
152 case 0x004D:
153 case 0x004E:
154 case 0x004F:
155 case 0x0050:
156 case 0x0051:
157 case 0x0052:
158 case 0x0053:
159 case 0x0054:
160 case 0x0055:
161 case 0x0056:
162 case 0x0057:
163 case 0x0058:
164 case 0x0059:
165 case 0x005A:
166 case 0x005B:
167 case 0x005C:
168 case 0x005D:
169 case 0x005E:
170 case 0x005F:
171 case 0x0060:
172 case 0x0061:
173 case 0x0062:
174 case 0x0063:
175 case 0x0064:
176 case 0x0065:
177 case 0x0066:
178 case 0x0067:
179 case 0x0068:
180 case 0x0069:
181 case 0x006A:
182 case 0x006B:
183 case 0x006C:
184 case 0x006D:
185 case 0x006E:
186 case 0x006F:
187 case 0x0070:
188 case 0x0071:
189 case 0x0072:
190 case 0x0073:
191 case 0x0074:
192 case 0x0075:
193 case 0x0076:
194 case 0x0077:
195 case 0x0078:
196 case 0x0079:
197 case 0x007A:
198 case 0x007B:
199 case 0x007C:
200 case 0x007D:
201 case 0x007E:
202 break;
203 case 0x001A: ch = 0x7F; break;
204 case 0x001C: ch = 0x1A; break;
205 case 0x007F: ch = 0x1C; break;
206 case 0x00A0: ch = 0xFF; break;
207 case 0x00A2: ch = 0xFC; break;
208 case 0x00A6: ch = 0xFE; break;
209 case 0x00AC: ch = 0xFD; break;
210 case 0x0E01:
211 case 0x0E02:
212 case 0x0E03:
213 case 0x0E04:
214 case 0x0E05:
215 case 0x0E06:
216 case 0x0E07:
217 case 0x0E08:
218 case 0x0E09:
219 case 0x0E0A:
220 case 0x0E0B:
221 case 0x0E0C:
222 case 0x0E0D:
223 case 0x0E0E:
224 case 0x0E0F:
225 case 0x0E10:
226 case 0x0E11:
227 case 0x0E12:
228 case 0x0E13:
229 case 0x0E14:
230 case 0x0E15:
231 case 0x0E16:
232 case 0x0E17:
233 case 0x0E18:
234 case 0x0E19:
235 case 0x0E1A:
236 case 0x0E1B:
237 case 0x0E1C:
238 case 0x0E1D:
239 case 0x0E1E:
240 case 0x0E1F:
241 case 0x0E20:
242 case 0x0E21:
243 case 0x0E22:
244 case 0x0E23:
245 case 0x0E24:
246 case 0x0E25:
247 case 0x0E26:
248 case 0x0E27:
249 case 0x0E28:
250 case 0x0E29:
251 case 0x0E2A:
252 case 0x0E2B:
253 case 0x0E2C:
254 case 0x0E2D:
255 case 0x0E2E:
256 case 0x0E2F:
257 case 0x0E30:
258 case 0x0E31:
259 case 0x0E32:
260 case 0x0E33:
261 case 0x0E34:
262 case 0x0E35:
263 case 0x0E36:
264 case 0x0E37:
265 case 0x0E38:
266 case 0x0E39:
267 case 0x0E3A:
268 ch -= 0x0D60;
269 break;
270 case 0x0E3F:
271 case 0x0E40:
272 case 0x0E41:
273 case 0x0E42:
274 case 0x0E43:
275 case 0x0E44:
276 case 0x0E45:
277 case 0x0E46:
278 case 0x0E47:
279 case 0x0E48:
280 case 0x0E49:
281 case 0x0E4A:
282 case 0x0E4B:
283 case 0x0E4C:
284 case 0x0E4D:
285 case 0x0E4E:
286 case 0x0E4F:
287 case 0x0E50:
288 case 0x0E51:
289 case 0x0E52:
290 case 0x0E53:
291 case 0x0E54:
292 case 0x0E55:
293 case 0x0E56:
294 case 0x0E57:
295 case 0x0E58:
296 case 0x0E59:
297 case 0x0E5A:
298 case 0x0E5B:
299 ch -= 0x0D60;
300 break;
301 default:
303 if(ch >= 0xFF01 && ch <= 0xFF5E)
304 ch -= 0xFEE0;
305 else
306 #if NET_2_0
307 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
308 #else
309 ch = 0x3F;
310 #endif
312 break;
314 bytes[byteIndex++] = (byte)ch;
315 --charCount;
316 --byteCount;
321 protected override void ToBytes(String s, int charIndex, int charCount,
322 byte[] bytes, int byteIndex)
324 int ch;
325 while(charCount > 0)
327 ch = (int)(s[charIndex++]);
328 if(ch >= 26) switch(ch)
330 case 0x001B:
331 case 0x001D:
332 case 0x001E:
333 case 0x001F:
334 case 0x0020:
335 case 0x0021:
336 case 0x0022:
337 case 0x0023:
338 case 0x0024:
339 case 0x0025:
340 case 0x0026:
341 case 0x0027:
342 case 0x0028:
343 case 0x0029:
344 case 0x002A:
345 case 0x002B:
346 case 0x002C:
347 case 0x002D:
348 case 0x002E:
349 case 0x002F:
350 case 0x0030:
351 case 0x0031:
352 case 0x0032:
353 case 0x0033:
354 case 0x0034:
355 case 0x0035:
356 case 0x0036:
357 case 0x0037:
358 case 0x0038:
359 case 0x0039:
360 case 0x003A:
361 case 0x003B:
362 case 0x003C:
363 case 0x003D:
364 case 0x003E:
365 case 0x003F:
366 case 0x0040:
367 case 0x0041:
368 case 0x0042:
369 case 0x0043:
370 case 0x0044:
371 case 0x0045:
372 case 0x0046:
373 case 0x0047:
374 case 0x0048:
375 case 0x0049:
376 case 0x004A:
377 case 0x004B:
378 case 0x004C:
379 case 0x004D:
380 case 0x004E:
381 case 0x004F:
382 case 0x0050:
383 case 0x0051:
384 case 0x0052:
385 case 0x0053:
386 case 0x0054:
387 case 0x0055:
388 case 0x0056:
389 case 0x0057:
390 case 0x0058:
391 case 0x0059:
392 case 0x005A:
393 case 0x005B:
394 case 0x005C:
395 case 0x005D:
396 case 0x005E:
397 case 0x005F:
398 case 0x0060:
399 case 0x0061:
400 case 0x0062:
401 case 0x0063:
402 case 0x0064:
403 case 0x0065:
404 case 0x0066:
405 case 0x0067:
406 case 0x0068:
407 case 0x0069:
408 case 0x006A:
409 case 0x006B:
410 case 0x006C:
411 case 0x006D:
412 case 0x006E:
413 case 0x006F:
414 case 0x0070:
415 case 0x0071:
416 case 0x0072:
417 case 0x0073:
418 case 0x0074:
419 case 0x0075:
420 case 0x0076:
421 case 0x0077:
422 case 0x0078:
423 case 0x0079:
424 case 0x007A:
425 case 0x007B:
426 case 0x007C:
427 case 0x007D:
428 case 0x007E:
429 break;
430 case 0x001A: ch = 0x7F; break;
431 case 0x001C: ch = 0x1A; break;
432 case 0x007F: ch = 0x1C; break;
433 case 0x00A0: ch = 0xFF; break;
434 case 0x00A2: ch = 0xFC; break;
435 case 0x00A6: ch = 0xFE; break;
436 case 0x00AC: ch = 0xFD; break;
437 case 0x0E01:
438 case 0x0E02:
439 case 0x0E03:
440 case 0x0E04:
441 case 0x0E05:
442 case 0x0E06:
443 case 0x0E07:
444 case 0x0E08:
445 case 0x0E09:
446 case 0x0E0A:
447 case 0x0E0B:
448 case 0x0E0C:
449 case 0x0E0D:
450 case 0x0E0E:
451 case 0x0E0F:
452 case 0x0E10:
453 case 0x0E11:
454 case 0x0E12:
455 case 0x0E13:
456 case 0x0E14:
457 case 0x0E15:
458 case 0x0E16:
459 case 0x0E17:
460 case 0x0E18:
461 case 0x0E19:
462 case 0x0E1A:
463 case 0x0E1B:
464 case 0x0E1C:
465 case 0x0E1D:
466 case 0x0E1E:
467 case 0x0E1F:
468 case 0x0E20:
469 case 0x0E21:
470 case 0x0E22:
471 case 0x0E23:
472 case 0x0E24:
473 case 0x0E25:
474 case 0x0E26:
475 case 0x0E27:
476 case 0x0E28:
477 case 0x0E29:
478 case 0x0E2A:
479 case 0x0E2B:
480 case 0x0E2C:
481 case 0x0E2D:
482 case 0x0E2E:
483 case 0x0E2F:
484 case 0x0E30:
485 case 0x0E31:
486 case 0x0E32:
487 case 0x0E33:
488 case 0x0E34:
489 case 0x0E35:
490 case 0x0E36:
491 case 0x0E37:
492 case 0x0E38:
493 case 0x0E39:
494 case 0x0E3A:
495 ch -= 0x0D60;
496 break;
497 case 0x0E3F:
498 case 0x0E40:
499 case 0x0E41:
500 case 0x0E42:
501 case 0x0E43:
502 case 0x0E44:
503 case 0x0E45:
504 case 0x0E46:
505 case 0x0E47:
506 case 0x0E48:
507 case 0x0E49:
508 case 0x0E4A:
509 case 0x0E4B:
510 case 0x0E4C:
511 case 0x0E4D:
512 case 0x0E4E:
513 case 0x0E4F:
514 case 0x0E50:
515 case 0x0E51:
516 case 0x0E52:
517 case 0x0E53:
518 case 0x0E54:
519 case 0x0E55:
520 case 0x0E56:
521 case 0x0E57:
522 case 0x0E58:
523 case 0x0E59:
524 case 0x0E5A:
525 case 0x0E5B:
526 ch -= 0x0D60;
527 break;
528 default:
530 if(ch >= 0xFF01 && ch <= 0xFF5E)
531 ch -= 0xFEE0;
532 else
533 ch = 0x3F;
535 break;
537 bytes[byteIndex++] = (byte)ch;
538 --charCount;
543 }; // class CP874
545 [Serializable]
546 public class ENCwindows_874 : CP874
548 public ENCwindows_874() : base() {}
550 }; // class ENCwindows_874
552 }; // namespace I18N.Other