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 usr/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 usr/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 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_KICONV_KO_H 27 #define _SYS_KICONV_KO_H 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #ifdef _KERNEL 34 35 /* Valid EUC-KR byte or not. */ 36 #define KICONV_KO_IS_EUCKR_BYTE(b) ((b) >= 0xA1 && (b) <= 0xFE) 37 38 /* Valid UHC byte or not. */ 39 #define KICONV_KO_IS_UHC_1st_BYTE(b) ((b) >= 0x81 && (b) <= 0xFE) 40 #define KICONV_KO_IS_UHC_2nd_BYTE(b) \ 41 ((b) >= 0x41 && (b) <= 0x5A || \ 42 (b) >= 0x61 && (b) <= 0x7A || \ 43 (b) >= 0x81 && (b) <= 0xFE) 44 45 /* UDA range in EUC-KR: row 41 and 94 of KS C 5601-1987. */ 46 #define KICONV_KO_UDA_EUC_SEG1_START (0xC9A1) 47 #define KICONV_KO_UDA_EUC_SEG1_END (0xC9FE) 48 #define KICONV_KO_UDA_EUC_SEG2_START (0xFEA1) 49 #define KICONV_KO_UDA_EUC_SEG2_END (0xFEFE) 50 #define KICONV_KO_UDA_EUC_SEG1 (0xC9) 51 #define KICONV_KO_UDA_EUC_SEG2 (0xFE) 52 #define KICONV_KO_UDA_OFFSET_START (0xA1) 53 #define KICONV_KO_UDA_OFFSET_END (0xFE) 54 #define KICONV_KO_UDA_RANGE (0x5E) /* 0xFE - 0xA1 + 1 */ 55 #define KICONV_KO_UDA_OFFSET_1 (0xF65F) /* 0xF700 - 0xA1 */ 56 #define KICONV_KO_UDA_OFFSET_2 (0xF6BD) /* 0xF65F + 0x5E */ 57 58 /* EUC-KR UDA range in Unicode. */ 59 #define KICONV_KO_UDA_UCS4_START (0xF700) 60 #define KICONV_KO_UDA_UCS4_END (0xF7BB) 61 #define KICONV_KO_UDA_UTF8_START (0xEF9C80) 62 #define KICONV_KO_UDA_UTF8_END (0xEF9EBB) 63 64 /* Whether EUC character is UDC or not. */ 65 #define KICONV_KO_IS_UDC_IN_EUC(v) \ 66 (((v) >= KICONV_KO_UDA_EUC_SEG1_START && \ 67 (v) <= KICONV_KO_UDA_EUC_SEG1_END) || \ 68 ((v) >= KICONV_KO_UDA_EUC_SEG2_START && \ 69 (v) <= KICONV_KO_UDA_EUC_SEG2_END)) 70 71 /* Whether UTF-8 character is UDC or not. */ 72 #define KICONV_KO_IS_UDC_IN_UTF8(v) \ 73 ((v) >= KICONV_KO_UDA_UTF8_START && \ 74 (v) <= KICONV_KO_UDA_UTF8_END) 75 76 #endif /* _KERNEL */ 77 78 #ifdef __cplusplus 79 } 80 #endif 81 82 #endif /* _SYS_KICONV_KO_H */ 83