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