xref: /illumos-gate/usr/src/lib/iconv_modules/common/tab_lookup.h (revision 8459c777fc1aaabb2f7dad05de1313aa169417cd)
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) 1997, by Sun Microsystems, Inc.
23  * All rights reserved.
24  */
25 
26 
27 
28 typedef struct	_lookup_table {
29     unsigned long		left_code;
30     unsigned long		right_code;
31 } lookup_table;
32 
33 typedef enum { SHIFT_OUT=0x0e, SHIFT_IN } SHIFT;
34 
35 typedef struct _icv_state {
36     boolean_t	left_to_right;		/* if true the search input characters
37 					 * in the left column
38 					 */
39     boolean_t	right_to_left;		/*
40 					 * if true then search input characters
41 					 *  in the right column
42 					 */
43     lookup_table	*table;		/* mapping table */
44     int		table_size;		/* no of lookup records */
45     int		left_code_size;		/* data size of the left code */
46     int		right_code_size;	/* data size of the right code */
47 
48     char        keepc[6];       /* maximum # byte of UTF8 code */
49     short       ustate;
50     SHIFT	shift;
51     int         _errno;         /* internal errno */
52 
53 } _icv_state;
54 
55 
56 extern	int	errno;	/* external errno */
57 
58 #define		UCS2_NON_ID_CHAR		0xFFFD
59 #define		NON_ID_CHAR			0x3F3F /* '??' */
60 
61 
62 extern
63 size_t
64 _icv_iconv_lu(_icv_state *st, unsigned char **ibuf, size_t *inbytesleft,
65                               unsigned char **obuf, size_t *outbytesleft);
66