Lines Matching +full:0 +full:c

2  * _codecs_jp.c: Codecs collection for Japanese encodings
8 #define EMPBASE 0x20000
22 while (inleft > 0) { in ENCODER()
23 Py_UNICODE c = IN1; in ENCODER() local
27 if (c <= 0x80) { in ENCODER()
28 WRITE1((unsigned char)c) in ENCODER()
32 else if (c >= 0xff61 && c <= 0xff9f) { in ENCODER()
33 WRITE1(c - 0xfec0) in ENCODER()
37 else if (c >= 0xf8f0 && c <= 0xf8f3) { in ENCODER()
40 if (c == 0xf8f0) in ENCODER()
41 OUT1(0xa0) in ENCODER()
43 OUT1(c - 0xfef1 + 0xfd) in ENCODER()
48 UCS4INVALID(c) in ENCODER()
51 TRYMAP_ENC(cp932ext, code, c) { in ENCODER()
53 OUT2(code & 0xff) in ENCODER()
55 else TRYMAP_ENC(jisxcommon, code, c) { in ENCODER()
56 if (code & 0x8000) /* MSB set: JIS X 0212 */ in ENCODER()
61 c2 = code & 0xff; in ENCODER()
62 c2 = (((c1 - 0x21) & 1) ? 0x5e : 0) + (c2 - 0x21); in ENCODER()
63 c1 = (c1 - 0x21) >> 1; in ENCODER()
64 OUT1(c1 < 0x1f ? c1 + 0x81 : c1 + 0xc1) in ENCODER()
65 OUT2(c2 < 0x3f ? c2 + 0x40 : c2 + 0x41) in ENCODER()
67 else if (c >= 0xe000 && c < 0xe758) { in ENCODER()
69 c1 = (Py_UNICODE)(c - 0xe000) / 188; in ENCODER()
70 c2 = (Py_UNICODE)(c - 0xe000) % 188; in ENCODER()
71 OUT1(c1 + 0xf0) in ENCODER()
72 OUT2(c2 < 0x3f ? c2 + 0x40 : c2 + 0x41) in ENCODER()
80 return 0; in ENCODER()
85 while (inleft > 0) { in DECODER()
86 unsigned char c = IN1, c2; in DECODER() local
89 if (c <= 0x80) { in DECODER()
90 OUT1(c) in DECODER()
94 else if (c >= 0xa0 && c <= 0xdf) { in DECODER()
95 if (c == 0xa0) in DECODER()
96 OUT1(0xf8f0) /* half-width katakana */ in DECODER()
98 OUT1(0xfec0 + c) in DECODER()
102 else if (c >= 0xfd/* && c <= 0xff*/) { in DECODER()
104 OUT1(0xf8f1 - 0xfd + c) in DECODER()
112 TRYMAP_DEC(cp932ext, **outbuf, c, c2); in DECODER()
113 else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)){ in DECODER()
114 if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) in DECODER()
117 c = (c < 0xe0 ? c - 0x81 : c - 0xc1); in DECODER()
118 c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); in DECODER()
119 c = (2 * c + (c2 < 0x5e ? 0 : 1) + 0x21); in DECODER()
120 c2 = (c2 < 0x5e ? c2 : c2 - 0x5e) + 0x21; in DECODER()
122 TRYMAP_DEC(jisx0208, **outbuf, c, c2); in DECODER()
125 else if (c >= 0xf0 && c <= 0xf9) { in DECODER()
126 if ((c2 >= 0x40 && c2 <= 0x7e) || in DECODER()
127 (c2 >= 0x80 && c2 <= 0xfc)) in DECODER()
128 OUT1(0xe000 + 188 * (c - 0xf0) + in DECODER()
129 (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41)) in DECODER()
139 return 0; in DECODER()
149 while (inleft > 0) { in ENCODER()
150 ucs4_t c = IN1; in ENCODER() local
154 if (c < 0x80) { in ENCODER()
155 WRITE1(c) in ENCODER()
160 DECODE_SURROGATE(c) in ENCODER()
161 insize = GET_INSIZE(c); in ENCODER()
163 if (c <= 0xFFFF) { in ENCODER()
164 EMULATE_JISX0213_2000_ENCODE_BMP(code, c) in ENCODER()
165 else TRYMAP_ENC(jisx0213_bmp, code, c) { in ENCODER()
170 (ucs2_t)c, 0, in ENCODER()
181 (ucs2_t)c, (*inbuf)[1], in ENCODER()
186 (ucs2_t)c, 0, in ENCODER()
196 else TRYMAP_ENC(jisxcommon, code, c); in ENCODER()
197 else if (c >= 0xff61 && c <= 0xff9f) { in ENCODER()
199 WRITE2(0x8e, c - 0xfec0) in ENCODER()
203 else if (c == 0xff3c) in ENCODER()
205 code = 0x2140; in ENCODER()
206 else if (c == 0xff5e) in ENCODER()
208 code = 0x2232; in ENCODER()
212 else if (c >> 16 == EMPBASE >> 16) { in ENCODER()
213 EMULATE_JISX0213_2000_ENCODE_EMP(code, c) in ENCODER()
214 else TRYMAP_ENC(jisx0213_emp, code, c & 0xffff); in ENCODER()
220 if (code & 0x8000) { in ENCODER()
222 WRITE3(0x8f, code >> 8, (code & 0xFF) | 0x80) in ENCODER()
226 WRITE2((code >> 8) | 0x80, (code & 0xFF) | 0x80) in ENCODER()
231 return 0; in ENCODER()
236 while (inleft > 0) { in DECODER()
237 unsigned char c = IN1; in DECODER() local
242 if (c < 0x80) { in DECODER()
243 OUT1(c) in DECODER()
248 if (c == 0x8e) { in DECODER()
254 if (c2 >= 0xa1 && c2 <= 0xdf) { in DECODER()
255 OUT1(0xfec0 + c2) in DECODER()
261 else if (c == 0x8f) { in DECODER()
265 c2 = IN2 ^ 0x80; in DECODER()
266 c3 = IN3 ^ 0x80; in DECODER()
284 c ^= 0x80; in DECODER()
285 c2 = IN2 ^ 0x80; in DECODER()
288 EMULATE_JISX0213_2000_DECODE_PLANE1(**outbuf, c, c2) in DECODER()
289 else if (c == 0x21 && c2 == 0x40) **outbuf = 0xff3c; in DECODER()
290 else if (c == 0x22 && c2 == 0x32) **outbuf = 0xff5e; in DECODER()
291 else TRYMAP_DEC(jisx0208, **outbuf, c, c2); in DECODER()
292 else TRYMAP_DEC(jisx0213_1_bmp, **outbuf, c, c2); in DECODER()
293 else TRYMAP_DEC(jisx0213_1_emp, code, c, c2) { in DECODER()
298 else TRYMAP_DEC(jisx0213_pair, code, c, c2) { in DECODER()
299 WRITE2(code >> 16, code & 0xffff) in DECODER()
308 return 0; in DECODER()
318 while (inleft > 0) { in ENCODER()
319 Py_UNICODE c = IN1; in ENCODER() local
322 if (c < 0x80) { in ENCODER()
323 WRITE1((unsigned char)c) in ENCODER()
328 UCS4INVALID(c) in ENCODER()
330 TRYMAP_ENC(jisxcommon, code, c); in ENCODER()
331 else if (c >= 0xff61 && c <= 0xff9f) { in ENCODER()
333 WRITE2(0x8e, c - 0xfec0) in ENCODER()
338 else if (c == 0xff3c) /* FULL-WIDTH REVERSE SOLIDUS */ in ENCODER()
339 code = 0x2140; in ENCODER()
340 else if (c == 0xa5) { /* YEN SIGN */ in ENCODER()
341 WRITE1(0x5c); in ENCODER()
344 } else if (c == 0x203e) { /* OVERLINE */ in ENCODER()
345 WRITE1(0x7e); in ENCODER()
353 if (code & 0x8000) { in ENCODER()
355 WRITE3(0x8f, code >> 8, (code & 0xFF) | 0x80) in ENCODER()
359 WRITE2((code >> 8) | 0x80, (code & 0xFF) | 0x80) in ENCODER()
364 return 0; in ENCODER()
369 while (inleft > 0) { in DECODER()
370 unsigned char c = IN1; in DECODER() local
374 if (c < 0x80) { in DECODER()
375 OUT1(c) in DECODER()
380 if (c == 0x8e) { in DECODER()
386 if (c2 >= 0xa1 && c2 <= 0xdf) { in DECODER()
387 OUT1(0xfec0 + c2) in DECODER()
393 else if (c == 0x8f) { in DECODER()
400 TRYMAP_DEC(jisx0212, **outbuf, c2 ^ 0x80, c3 ^ 0x80) { in DECODER()
413 if (c == 0xa1 && c2 == 0xc0) in DECODER()
415 **outbuf = 0xff3c; in DECODER()
419 c ^ 0x80, c2 ^ 0x80) ; in DECODER()
425 return 0; in DECODER()
435 while (inleft > 0) { in ENCODER()
436 Py_UNICODE c = IN1; in ENCODER() local
441 JISX0201_R_ENCODE(c, code) in ENCODER()
443 if (c < 0x80) code = c; in ENCODER()
444 else if (c == 0x00a5) code = 0x5c; /* YEN SIGN */ in ENCODER()
445 else if (c == 0x203e) code = 0x7e; /* OVERLINE */ in ENCODER()
447 else JISX0201_K_ENCODE(c, code) in ENCODER()
448 else UCS4INVALID(c) in ENCODER()
451 if (code < 0x80 || (code >= 0xa1 && code <= 0xdf)) { in ENCODER()
462 TRYMAP_ENC(jisxcommon, code, c); in ENCODER()
464 else if (c == 0xff3c) in ENCODER()
465 code = 0x2140; /* FULL-WIDTH REVERSE SOLIDUS */ in ENCODER()
470 if (code & 0x8000) /* MSB set: JIS X 0212 */ in ENCODER()
475 c2 = code & 0xff; in ENCODER()
476 c2 = (((c1 - 0x21) & 1) ? 0x5e : 0) + (c2 - 0x21); in ENCODER()
477 c1 = (c1 - 0x21) >> 1; in ENCODER()
478 OUT1(c1 < 0x1f ? c1 + 0x81 : c1 + 0xc1) in ENCODER()
479 OUT2(c2 < 0x3f ? c2 + 0x40 : c2 + 0x41) in ENCODER()
483 return 0; in ENCODER()
488 while (inleft > 0) { in DECODER()
489 unsigned char c = IN1; in DECODER() local
494 JISX0201_R_DECODE(c, **outbuf) in DECODER()
496 if (c < 0x80) **outbuf = c; in DECODER()
498 else JISX0201_K_DECODE(c, **outbuf) in DECODER()
499 else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)){ in DECODER()
504 if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) in DECODER()
507 c1 = (c < 0xe0 ? c - 0x81 : c - 0xc1); in DECODER()
508 c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); in DECODER()
509 c1 = (2 * c1 + (c2 < 0x5e ? 0 : 1) + 0x21); in DECODER()
510 c2 = (c2 < 0x5e ? c2 : c2 - 0x5e) + 0x21; in DECODER()
513 if (c1 == 0x21 && c2 == 0x40) { in DECODER()
515 OUT1(0xff3c) in DECODER()
533 return 0; in DECODER()
543 while (inleft > 0) { in ENCODER()
544 ucs4_t c = IN1; in ENCODER() local
549 JISX0201_ENCODE(c, code) in ENCODER()
550 else DECODE_SURROGATE(c) in ENCODER()
552 if (code < 0x80 || (code >= 0xa1 && code <= 0xdf)) { in ENCODER()
559 insize = GET_INSIZE(c); in ENCODER()
562 if (c <= 0xffff) { in ENCODER()
563 EMULATE_JISX0213_2000_ENCODE_BMP(code, c) in ENCODER()
564 else TRYMAP_ENC(jisx0213_bmp, code, c) { in ENCODER()
569 ((ucs2_t)c, 0, in ENCODER()
580 (ucs2_t)c, IN2, in ENCODER()
585 (ucs2_t)c, 0, in ENCODER()
596 else TRYMAP_ENC(jisxcommon, code, c) { in ENCODER()
598 if (code & 0x8000) in ENCODER()
603 else if (c >> 16 == EMPBASE >> 16) { in ENCODER()
604 EMULATE_JISX0213_2000_ENCODE_EMP(code, c) in ENCODER()
605 else TRYMAP_ENC(jisx0213_emp, code, c&0xffff); in ENCODER()
613 c2 = (code & 0xff) - 0x21; in ENCODER()
615 if (c1 & 0x80) { /* Plane 2 */ in ENCODER()
616 if (c1 >= 0xee) c1 -= 0x87; in ENCODER()
617 else if (c1 >= 0xac || c1 == 0xa8) c1 -= 0x49; in ENCODER()
618 else c1 -= 0x43; in ENCODER()
621 c1 -= 0x21; in ENCODER()
623 if (c1 & 1) c2 += 0x5e; in ENCODER()
625 OUT1(c1 + (c1 < 0x1f ? 0x81 : 0xc1)) in ENCODER()
626 OUT2(c2 + (c2 < 0x3f ? 0x40 : 0x41)) in ENCODER()
631 return 0; in ENCODER()
636 while (inleft > 0) { in DECODER()
637 unsigned char c = IN1; in DECODER() local
640 JISX0201_DECODE(c, **outbuf) in DECODER()
641 else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)){ in DECODER()
647 if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) in DECODER()
650 c1 = (c < 0xe0 ? c - 0x81 : c - 0xc1); in DECODER()
651 c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); in DECODER()
652 c1 = (2 * c1 + (c2 < 0x5e ? 0 : 1)); in DECODER()
653 c2 = (c2 < 0x5e ? c2 : c2 - 0x5e) + 0x21; in DECODER()
655 if (c1 < 0x5e) { /* Plane 1 */ in DECODER()
656 c1 += 0x21; in DECODER()
670 WRITE2(code >> 16, code & 0xffff) in DECODER()
678 if (c1 >= 0x67) c1 += 0x07; in DECODER()
679 else if (c1 >= 0x63 || c1 == 0x5f) c1 -= 0x37; in DECODER()
680 else c1 -= 0x3d; in DECODER()
703 return 0; in DECODER()