FLTK 1.4.4

Loading...
Searching...
No Matches
jisx0201.h
1/* $XFree86: xc/lib/X11/lcUniConv/jisx0201.h,v 1.3 2000/11/29 17:40:33 dawes Exp $ */
2
3/*
4 * JISX0201.1976-0
5 */
6#ifdef NEED_TOWC
7
8 static int
9jisx0201_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
10{
11 unsigned char c = *s;
12 if (c < 0x80) {
13 if (c == 0x5c)
14 *pwc = (ucs4_t) 0x00a5;
15 else if (c == 0x7e)
16 *pwc = (ucs4_t) 0x203e;
17 else
18 *pwc = (ucs4_t) c;
19 return 1;
20 } else {
21 if (c >= 0xa1 && c < 0xe0) {
22 *pwc = (ucs4_t) c + 0xfec0;
23 return 1;
24 }
25 }
26 return RET_ILSEQ;
27}
28#endif /* NEED_TOWC */
29
30#ifdef NEED_TOMB
31
32 static int
33jisx0201_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
34{
35 (void)conv; (void)n;
36 if (wc < 0x0080 && !(wc == 0x005c || wc == 0x007e)) {
37 *r = wc;
38 return 1;
39 }
40 if (wc == 0x00a5) {
41 *r = 0x5c;
42 return 1;
43 }
44 if (wc == 0x203e) {
45 *r = 0x7e;
46 return 1;
47 }
48 if (wc >= 0xff61 && wc < 0xffa0) {
49 *r = wc - 0xfec0;
50 return 1;
51 }
52 return RET_ILSEQ;
53}
54#endif /* NEED_TOMB */