1 #define JISX0201_R_ENCODE(c, assi) \ 2 if ((c) < 0x80 && (c) != 0x5c && (c) != 0x7e) { \ 3 (assi) = (c); \ 4 } \ 5 else if ((c) == 0x00a5) { \ 6 (assi) = 0x5c; \ 7 } \ 8 else if ((c) == 0x203e) { \ 9 (assi) = 0x7e; \ 10 } 11 12 #define JISX0201_K_ENCODE(c, assi) \ 13 if ((c) >= 0xff61 && (c) <= 0xff9f) { \ 14 (assi) = (c) - 0xfec0; \ 15 } 16 17 #define JISX0201_ENCODE(c, assi) \ 18 JISX0201_R_ENCODE(c, assi) \ 19 else JISX0201_K_ENCODE(c, assi) 20 21 #define JISX0201_R_DECODE_CHAR(c, assi) \ 22 if ((c) < 0x5c) { \ 23 (assi) = (c); \ 24 } \ 25 else if ((c) == 0x5c) { \ 26 (assi) = 0x00a5; \ 27 } \ 28 else if ((c) < 0x7e) { \ 29 (assi) = (c); \ 30 } \ 31 else if ((c) == 0x7e) { \ 32 (assi) = 0x203e; \ 33 } \ 34 else if ((c) == 0x7f) { \ 35 (assi) = 0x7f; \ 36 } 37 38 #define JISX0201_R_DECODE(c, writer) \ 39 if ((c) < 0x5c) { \ 40 OUTCHAR(c); \ 41 } \ 42 else if ((c) == 0x5c) { \ 43 OUTCHAR(0x00a5); \ 44 } \ 45 else if ((c) < 0x7e) { \ 46 OUTCHAR(c); \ 47 } \ 48 else if ((c) == 0x7e) { \ 49 OUTCHAR(0x203e); \ 50 } \ 51 else if ((c) == 0x7f) { \ 52 OUTCHAR(0x7f); \ 53 } 54 55 #define JISX0201_K_DECODE(c, writer) \ 56 if ((c) >= 0xa1 && (c) <= 0xdf) { \ 57 OUTCHAR(0xfec0 + (c)); \ 58 } 59 #define JISX0201_K_DECODE_CHAR(c, assi) \ 60 if ((c) >= 0xa1 && (c) <= 0xdf) { \ 61 (assi) = 0xfec0 + (c); \ 62 } 63 #define JISX0201_DECODE(c, writer) \ 64 JISX0201_R_DECODE(c, writer) \ 65 else JISX0201_K_DECODE(c, writer) 66