xref: /titanic_52/usr/src/lib/iconv_modules/common/tab_lookup.h (revision 91e1e26ac6a73ce959289cf7d3d96c4baedbe0b8)
1*91e1e26aSAlexander Pyhalov /*
2*91e1e26aSAlexander Pyhalov  * CDDL HEADER START
3*91e1e26aSAlexander Pyhalov  *
4*91e1e26aSAlexander Pyhalov  * The contents of this file are subject to the terms of the
5*91e1e26aSAlexander Pyhalov  * Common Development and Distribution License (the "License").
6*91e1e26aSAlexander Pyhalov  * You may not use this file except in compliance with the License.
7*91e1e26aSAlexander Pyhalov  *
8*91e1e26aSAlexander Pyhalov  * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
9*91e1e26aSAlexander Pyhalov  * or http://www.opensolaris.org/os/licensing.
10*91e1e26aSAlexander Pyhalov  * See the License for the specific language governing permissions
11*91e1e26aSAlexander Pyhalov  * and limitations under the License.
12*91e1e26aSAlexander Pyhalov  *
13*91e1e26aSAlexander Pyhalov  * When distributing Covered Code, include this CDDL HEADER in each
14*91e1e26aSAlexander Pyhalov  * file and include the License file at src/OPENSOLARIS.LICENSE.
15*91e1e26aSAlexander Pyhalov  * If applicable, add the following below this CDDL HEADER, with the
16*91e1e26aSAlexander Pyhalov  * fields enclosed by brackets "[]" replaced with your own identifying
17*91e1e26aSAlexander Pyhalov  * information: Portions Copyright [yyyy] [name of copyright owner]
18*91e1e26aSAlexander Pyhalov  *
19*91e1e26aSAlexander Pyhalov  * CDDL HEADER END
20*91e1e26aSAlexander Pyhalov  */
21*91e1e26aSAlexander Pyhalov /*
22*91e1e26aSAlexander Pyhalov  * Copyright (c) 1997, by Sun Microsystems, Inc.
23*91e1e26aSAlexander Pyhalov  * All rights reserved.
24*91e1e26aSAlexander Pyhalov  */
25*91e1e26aSAlexander Pyhalov 
26*91e1e26aSAlexander Pyhalov 
27*91e1e26aSAlexander Pyhalov 
28*91e1e26aSAlexander Pyhalov typedef struct	_lookup_table {
29*91e1e26aSAlexander Pyhalov     unsigned long		left_code;
30*91e1e26aSAlexander Pyhalov     unsigned long		right_code;
31*91e1e26aSAlexander Pyhalov } lookup_table;
32*91e1e26aSAlexander Pyhalov 
33*91e1e26aSAlexander Pyhalov typedef enum { SHIFT_OUT=0x0e, SHIFT_IN } SHIFT;
34*91e1e26aSAlexander Pyhalov 
35*91e1e26aSAlexander Pyhalov typedef struct _icv_state {
36*91e1e26aSAlexander Pyhalov     boolean_t	left_to_right;		/* if true the search input characters
37*91e1e26aSAlexander Pyhalov 					 * in the left column
38*91e1e26aSAlexander Pyhalov 					 */
39*91e1e26aSAlexander Pyhalov     boolean_t	right_to_left;		/*
40*91e1e26aSAlexander Pyhalov 					 * if true then search input characters
41*91e1e26aSAlexander Pyhalov 					 *  in the right column
42*91e1e26aSAlexander Pyhalov 					 */
43*91e1e26aSAlexander Pyhalov     lookup_table	*table;		/* mapping table */
44*91e1e26aSAlexander Pyhalov     int		table_size;		/* no of lookup records */
45*91e1e26aSAlexander Pyhalov     int		left_code_size;		/* data size of the left code */
46*91e1e26aSAlexander Pyhalov     int		right_code_size;	/* data size of the right code */
47*91e1e26aSAlexander Pyhalov 
48*91e1e26aSAlexander Pyhalov     char        keepc[6];       /* maximum # byte of UTF8 code */
49*91e1e26aSAlexander Pyhalov     short       ustate;
50*91e1e26aSAlexander Pyhalov     SHIFT	shift;
51*91e1e26aSAlexander Pyhalov     int         _errno;         /* internal errno */
52*91e1e26aSAlexander Pyhalov 
53*91e1e26aSAlexander Pyhalov } _icv_state;
54*91e1e26aSAlexander Pyhalov 
55*91e1e26aSAlexander Pyhalov 
56*91e1e26aSAlexander Pyhalov extern	int	errno;	/* external errno */
57*91e1e26aSAlexander Pyhalov 
58*91e1e26aSAlexander Pyhalov #define		UCS2_NON_ID_CHAR		0xFFFD
59*91e1e26aSAlexander Pyhalov #define		NON_ID_CHAR			0x3F3F /* '??' */
60*91e1e26aSAlexander Pyhalov 
61*91e1e26aSAlexander Pyhalov 
62*91e1e26aSAlexander Pyhalov extern
63*91e1e26aSAlexander Pyhalov size_t
64*91e1e26aSAlexander Pyhalov _icv_iconv_lu(_icv_state *st, unsigned char **ibuf, size_t *inbytesleft,
65*91e1e26aSAlexander Pyhalov                               unsigned char **obuf, size_t *outbytesleft);
66