1*6008Syy154373 /* 2*6008Syy154373 * CDDL HEADER START 3*6008Syy154373 * 4*6008Syy154373 * The contents of this file are subject to the terms of the 5*6008Syy154373 * Common Development and Distribution License (the "License"). 6*6008Syy154373 * You may not use this file except in compliance with the License. 7*6008Syy154373 * 8*6008Syy154373 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*6008Syy154373 * or http://www.opensolaris.org/os/licensing. 10*6008Syy154373 * See the License for the specific language governing permissions 11*6008Syy154373 * and limitations under the License. 12*6008Syy154373 * 13*6008Syy154373 * When distributing Covered Code, include this CDDL HEADER in each 14*6008Syy154373 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*6008Syy154373 * If applicable, add the following below this CDDL HEADER, with the 16*6008Syy154373 * fields enclosed by brackets "[]" replaced with your own identifying 17*6008Syy154373 * information: Portions Copyright [yyyy] [name of copyright owner] 18*6008Syy154373 * 19*6008Syy154373 * CDDL HEADER END 20*6008Syy154373 */ 21*6008Syy154373 /* 22*6008Syy154373 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*6008Syy154373 * Use is subject to license terms. 24*6008Syy154373 */ 25*6008Syy154373 26*6008Syy154373 #ifndef _SYS_KICONV_TC_H 27*6008Syy154373 #define _SYS_KICONV_TC_H 28*6008Syy154373 29*6008Syy154373 #pragma ident "%Z%%M% %I% %E% SMI" 30*6008Syy154373 31*6008Syy154373 #ifdef __cplusplus 32*6008Syy154373 extern "C" { 33*6008Syy154373 #endif 34*6008Syy154373 35*6008Syy154373 #ifdef _KERNEL 36*6008Syy154373 37*6008Syy154373 /* Valid first BIG5 byte or not. */ 38*6008Syy154373 #define KICONV_TC_IS_BIG5_1st_BYTE(v) ((v) >= 0x81 && (v) <= 0xFE) 39*6008Syy154373 40*6008Syy154373 /* Valid second BIG5 byte or not. */ 41*6008Syy154373 #define KICONV_TC_IS_BIG5_2nd_BYTE(v) \ 42*6008Syy154373 (((v) >= 0x40 && (v) <= 0x7E) || ((v) >= 0xA1 && (v) <= 0xFE)) 43*6008Syy154373 44*6008Syy154373 /* Start byte of CNS 11643 plane 2 - plane 16. */ 45*6008Syy154373 #define KICONV_TC_EUCTW_MBYTE (0x8E) 46*6008Syy154373 47*6008Syy154373 /* Plane number mask of CNS 11643 */ 48*6008Syy154373 #define KICONV_TC_EUCTW_PMASK (0xA0) 49*6008Syy154373 50*6008Syy154373 /* Valid first byte of CNS 11643 1-16 plane character or not. */ 51*6008Syy154373 #define KICONV_TC_IS_EUCTW_1st_BYTE(v) \ 52*6008Syy154373 ((v) == KICONV_TC_EUCTW_MBYTE || KICONV_IS_VALID_EUC_BYTE(v)) 53*6008Syy154373 54*6008Syy154373 /* Valid EUC-TW sequence or not. */ 55*6008Syy154373 #define KICONV_TC_IS_VALID_EUCTW_SEQ(ib) \ 56*6008Syy154373 ((isplane1 && (KICONV_IS_VALID_EUC_BYTE(*((ib) + 1)))) || \ 57*6008Syy154373 (plane_no <= 16 && plane_no >= 2 && \ 58*6008Syy154373 KICONV_IS_VALID_EUC_BYTE(*((ib) + 2)) && \ 59*6008Syy154373 KICONV_IS_VALID_EUC_BYTE(*((ib) + 3)))) 60*6008Syy154373 61*6008Syy154373 /* 62*6008Syy154373 * Plane 12/13/14/16 of EUC-TW fall in UDA range [U+F0000, U+F8A0F] in 63*6008Syy154373 * Unicode. 64*6008Syy154373 */ 65*6008Syy154373 #define KICONV_TC_UDA_UCS4_START (0xF0000) 66*6008Syy154373 #define KICONV_TC_UDA_UTF8_START (0xF3B08080) 67*6008Syy154373 #define KICONV_TC_UDA_UTF8_END (0xF3B8A88F) 68*6008Syy154373 69*6008Syy154373 #endif /* _KERNEL */ 70*6008Syy154373 71*6008Syy154373 #ifdef __cplusplus 72*6008Syy154373 } 73*6008Syy154373 #endif 74*6008Syy154373 75*6008Syy154373 #endif /* _SYS_KICONV_TC_H */ 76