FLTK 1.3.8: jisx0201.h Source File

FLTK 1.3.8

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
8static 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
32static int
33jisx0201_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
34{
35 if (wc < 0x0080 && !(wc == 0x005c || wc == 0x007e)) {
36 *r = wc;
37 return 1;
38 }
39 if (wc == 0x00a5) {
40 *r = 0x5c;
41 return 1;
42 }
43 if (wc == 0x203e) {
44 *r = 0x7e;
45 return 1;
46 }
47 if (wc >= 0xff61 && wc < 0xffa0) {
48 *r = wc - 0xfec0;
49 return 1;
50 }
51 return RET_ILSEQ;
52}
53#endif /* NEED_TOMB */
- Copyright © 1998-2021 by Bill Spitzak and others.