[MacSDK] Bump Nuget to 4.8.2
[mono-project.git] / mcs / class / I18N / Rare / CP20280.cs
blob825c16af622918959258d913c1030e7f7eb344b0
1 /*
2 * CP20280.cs - IBM EBCDIC (Italy) 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-280.ucm".
27 // WARNING: Modifying this file directly might be a bad idea.
28 // You should edit the code generator tools/ucm2cp.c instead for your changes
29 // to appear in all relevant classes.
30 namespace I18N.Rare
33 using System;
34 using System.Text;
35 using I18N.Common;
37 [Serializable]
38 public class CP20280 : ByteEncoding
40 public CP20280()
41 : base(20280, ToChars, "IBM EBCDIC (Italy)",
42 "IBM280", "IBM280", "IBM280",
43 false, false, false, false, 1252)
46 private static readonly char[] ToChars = {
47 '\u0000', '\u0001', '\u0002', '\u0003', '\u009C', '\u0009',
48 '\u0086', '\u007F', '\u0097', '\u008D', '\u008E', '\u000B',
49 '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011',
50 '\u0012', '\u0013', '\u009D', '\u0085', '\u0008', '\u0087',
51 '\u0018', '\u0019', '\u0092', '\u008F', '\u001C', '\u001D',
52 '\u001E', '\u001F', '\u0080', '\u0081', '\u0082', '\u0083',
53 '\u0084', '\u000A', '\u0017', '\u001B', '\u0088', '\u0089',
54 '\u008A', '\u008B', '\u008C', '\u0005', '\u0006', '\u0007',
55 '\u0090', '\u0091', '\u0016', '\u0093', '\u0094', '\u0095',
56 '\u0096', '\u0004', '\u0098', '\u0099', '\u009A', '\u009B',
57 '\u0014', '\u0015', '\u009E', '\u001A', '\u0020', '\u00A0',
58 '\u00E2', '\u00E4', '\u007B', '\u00E1', '\u00E3', '\u00E5',
59 '\u005C', '\u00F1', '\u00B0', '\u002E', '\u003C', '\u0028',
60 '\u002B', '\u0021', '\u0026', '\u005D', '\u00EA', '\u00EB',
61 '\u007D', '\u00ED', '\u00EE', '\u00EF', '\u007E', '\u00DF',
62 '\u00E9', '\u0024', '\u002A', '\u0029', '\u003B', '\u005E',
63 '\u002D', '\u002F', '\u00C2', '\u00C4', '\u00C0', '\u00C1',
64 '\u00C3', '\u00C5', '\u00C7', '\u00D1', '\u00F2', '\u002C',
65 '\u0025', '\u005F', '\u003E', '\u003F', '\u00F8', '\u00C9',
66 '\u00CA', '\u00CB', '\u00C8', '\u00CD', '\u00CE', '\u00CF',
67 '\u00CC', '\u00F9', '\u003A', '\u00A3', '\u00A7', '\u0027',
68 '\u003D', '\u0022', '\u00D8', '\u0061', '\u0062', '\u0063',
69 '\u0064', '\u0065', '\u0066', '\u0067', '\u0068', '\u0069',
70 '\u00AB', '\u00BB', '\u00F0', '\u00FD', '\u00FE', '\u00B1',
71 '\u005B', '\u006A', '\u006B', '\u006C', '\u006D', '\u006E',
72 '\u006F', '\u0070', '\u0071', '\u0072', '\u00AA', '\u00BA',
73 '\u00E6', '\u00B8', '\u00C6', '\u00A4', '\u00B5', '\u00EC',
74 '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', '\u0078',
75 '\u0079', '\u007A', '\u00A1', '\u00BF', '\u00D0', '\u00DD',
76 '\u00DE', '\u00AE', '\u00A2', '\u0023', '\u00A5', '\u00B7',
77 '\u00A9', '\u0040', '\u00B6', '\u00BC', '\u00BD', '\u00BE',
78 '\u00AC', '\u007C', '\u00AF', '\u00A8', '\u00B4', '\u00D7',
79 '\u00E0', '\u0041', '\u0042', '\u0043', '\u0044', '\u0045',
80 '\u0046', '\u0047', '\u0048', '\u0049', '\u00AD', '\u00F4',
81 '\u00F6', '\u00A6', '\u00F3', '\u00F5', '\u00E8', '\u004A',
82 '\u004B', '\u004C', '\u004D', '\u004E', '\u004F', '\u0050',
83 '\u0051', '\u0052', '\u00B9', '\u00FB', '\u00FC', '\u0060',
84 '\u00FA', '\u00FF', '\u00E7', '\u00F7', '\u0053', '\u0054',
85 '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', '\u005A',
86 '\u00B2', '\u00D4', '\u00D6', '\u00D2', '\u00D3', '\u00D5',
87 '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035',
88 '\u0036', '\u0037', '\u0038', '\u0039', '\u00B3', '\u00DB',
89 '\u00DC', '\u00D9', '\u00DA', '\u009F',
92 // Get the number of bytes needed to encode a character buffer.
93 public unsafe override int GetByteCountImpl (char* chars, int count)
95 if (this.EncoderFallback != null) {
96 //Calculate byte count by actually doing encoding and discarding the data.
97 return GetBytesImpl(chars, count, null, 0);
99 else
101 return count;
105 // Get the number of bytes needed to encode a character buffer.
106 public override int GetByteCount (String s)
108 if (this.EncoderFallback != null)
110 //Calculate byte count by actually doing encoding and discarding the data.
111 unsafe
113 fixed (char *s_ptr = s)
115 return GetBytesImpl(s_ptr, s.Length, null, 0);
119 else
121 //byte count equals character count because no EncoderFallback set
122 return s.Length;
126 //ToBytes is just an alias for GetBytesImpl, but doesn't return byte count
127 protected unsafe override void ToBytes(char* chars, int charCount,
128 byte* bytes, int byteCount)
130 //Calling ToBytes with null destination buffer doesn't make any sense
131 if (bytes == null)
132 throw new ArgumentNullException("bytes");
133 GetBytesImpl(chars, charCount, bytes, byteCount);
136 public unsafe override int GetBytesImpl (char* chars, int charCount,
137 byte* bytes, int byteCount)
139 int ch;
140 int charIndex = 0;
141 int byteIndex = 0;
142 EncoderFallbackBuffer buffer = null;
143 while (charCount > 0)
145 ch = (int)(chars[charIndex]);
146 if(ch >= 4) switch(ch)
148 case 0x000B:
149 case 0x000C:
150 case 0x000D:
151 case 0x000E:
152 case 0x000F:
153 case 0x0010:
154 case 0x0011:
155 case 0x0012:
156 case 0x0013:
157 case 0x0018:
158 case 0x0019:
159 case 0x001C:
160 case 0x001D:
161 case 0x001E:
162 case 0x001F:
163 case 0x00B6:
164 break;
165 case 0x0004: ch = 0x37; break;
166 case 0x0005: ch = 0x2D; break;
167 case 0x0006: ch = 0x2E; break;
168 case 0x0007: ch = 0x2F; break;
169 case 0x0008: ch = 0x16; break;
170 case 0x0009: ch = 0x05; break;
171 case 0x000A: ch = 0x25; break;
172 case 0x0014: ch = 0x3C; break;
173 case 0x0015: ch = 0x3D; break;
174 case 0x0016: ch = 0x32; break;
175 case 0x0017: ch = 0x26; break;
176 case 0x001A: ch = 0x3F; break;
177 case 0x001B: ch = 0x27; break;
178 case 0x0020: ch = 0x40; break;
179 case 0x0021: ch = 0x4F; break;
180 case 0x0022: ch = 0x7F; break;
181 case 0x0023: ch = 0xB1; break;
182 case 0x0024: ch = 0x5B; break;
183 case 0x0025: ch = 0x6C; break;
184 case 0x0026: ch = 0x50; break;
185 case 0x0027: ch = 0x7D; break;
186 case 0x0028: ch = 0x4D; break;
187 case 0x0029: ch = 0x5D; break;
188 case 0x002A: ch = 0x5C; break;
189 case 0x002B: ch = 0x4E; break;
190 case 0x002C: ch = 0x6B; break;
191 case 0x002D: ch = 0x60; break;
192 case 0x002E: ch = 0x4B; break;
193 case 0x002F: ch = 0x61; break;
194 case 0x0030:
195 case 0x0031:
196 case 0x0032:
197 case 0x0033:
198 case 0x0034:
199 case 0x0035:
200 case 0x0036:
201 case 0x0037:
202 case 0x0038:
203 case 0x0039:
204 ch += 0x00C0;
205 break;
206 case 0x003A: ch = 0x7A; break;
207 case 0x003B: ch = 0x5E; break;
208 case 0x003C: ch = 0x4C; break;
209 case 0x003D: ch = 0x7E; break;
210 case 0x003E: ch = 0x6E; break;
211 case 0x003F: ch = 0x6F; break;
212 case 0x0040: ch = 0xB5; break;
213 case 0x0041:
214 case 0x0042:
215 case 0x0043:
216 case 0x0044:
217 case 0x0045:
218 case 0x0046:
219 case 0x0047:
220 case 0x0048:
221 case 0x0049:
222 ch += 0x0080;
223 break;
224 case 0x004A:
225 case 0x004B:
226 case 0x004C:
227 case 0x004D:
228 case 0x004E:
229 case 0x004F:
230 case 0x0050:
231 case 0x0051:
232 case 0x0052:
233 ch += 0x0087;
234 break;
235 case 0x0053:
236 case 0x0054:
237 case 0x0055:
238 case 0x0056:
239 case 0x0057:
240 case 0x0058:
241 case 0x0059:
242 case 0x005A:
243 ch += 0x008F;
244 break;
245 case 0x005B: ch = 0x90; break;
246 case 0x005C: ch = 0x48; break;
247 case 0x005D: ch = 0x51; break;
248 case 0x005E: ch = 0x5F; break;
249 case 0x005F: ch = 0x6D; break;
250 case 0x0060: ch = 0xDD; break;
251 case 0x0061:
252 case 0x0062:
253 case 0x0063:
254 case 0x0064:
255 case 0x0065:
256 case 0x0066:
257 case 0x0067:
258 case 0x0068:
259 case 0x0069:
260 ch += 0x0020;
261 break;
262 case 0x006A:
263 case 0x006B:
264 case 0x006C:
265 case 0x006D:
266 case 0x006E:
267 case 0x006F:
268 case 0x0070:
269 case 0x0071:
270 case 0x0072:
271 ch += 0x0027;
272 break;
273 case 0x0073:
274 case 0x0074:
275 case 0x0075:
276 case 0x0076:
277 case 0x0077:
278 case 0x0078:
279 case 0x0079:
280 case 0x007A:
281 ch += 0x002F;
282 break;
283 case 0x007B: ch = 0x44; break;
284 case 0x007C: ch = 0xBB; break;
285 case 0x007D: ch = 0x54; break;
286 case 0x007E: ch = 0x58; break;
287 case 0x007F: ch = 0x07; break;
288 case 0x0080:
289 case 0x0081:
290 case 0x0082:
291 case 0x0083:
292 case 0x0084:
293 ch -= 0x0060;
294 break;
295 case 0x0085: ch = 0x15; break;
296 case 0x0086: ch = 0x06; break;
297 case 0x0087: ch = 0x17; break;
298 case 0x0088:
299 case 0x0089:
300 case 0x008A:
301 case 0x008B:
302 case 0x008C:
303 ch -= 0x0060;
304 break;
305 case 0x008D: ch = 0x09; break;
306 case 0x008E: ch = 0x0A; break;
307 case 0x008F: ch = 0x1B; break;
308 case 0x0090: ch = 0x30; break;
309 case 0x0091: ch = 0x31; break;
310 case 0x0092: ch = 0x1A; break;
311 case 0x0093:
312 case 0x0094:
313 case 0x0095:
314 case 0x0096:
315 ch -= 0x0060;
316 break;
317 case 0x0097: ch = 0x08; break;
318 case 0x0098:
319 case 0x0099:
320 case 0x009A:
321 case 0x009B:
322 ch -= 0x0060;
323 break;
324 case 0x009C: ch = 0x04; break;
325 case 0x009D: ch = 0x14; break;
326 case 0x009E: ch = 0x3E; break;
327 case 0x009F: ch = 0xFF; break;
328 case 0x00A0: ch = 0x41; break;
329 case 0x00A1: ch = 0xAA; break;
330 case 0x00A2: ch = 0xB0; break;
331 case 0x00A3: ch = 0x7B; break;
332 case 0x00A4: ch = 0x9F; break;
333 case 0x00A5: ch = 0xB2; break;
334 case 0x00A6: ch = 0xCD; break;
335 case 0x00A7: ch = 0x7C; break;
336 case 0x00A8: ch = 0xBD; break;
337 case 0x00A9: ch = 0xB4; break;
338 case 0x00AA: ch = 0x9A; break;
339 case 0x00AB: ch = 0x8A; break;
340 case 0x00AC: ch = 0xBA; break;
341 case 0x00AD: ch = 0xCA; break;
342 case 0x00AE: ch = 0xAF; break;
343 case 0x00AF: ch = 0xBC; break;
344 case 0x00B0: ch = 0x4A; break;
345 case 0x00B1: ch = 0x8F; break;
346 case 0x00B2: ch = 0xEA; break;
347 case 0x00B3: ch = 0xFA; break;
348 case 0x00B4: ch = 0xBE; break;
349 case 0x00B5: ch = 0xA0; break;
350 case 0x00B7: ch = 0xB3; break;
351 case 0x00B8: ch = 0x9D; break;
352 case 0x00B9: ch = 0xDA; break;
353 case 0x00BA: ch = 0x9B; break;
354 case 0x00BB: ch = 0x8B; break;
355 case 0x00BC: ch = 0xB7; break;
356 case 0x00BD: ch = 0xB8; break;
357 case 0x00BE: ch = 0xB9; break;
358 case 0x00BF: ch = 0xAB; break;
359 case 0x00C0: ch = 0x64; break;
360 case 0x00C1: ch = 0x65; break;
361 case 0x00C2: ch = 0x62; break;
362 case 0x00C3: ch = 0x66; break;
363 case 0x00C4: ch = 0x63; break;
364 case 0x00C5: ch = 0x67; break;
365 case 0x00C6: ch = 0x9E; break;
366 case 0x00C7: ch = 0x68; break;
367 case 0x00C8: ch = 0x74; break;
368 case 0x00C9: ch = 0x71; break;
369 case 0x00CA: ch = 0x72; break;
370 case 0x00CB: ch = 0x73; break;
371 case 0x00CC: ch = 0x78; break;
372 case 0x00CD: ch = 0x75; break;
373 case 0x00CE: ch = 0x76; break;
374 case 0x00CF: ch = 0x77; break;
375 case 0x00D0: ch = 0xAC; break;
376 case 0x00D1: ch = 0x69; break;
377 case 0x00D2: ch = 0xED; break;
378 case 0x00D3: ch = 0xEE; break;
379 case 0x00D4: ch = 0xEB; break;
380 case 0x00D5: ch = 0xEF; break;
381 case 0x00D6: ch = 0xEC; break;
382 case 0x00D7: ch = 0xBF; break;
383 case 0x00D8: ch = 0x80; break;
384 case 0x00D9: ch = 0xFD; break;
385 case 0x00DA: ch = 0xFE; break;
386 case 0x00DB: ch = 0xFB; break;
387 case 0x00DC: ch = 0xFC; break;
388 case 0x00DD: ch = 0xAD; break;
389 case 0x00DE: ch = 0xAE; break;
390 case 0x00DF: ch = 0x59; break;
391 case 0x00E0: ch = 0xC0; break;
392 case 0x00E1: ch = 0x45; break;
393 case 0x00E2: ch = 0x42; break;
394 case 0x00E3: ch = 0x46; break;
395 case 0x00E4: ch = 0x43; break;
396 case 0x00E5: ch = 0x47; break;
397 case 0x00E6: ch = 0x9C; break;
398 case 0x00E7: ch = 0xE0; break;
399 case 0x00E8: ch = 0xD0; break;
400 case 0x00E9: ch = 0x5A; break;
401 case 0x00EA: ch = 0x52; break;
402 case 0x00EB: ch = 0x53; break;
403 case 0x00EC: ch = 0xA1; break;
404 case 0x00ED: ch = 0x55; break;
405 case 0x00EE: ch = 0x56; break;
406 case 0x00EF: ch = 0x57; break;
407 case 0x00F0: ch = 0x8C; break;
408 case 0x00F1: ch = 0x49; break;
409 case 0x00F2: ch = 0x6A; break;
410 case 0x00F3: ch = 0xCE; break;
411 case 0x00F4: ch = 0xCB; break;
412 case 0x00F5: ch = 0xCF; break;
413 case 0x00F6: ch = 0xCC; break;
414 case 0x00F7: ch = 0xE1; break;
415 case 0x00F8: ch = 0x70; break;
416 case 0x00F9: ch = 0x79; break;
417 case 0x00FA: ch = 0xDE; break;
418 case 0x00FB: ch = 0xDB; break;
419 case 0x00FC: ch = 0xDC; break;
420 case 0x00FD: ch = 0x8D; break;
421 case 0x00FE: ch = 0x8E; break;
422 case 0x00FF: ch = 0xDF; break;
423 case 0x0110: ch = 0xAC; break;
424 case 0x203E: ch = 0xBC; break;
425 case 0xFF01: ch = 0x4F; break;
426 case 0xFF02: ch = 0x7F; break;
427 case 0xFF03: ch = 0xB1; break;
428 case 0xFF04: ch = 0x5B; break;
429 case 0xFF05: ch = 0x6C; break;
430 case 0xFF06: ch = 0x50; break;
431 case 0xFF07: ch = 0x7D; break;
432 case 0xFF08: ch = 0x4D; break;
433 case 0xFF09: ch = 0x5D; break;
434 case 0xFF0A: ch = 0x5C; break;
435 case 0xFF0B: ch = 0x4E; break;
436 case 0xFF0C: ch = 0x6B; break;
437 case 0xFF0D: ch = 0x60; break;
438 case 0xFF0E: ch = 0x4B; break;
439 case 0xFF0F: ch = 0x61; break;
440 case 0xFF10:
441 case 0xFF11:
442 case 0xFF12:
443 case 0xFF13:
444 case 0xFF14:
445 case 0xFF15:
446 case 0xFF16:
447 case 0xFF17:
448 case 0xFF18:
449 case 0xFF19:
450 ch -= 0xFE20;
451 break;
452 case 0xFF1A: ch = 0x7A; break;
453 case 0xFF1B: ch = 0x5E; break;
454 case 0xFF1C: ch = 0x4C; break;
455 case 0xFF1D: ch = 0x7E; break;
456 case 0xFF1E: ch = 0x6E; break;
457 case 0xFF1F: ch = 0x6F; break;
458 case 0xFF20: ch = 0xB5; break;
459 case 0xFF21:
460 case 0xFF22:
461 case 0xFF23:
462 case 0xFF24:
463 case 0xFF25:
464 case 0xFF26:
465 case 0xFF27:
466 case 0xFF28:
467 case 0xFF29:
468 ch -= 0xFE60;
469 break;
470 case 0xFF2A:
471 case 0xFF2B:
472 case 0xFF2C:
473 case 0xFF2D:
474 case 0xFF2E:
475 case 0xFF2F:
476 case 0xFF30:
477 case 0xFF31:
478 case 0xFF32:
479 ch -= 0xFE59;
480 break;
481 case 0xFF33:
482 case 0xFF34:
483 case 0xFF35:
484 case 0xFF36:
485 case 0xFF37:
486 case 0xFF38:
487 case 0xFF39:
488 case 0xFF3A:
489 ch -= 0xFE51;
490 break;
491 case 0xFF3B: ch = 0x90; break;
492 case 0xFF3C: ch = 0x48; break;
493 case 0xFF3D: ch = 0x51; break;
494 case 0xFF3E: ch = 0x5F; break;
495 case 0xFF3F: ch = 0x6D; break;
496 case 0xFF40: ch = 0xDD; break;
497 case 0xFF41:
498 case 0xFF42:
499 case 0xFF43:
500 case 0xFF44:
501 case 0xFF45:
502 case 0xFF46:
503 case 0xFF47:
504 case 0xFF48:
505 case 0xFF49:
506 ch -= 0xFEC0;
507 break;
508 case 0xFF4A:
509 case 0xFF4B:
510 case 0xFF4C:
511 case 0xFF4D:
512 case 0xFF4E:
513 case 0xFF4F:
514 case 0xFF50:
515 case 0xFF51:
516 case 0xFF52:
517 ch -= 0xFEB9;
518 break;
519 case 0xFF53:
520 case 0xFF54:
521 case 0xFF55:
522 case 0xFF56:
523 case 0xFF57:
524 case 0xFF58:
525 case 0xFF59:
526 case 0xFF5A:
527 ch -= 0xFEB1;
528 break;
529 case 0xFF5B: ch = 0x44; break;
530 case 0xFF5C: ch = 0xBB; break;
531 case 0xFF5D: ch = 0x54; break;
532 case 0xFF5E: ch = 0x58; break;
533 default:
534 HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
535 charIndex++;
536 charCount--;
537 continue;
539 //Write encoded byte to buffer, if buffer is defined and fallback was not used
540 if (bytes != null)
541 bytes[byteIndex] = (byte)ch;
542 byteIndex++;
543 byteCount--;
544 charIndex++;
545 charCount--;
547 return byteIndex;
549 }; // class CP20280
551 [Serializable]
552 public class ENCibm280 : CP20280
554 public ENCibm280() : base() {}
556 }; // class ENCibm280
558 }; // namespace I18N.Rare