xref: /illumos-gate/usr/src/lib/iconv_modules/ko/common/hangulcode.h (revision 3ce5372277f4657ad0e52d36c979527c4ca22de2)
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  * Copyright (c) 1994 by Sun Microsystems, Inc.
23  */
24 
25 
26 
27 #ifndef _HANGULCODE_H_
28 #define	_HANGULCODE_H_
29 
30 
31 typedef struct _kcode_table {
32 	unsigned short	code;
33 	unsigned long	utf8;
34 } kcode_table;
35 
36 /* Cho Sung Count - 1 and Joong Sung Count - 1 */
37 #define	CI_CNT			18
38 #define V_CNT			20
39 
40 /* 0xa1 + 0xff - 0xfe */
41 #define SKIP			0xA2
42 
43 #ifndef BYTE_MASK
44 #define	BYTE_MASK		0xFF
45 #endif	/* BYTE_MASK */
46 
47 #define BIT_MASK		0x01
48 
49 /* FAILED == non-identical character. */
50 #define FAILED			0
51 #define ILLEGAL_SEQ		1
52 #define HANGUL			2
53 #define HANJA_OR_SYMBOL		3
54 
55 #define CHOSUNG(code)		((unsigned short)((code) & 0x7c00) >> 10)
56 #define JOONGSUNG(code)		((unsigned short)((code) & 0x03e0) >> 5)
57 #define JONGSUNG(code)		((code) & 0x001f)
58 
59 #define MAGIC_NUMBER		0x2165
60 
61 #define CVC_FILL		100
62 
63 #define	ESC			0x1B
64 #define SI			0x0F
65 #define SO			0x0E
66 
67 #define MAX_E2U_NUM		5873
68 #define MAX_J922U_NUM		5873
69 #define MAX_U2E_NUM		8223
70 #define MAX_U2ISO2022_NUM	8223
71 #define MAX_U2J92_NUM		8223
72 
73 #define	NON_IDENTICAL		'?'
74 
75 #define	UTF8_NON_ID_CHAR1		0xEF
76 #define	UTF8_NON_ID_CHAR2		0xBF
77 #define	UTF8_NON_ID_CHAR3		0xBD
78 
79 #endif	/* _HANGULCODE_H_ */
80