/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
#include <sys/byteorder.h>
#include <sys/u8_textprep.h>
#include <sys/kiconv_cck_common.h>
#include <sys/kiconv_ko.h>
#include <sys/kiconv_uhc_utf8.h>
#include <sys/kiconv_utf8_uhc.h>
#include <sys/kiconv_euckr_utf8.h>
#include <sys/kiconv_utf8_euckr.h>
static void *
{
return ((void *)KICONV_KO_EUCKR);
}
static void *
{
return ((void *)KICONV_KO_UHC);
}
static int
close_fr_ko(void *s)
{
if ((uintptr_t)s > KICONV_KO_MAX_MAGIC_ID)
return (EBADF);
return (0);
}
/*
* Encoding convertor from EUC-KR to UTF-8.
*/
static size_t
{
/* Check on the kiconv code conversion descriptor. */
return ((size_t)-1);
}
/* If this is a state reset request, process and return. */
return (0);
}
ret_val = 0;
if (KICONV_IS_ASCII(*ib)) {
}
continue;
}
/*
* Issue EILSEQ error if the first byte is not a
* valid EUC-KR leading byte.
*/
if (! KICONV_KO_IS_EUCKR_BYTE(*ib)) {
}
/*
* Issue EINVAL error if input buffer has an incomplete
* character at the end of the buffer.
*/
}
/*
* Issue EILSEQ error if the remaining byte is not
* a valid EUC-KR byte.
*/
}
if (sz < 0) {
}
ib += 2;
}
return (ret_val);
}
/*
* String based encoding convertor from EUC-KR to UTF-8.
*/
static size_t
{
ret_val = 0;
break;
if (KICONV_IS_ASCII(*ib)) {
}
continue;
}
if (! KICONV_KO_IS_EUCKR_BYTE(*ib)) {
}
}
}
if (sz < 0) {
}
continue;
}
ret_val++;
}
return (ret_val);
}
/*
* Encoding convertor from Unified Hangul Code to UTF-8.
*/
static size_t
{
/* Check on the kiconv code conversion descriptor. */
return ((size_t)-1);
}
/* If this is a state reset request, process and return. */
return (0);
}
ret_val = 0;
if (KICONV_IS_ASCII(*ib)) {
}
continue;
}
/*
* Issue EILSEQ error if the first byte is not a
* valid UHC leading byte.
*/
if (! KICONV_KO_IS_UHC_1st_BYTE(*ib)) {
}
/*
* Issue EINVAL error if input buffer has an incomplete
* character at the end of the buffer.
*/
}
/*
* Issue EILSEQ error if the remaining byte is not
* a valid UHC byte.
*/
}
if (sz < 0) {
}
ib += 2;
}
return (ret_val);
}
/*
* String based encoding convertor from Unified Hangul Code to UTF-8.
*/
static size_t
{
ret_val = 0;
break;
if (KICONV_IS_ASCII(*ib)) {
}
continue;
}
if (! KICONV_KO_IS_UHC_1st_BYTE(*ib)) {
}
}
}
if (sz < 0) {
}
continue;
}
ret_val++;
}
return (ret_val);
}
/*
* Encoding convertor from UTF-8 to EUC-KR.
*/
static size_t
{
}
/*
* Encoding convertor from UTF-8 to Unified Hangul Code.
*/
static size_t
{
}
/*
* String based encoding convertor from UTF-8 to EUC-KR.
*/
static size_t
{
}
/*
* String based encoding convertor from UTF-8 to Unified Hangul Code.
*/
static size_t
{
}
/*
* Convert an UTF-8 character to a character of ko encodings
* (EUC-KR or UHC).
*/
static int8_t
{
if (KICONV_KO_IS_UDC_IN_UTF8(utf8)) {
/* User Definable Area handing. */
if (kocode < KICONV_KO_UDA_RANGE) {
} else {
/* 0x43 = 0xA1 - 0x5E */
(kocode + 0x43);
}
index = 1;
} else {
}
return (-1);
}
if (index == 0)
(*ret_val)++;
if (kolen > 1)
return (kolen);
}
/*
* Convert an UTF-8 character to Unified Hangual Code.
*/
/* ARGSUSED */
static int8_t
{
}
/*
* Convert an UTF-8 character to EUC-KR.
*/
/* ARGSUSED */
static int8_t
{
}
/*
* Convert a single ko encoding (EUC-KR or UHC) character to UTF-8.
*/
static int8_t
{
if (KICONV_KO_IS_UDC_IN_EUC(ko_val)) {
/* UDA(User Definable Area) handling. */
udc[0] = 0xEF;
index = 1;
} else {
}
return (-1);
}
if (index == 0)
(*ret_val)++; /* Non-identical conversion */
return (sz);
}
{
},
{
},
{
},
{
}
};
"kiconv_ko", /* module name */
sizeof (kiconv_ko_ops_tbl) / sizeof (kiconv_ko_ops_tbl[0]),
0,
NULL,
NULL,
0
};
"kiconv korean module 1.0",
};
(void *)&modlkiconv_ko,
};
int
_init(void)
{
int err;
if (err)
return (err);
}
int
_fini(void)
{
int err;
/*
* If this module is being used, then, we cannot remove the module.
* The following checking will catch pretty much all usual cases.
*
* Any remaining will be catached by the kiconv_unregister_module()
* during mod_remove() at below.
*/
return (EBUSY);
if (err)
return (err);
}
int
{
}