1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /* Definition for hangul character macro added */
28 
29 #define	_K1	01		/* First byte of Completion code */
30 #define _K2	02		/* Second byte of Completion code */
31 
32 /* #define	_HA	04*/		/* Hangul alphabet */
33 
34 #define _GR	04 		/* First byte of Non-Hangeul/Hanja Characters */
35 #define _HN	010		/* First byte of Hangeul Characters */
36 #define _HJ	020		/* First byte of Hanja Characters */
37 #define _HU	040 		/* First byte of User-Definable Characters */
38 #define _HR	0100		/* Fisrt byte of Reserved for Future Assignment */
39 
40 static char	_hctype_[] = { 0,
41 
42 /*	0/4		1/5		2/6		3/7	*/
43 
44 /*00*/	0,		0,		0,		0,
45 	0,		0,		0,		0,
46 	0,		0,		0,		0,
47 	0,		0,		0,		0,
48 /*10*/	0,		0,		0,		0,
49 	0,		0,		0,		0,
50 	0,		0,		0,		0,
51 	0,		0,		0,		0,
52 /*20*/	0,		0,		0,		0,
53 	0,		0,		0,		0,
54 	0,		0,		0,		0,
55 	0,		0,		0,		0,
56 /*30*/	0,		0,		0,		0,
57 	0,		0,		0,		0,
58 	0,		0,		0,		0,
59 	0,		0,		0,		0,
60 /*40*/	0,		0,		0,		0,
61 	0,		0,		0,		0,
62 	0,		0,		0,		0,
63 	0,		0,		0,		0,
64 /*50*/	0,		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	_K2|_K1|_HJ,	_K2|_K1|_HJ,
97 	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
98 	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
99 	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
100 /*E0*/	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
101 	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
102 	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
103 	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
104 /*F0*/	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
105 	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
106 	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HJ,
107 	_K2|_K1|_HJ,	_K2|_K1|_HJ,	_K2|_K1|_HU,	0,
108 };
109 
110 
111 #define	iskorea1(c)	((_hctype_+1)[(unsigned char)(c)]&_K1)
112 #define	iskorea2(c)	((_hctype_+1)[(unsigned char)(c)]&_K2)
113 
114 #define ishangraph(c)	((_hctype_+1)[(unsigned char)(c)]&_GR)
115 #define	ishangul(c)	((_hctype_+1)[(unsigned char)(c)]&_HN)
116 #define ishanja(c)	((_hctype_+1)[(unsigned char)(c)]&_HJ)
117 #define ishanusr(c)	((_hctype_+1)[(unsigned char)(c)]&_HU)
118 #define ishreserve(c)	((_hctype_+1)[(unsigned char)(c)]&_HR)
119 /*
120 #define ishanalpha(c)	((_hctype_+1)[(unsigned char)(c)]&_HA)
121 */
122 #define KCT_ASCII	0x00
123 #define KCT_KOREA1	0x01
124 #define KCT_KOREA2	0x02
125 #define KCT_HANGUL1	0x04
126 #define KCT_HANGUL2	0x08
127 #define KCT_HANJA1	0x10
128 #define KCT_HANJA2	0x20
129 #define KCT_ILLGL	0x40
130