File: alg_jisx0201.h

package info (click to toggle)
python2.7 2.7.3-6%2Bdeb7u2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 71,112 kB
  • sloc: ansic: 424,479; python: 416,704; sh: 12,085; asm: 10,846; makefile: 4,201; objc: 775; exp: 416; cpp: 207; xml: 73
file content (24 lines) | stat: -rw-r--r-- 1,201 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#define JISX0201_R_ENCODE(c, assi)                      \
    if ((c) < 0x80 && (c) != 0x5c && (c) != 0x7e)       \
        (assi) = (c);                                   \
    else if ((c) == 0x00a5) (assi) = 0x5c;              \
    else if ((c) == 0x203e) (assi) = 0x7e;
#define JISX0201_K_ENCODE(c, assi)                      \
    if ((c) >= 0xff61 && (c) <= 0xff9f)                 \
        (assi) = (c) - 0xfec0;
#define JISX0201_ENCODE(c, assi)                        \
    JISX0201_R_ENCODE(c, assi)                          \
    else JISX0201_K_ENCODE(c, assi)

#define JISX0201_R_DECODE(c, assi)                      \
    if ((c) < 0x5c) (assi) = (c);                       \
    else if ((c) == 0x5c) (assi) = 0x00a5;              \
    else if ((c) < 0x7e) (assi) = (c);                  \
    else if ((c) == 0x7e) (assi) = 0x203e;              \
    else if ((c) == 0x7f) (assi) = 0x7f;
#define JISX0201_K_DECODE(c, assi)                      \
    if ((c) >= 0xa1 && (c) <= 0xdf)                     \
    (assi) = 0xfec0 + (c);
#define JISX0201_DECODE(c, assi)                        \
    JISX0201_R_DECODE(c, assi)                          \
    else JISX0201_K_DECODE(c, assi)