summaryrefslogtreecommitdiffstats
path: root/newlib/libc/iconv/ces/utf-16.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2004-06-25 20:33:28 +0000
committerJeff Johnston <jjohnstn@redhat.com>2004-06-25 20:33:28 +0000
commit660dade387b1e24665ea8826417b096df2f25e83 (patch)
tree611b5d25b92b226523a09d99f6dd4514acab5422 /newlib/libc/iconv/ces/utf-16.c
parent6778dc3f1a5e444c281bf39a3f199abde00478bd (diff)
downloadcygnal-660dade387b1e24665ea8826417b096df2f25e83.tar.gz
cygnal-660dade387b1e24665ea8826417b096df2f25e83.tar.bz2
cygnal-660dade387b1e24665ea8826417b096df2f25e83.zip
2004-06-25 Artem B. Bityuckiy <dedekind@oktetlabs.ru>
* acinclude.m4: Move iconv options into configure.in. * aclocal.m4: Regenerated. * configure: Ditto. * configure.in: Add iconv options. * newlib.hin: Add new iconv encodings and remove deleted ones. * doc/aclocal.m4: Regenerated. * doc/configure: Ditto. * iconvdata/aclocal.m4: Ditto. * iconvdata/configure: Ditto. * libc/iconv: Design change. New size-optimized ccs format. * libc/iconv/AUTHORS: Removed. * libc/iconv/COPYING: Ditto. * libc/iconv/README.ORIGINAL: Ditto. * libc/iconv/README.TODO: Ditto. * libc/iconv/charset.aliases: Ditto. * libc/iconv/encoding.aliases: New file. * libc/iconv/Makefile.am: Updated. * libc/iconv/Makefile.in: Regenerated. * libc/iconv/iconv.tex: Updated. * libc/iconv/ccs/Makefile.am: Ditto. * libc/iconv/ccs/Makefile.in: Regenerated. * libc/iconv/ccs/big5.c: Updated. * libc/iconv/ccs/cns11643_plane1.c: Ditto. * libc/iconv/ccs/cns11643_plane14.c: Ditto. * libc/iconv/ccs/cns11643_plane2.c: Ditto. * libc/iconv/ccs/cp775.c: Ditto. * libc/iconv/ccs/cp850.c: Ditto. * libc/iconv/ccs/cp852.c: Ditto. * libc/iconv/ccs/cp855.c: Ditto. * libc/iconv/ccs/cp866.c: Ditto. * libc/iconv/ccs/iso_8859_1.c: Ditto. * libc/iconv/ccs/README.CCS.SOURCES: Removed. * libc/iconv/ccs/gb_2312_80.c: Ditto. * libc/iconv/ccs/iconv_mktbl: Ditto. * libc/iconv/ccs/jis_x0201.c: Ditto. * libc/iconv/ccs/jis_x0208_1983.c: Ditto. * libc/iconv/ccs/shift_jis.c: Ditto. * libc/iconv/ccs/us_ascii.c: Ditto. * libc/iconv/ccs/ccs.h: New file. * libc/iconv/ccs/ccsbi.c: Ditto. * libc/iconv/ccs/ccsbi.h: Ditto. * libc/iconv/ccs/ccsnames.h: Ditto. * libc/iconv/ccs/iso_8859_10.c: Ditto. * libc/iconv/ccs/iso_8859_11.c: Ditto. * libc/iconv/ccs/iso_8859_13.c: Ditto. * libc/iconv/ccs/iso_8859_14.c: Ditto. * libc/iconv/ccs/iso_8859_3.c: Ditto. * libc/iconv/ccs/iso_8859_6.c: Ditto. * libc/iconv/ccs/iso_8859_7.c: Ditto. * libc/iconv/ccs/iso_8859_8.c: Ditto. * libc/iconv/ccs/iso_8859_9.c: Ditto. * libc/iconv/ccs/iso_ir_111.c: Ditto. * libc/iconv/ccs/jis_x0201_1976.c: Ditto. * libc/iconv/ccs/jis_x0208_1990.c: Ditto. * libc/iconv/ccs/koi8_ru.c: Ditto. * libc/iconv/ccs/koi8_uni.c: Ditto. * libc/iconv/ccs/mktbl.pl: Ditto. * libc/iconv/ccs/win_1250.c: Ditto. * libc/iconv/ccs/win_1251.c: Ditto. * libc/iconv/ccs/win_1252.c: Ditto. * libc/iconv/ccs/win_1253.c: Ditto. * libc/iconv/ccs/win_1254.c: Ditto. * libc/iconv/ccs/win_1255.c: Ditto. * libc/iconv/ccs/win_1256.c: Ditto. * libc/iconv/ccs/win_1257.c: Ditto. * libc/iconv/ccs/win_1258.c: Ditto. * libc/iconv/ccs/iso_8859_15.c * libc/iconv/ccs/iso_8859_2.c * libc/iconv/ccs/iso_8859_4.c * libc/iconv/ccs/iso_8859_5.c * libc/iconv/ccs/jis_x0212_1990.c * libc/iconv/ccs/koi8_r.c * libc/iconv/ccs/koi8_u.c * libc/iconv/ccs/ksx1001.c * libc/iconv/ccs/binary/gb_2312_80.cct: Removed. * libc/iconv/ccs/binary/jis_x0201.cct: Ditto. * libc/iconv/ccs/binary/shift_jis.cct: Ditto. * libc/iconv/ccs/binary/us_ascii.cct: Ditto. * libc/iconv/ccs/binary/jis_x0208_1983.cct: Ditto. * libc/iconv/ccs/binary/Makefile.am: Updated. * libc/iconv/ccs/binary/Makefile.in: Regenerated. * libc/iconv/ccs/binary/big5.cct: Updated. * libc/iconv/ccs/binary/cns11643_plane1.cct: Ditto. * libc/iconv/ccs/binary/cns11643_plane14.cct: Ditto. * libc/iconv/ccs/binary/cns11643_plane2.cct: Ditto. * libc/iconv/ccs/binary/cp775.cct: Updated.: Ditto. * libc/iconv/ccs/binary/cp850.cct: Ditto.: Ditto. * libc/iconv/ccs/binary/cp852.cct: Ditto.: Ditto. * libc/iconv/ccs/binary/cp855.cct: Ditto.: Ditto. * libc/iconv/ccs/binary/cp866.cct: Ditto.: Ditto. * libc/iconv/ccs/binary/iso_8859_1.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_15.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_4.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_5.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_2.cct: Ditto. * libc/iconv/ccs/binary/jis_x0212_1990.cct: Ditto. * libc/iconv/ccs/binary/koi8_r.cct: Ditto. * libc/iconv/ccs/binary/koi8_u.cct: Ditto. * libc/iconv/ccs/binary/ksx1001.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_10.cct: New file. * libc/iconv/ccs/binary/iso_8859_11.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_13.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_14.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_3.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_6.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_7.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_8.cct: Ditto. * libc/iconv/ccs/binary/iso_8859_9.cct: Ditto. * libc/iconv/ccs/binary/iso_ir_111.cct: Ditto. * libc/iconv/ccs/binary/jis_x0201_1976.cct: Ditto. * libc/iconv/ccs/binary/jis_x0208_1990.cct: Ditto. * libc/iconv/ccs/binary/koi8_ru.cct: Ditto. * libc/iconv/ccs/binary/koi8_uni.cct: Ditto. * libc/iconv/ccs/binary/win_1250.cct: Ditto. * libc/iconv/ccs/binary/win_1251.cct: Ditto. * libc/iconv/ccs/binary/win_1252.cct: Ditto. * libc/iconv/ccs/binary/win_1253.cct: Ditto. * libc/iconv/ccs/binary/win_1254.cct: Ditto. * libc/iconv/ccs/binary/win_1255.cct: Ditto. * libc/iconv/ccs/binary/win_1256.cct: Ditto. * libc/iconv/ccs/binary/win_1257.cct: Ditto. * libc/iconv/ccs/binary/win_1258.cct: Ditto. * libc/iconv/ces/Makefile.am: Updated. * libc/iconv/ces/Makefile.in: Regenerated. * libc/iconv/ces/ucs-2-internal.c: Updated. * libc/iconv/ces/ucs-4-internal.c: Ditto. * libc/iconv/ces/utf-16.c: Ditto. * libc/iconv/ces/utf-8.c: Ditto. * libc/iconv/ces/cesbi.c: New file. * libc/iconv/ces/cesbi.h: Ditto. * libc/iconv/ces/cesdeps.h: Ditto. * libc/iconv/ces/euc.c: Ditto. * libc/iconv/ces/mkdeps.pl: Ditto. * libc/iconv/ces/table-pcs.c: Ditto. * libc/iconv/ces/table.c: Ditto. * libc/iconv/ces/ucs-2.c: Ditto. * libc/iconv/ces/ucs-4.c: Ditto. * libc/iconv/ces/us-ascii.c: Ditto. * libc/iconv/ces/euc-jp.c: Removed. * libc/iconv/ces/euc-kr.c: Ditto. * libc/iconv/ces/euc-tw.c: Ditto. * libc/iconv/ces/gb2312.c: Ditto. * libc/iconv/ces/iso-10646-ucs-2.: Ditto.c * libc/iconv/ces/iso-10646-ucs-4.c: Ditto. * libc/iconv/lib/Makefile.am: Updated. * libc/iconv/lib/Makefile.in: Regenerated. * libc/iconv/lib/endian.h: Updated. * libc/iconv/lib/iconv.c: Ditto. * libc/iconv/lib/local.h: Ditto. * libc/iconv/lib/aliases.c: Removed. * libc/iconv/lib/bialiasesi.c: Ditto. * libc/iconv/lib/biccs.c: Ditto. * libc/iconv/lib/bices.c: Ditto. * libc/iconv/lib/ccs.c: Ditto. * libc/iconv/lib/ces.c: Ditto. * libc/iconv/lib/ces_euc.c: Ditto. * libc/iconv/lib/ces_iso2022.c: Ditto. * libc/iconv/lib/ces_table.c: Ditto. * libc/iconv/lib/converter.c: Ditto. * libc/iconv/lib/deps.h: Ditto. * libc/iconv/lib/aliasesbi.c: Ditto. * libc/iconv/lib/aliasesi.c: Ditto. * libc/iconv/lib/conv.h: Ditto. * libc/iconv/lib/encnames.h: Ditto. * libc/iconv/lib/encoding.deps: Ditto. * libc/iconv/lib/iconvnls.c: Ditto. * libc/iconv/lib/iconvnls.h: Ditto. * libc/iconv/lib/loaddata.c: Ditto. * libc/iconv/lib/nullconv.c: Ditto. * libc/iconv/lib/ucsconv.c: Ditto. * libc/iconv/lib/ucsconv.h: Ditto. * libc/include/iconv.h: Update copyright. * libc/*/aclocal.m4: Regenerated. * libc/*/configure: Ditto. * libm/*/aclocal.m4: Ditto. * libm/*/configure: Ditto.
Diffstat (limited to 'newlib/libc/iconv/ces/utf-16.c')
-rw-r--r--newlib/libc/iconv/ces/utf-16.c364
1 files changed, 266 insertions, 98 deletions
diff --git a/newlib/libc/iconv/ces/utf-16.c b/newlib/libc/iconv/ces/utf-16.c
index fae4ed5f0..4b2ff77a1 100644
--- a/newlib/libc/iconv/ces/utf-16.c
+++ b/newlib/libc/iconv/ces/utf-16.c
@@ -1,6 +1,6 @@
-/*-
- * Copyright (c) 1999,2000
- * Konstantin Chuguev. All rights reserved.
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ * Copyright (c) 1999,2000, Konstantin Chuguev. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -22,117 +22,285 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * iconv (Charset Conversion Library) v2.0
*/
-#include "../lib/deps.h"
+#include "cesbi.h"
+
+#if defined (ICONV_TO_UCS_CES_UTF_16) \
+ || defined (ICONV_FROM_UCS_CES_UTF_16)
-#ifdef _ICONV_CONVERTER_UTF_16
+#include <_ansi.h>
+#include <reent.h>
+#include <sys/types.h>
+#include <stdlib.h>
#include <string.h>
+#include <wchar.h>
#include "../lib/local.h"
+#include "../lib/ucsconv.h"
+#include "../lib/endian.h"
+
+/*
+ * On input UTF-16 converter interpret BOM and uses Big Endian byte order if BOM
+ * is absent. UTF-16 converter outputs in System Endian and adds correspondent
+ * BOM as first code. UTF-16LE and UTF-16BE converters ignore BOM on input and
+ * don't output BOM.
+ */
+
+#define UTF16_UNDEFINED 0x00
+#define UTF16_BIG_ENDIAN 0x01
+#define UTF16_LITTLE_ENDIAN 0x02
+#define UTF16_SYSTEM_ENDIAN 0x04
+#define UTF16_BOM_WRITTEN 0x08
+
+#define UTF16_BOM 0xFEFF
+
+#define UTF_16 "utf_16"
+#define UTF_16BE "utf_16be"
+#define UTF_16LE "utf_16le"
+
+static size_t
+_DEFUN(utf_16_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ _free_r(rptr, data);
+ return 0;
+}
-static ssize_t
-_DEFUN(convert_from_ucs, (ces, in, outbuf, outbytesleft),
- struct iconv_ces *ces _AND
- ucs_t in _AND
- unsigned char **outbuf _AND
- size_t *outbytesleft)
+#if defined (ICONV_FROM_UCS_CES_UTF_16)
+static _VOID_PTR
+_DEFUN(utf_16_init_from_ucs, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
{
- unsigned char *cp;
- int *state;
- int bytes;
-
- if (in == UCS_CHAR_NONE)
- return 1; /* No state reinitialization for table charsets */
- if (in > 0x10FFFF)
- return -1;
- bytes = *(state = (int *)(ces->data)) ? 2 : 4;
- if (in > 0xFFFF)
- bytes += 2;
- if (*outbytesleft < bytes)
- return 0; /* No space in the output buffer */
- cp = *outbuf;
- if (*state == 0) {
- *cp++ = 0xFE;
- *cp++ = 0xFF;
- *state = 1;
+ int *data;
+
+ if ((data = (int *)_malloc_r (rptr, sizeof (int))) == NULL)
+ return (_VOID_PTR)NULL;
+
+ if (strcmp (encoding, UTF_16LE) == 0)
+ *data = UTF16_LITTLE_ENDIAN;
+ else if (strcmp (encoding, UTF_16BE) == 0)
+ *data = UTF16_BIG_ENDIAN;
+ else
+ *data = UTF16_SYSTEM_ENDIAN;
+
+ return (_VOID_PTR)data;
+}
+
+static size_t
+_DEFUN(utf_16_convert_from_ucs, (data, in, outbuf, outbytesleft),
+ _VOID_PTR data _AND
+ register ucs4_t in _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft)
+{
+ register ucs2_t *cp;
+ register size_t bytes;
+ register int *state;
+
+ if (in > 0x0010FFFF || (in >= 0x0000D800 && in <= 0x0000DFFF)
+ || in == 0x0000FFFF || in == 0x0000FFFE)
+ return (size_t)ICONV_CES_INVALID_CHARACTER;
+
+ state = (int *)data;
+ bytes = (*state == UTF16_SYSTEM_ENDIAN) ? sizeof (ucs2_t) * 2
+ : sizeof (ucs2_t);
+
+ if (in > 0x0000FFFF)
+ bytes += sizeof (ucs2_t);
+
+ if (*outbytesleft < bytes)
+ return (size_t)ICONV_CES_NOSPACE;
+
+ cp = (ucs2_t *)*outbuf;
+
+ if (*state == UTF16_SYSTEM_ENDIAN)
+ {
+ *cp++ = UTF16_BOM;
+ *state |= UTF16_BOM_WRITTEN;
}
- if (in > 0xFFFF) {
- *cp++ = ((in -= 0x10000) >> 18) | 0xD8;
- *cp++ = (in >> 10) & 0xFF;
- *cp++ = ((in >> 8) & 3) | 0xDC;
- } else
- *cp++ = (in >> 8) & 0xFF;
- *cp++ = in & 0xFF;
- (*outbuf) += bytes;
- *outbytesleft -= bytes;
- return 1;
+
+ if (in < 0x00010000)
+ {
+ switch (*state)
+ {
+ case UTF16_LITTLE_ENDIAN:
+ *cp = ICONV_HTOLES ((ucs2_t)in);
+ break;
+ case UTF16_BIG_ENDIAN:
+ *cp = ICONV_HTOBES ((ucs2_t)in);
+ break;
+ case (UTF16_SYSTEM_ENDIAN | UTF16_BOM_WRITTEN):
+ *cp = (ucs2_t)in;
+ break;
+ }
+ }
+ else
+ {
+ ucs2_t w1, w2;
+
+ /* Process surrogate pair */
+ in -= 0x00010000;
+ w1 = ((ucs2_t)((in >> 10)) & 0x03FF) | 0xD800;
+ w2 = (ucs2_t)(in & 0x000003FF) | 0xDC00;
+
+ switch (*state)
+ {
+ case UTF16_LITTLE_ENDIAN:
+ *cp++ = ICONV_HTOLES (w1);
+ *cp = ICONV_HTOLES (w2);
+ break;
+ case UTF16_BIG_ENDIAN:
+ *cp++ = ICONV_HTOBES (w1);
+ *cp = ICONV_HTOBES (w2);
+ break;
+ case (UTF16_SYSTEM_ENDIAN | UTF16_BOM_WRITTEN):
+ *cp++ = w1;
+ *cp = w2;
+ break;
+ }
+ }
+
+ *outbuf += bytes;
+ *outbytesleft -= bytes;
+
+ return bytes;
}
+#endif /* ICONV_FROM_UCS_CES_UTF_16 */
-static __inline ucs_t
-_DEFUN(msb, (buf), _CONST unsigned char *buf)
+#if defined (ICONV_TO_UCS_CES_UTF_16)
+static _VOID_PTR
+_DEFUN(utf_16_init_to_ucs, (rptr, encoding),
+ struct _reent *rptr _AND
+ _CONST char *encoding)
{
- return (buf[0] << 8) | buf[1];
+ int *data;
+
+ if ((data = (int *)_malloc_r (rptr, sizeof (int))) == NULL)
+ return (_VOID_PTR)NULL;
+
+ if (strcmp (encoding, UTF_16BE) == 0)
+ *data = UTF16_BIG_ENDIAN;
+ else if (strcmp (encoding, UTF_16LE) == 0)
+ *data = UTF16_LITTLE_ENDIAN;
+ else
+ *data = UTF16_UNDEFINED;
+
+ return (_VOID_PTR)data;
}
-static ucs_t
-_DEFUN(convert_to_ucs, (ces, inbuf, inbytesleft),
- struct iconv_ces *ces _AND
- _CONST unsigned char **inbuf _AND
- size_t *inbytesleft)
+static ucs4_t
+_DEFUN(utf_16_convert_to_ucs, (data, inbuf, inbytesleft),
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft)
{
- ucs_t res, res2;
- int *state, mark;
-
- if (*inbytesleft < 2)
- return UCS_CHAR_NONE; /* Not enough bytes in the input buffer */
- state = (int *)(ces->data);
- res = msb(*inbuf);
- switch (res) {
- case UCS_CHAR_ZERO_WIDTH_NBSP:
- if (*state == 0)
- *state = 1;
- mark = 1;
- break;
- case UCS_CHAR_INVALID:
- if (*state == 0)
- *state = 2;
- mark = 1;
- break;
- default:
- if (*state == 0)
- *state = 1;
- mark = 0;
+ register ucs2_t w1;
+ register ucs2_t w2;
+ register ucs2_t *cp;
+ int *state;
+ ucs4_t res;
+ int bytes = sizeof (ucs2_t);
+
+ if (*inbytesleft < bytes)
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ state = (int *)data;
+ cp = ((ucs2_t *)*inbuf);
+
+ if (*state == UTF16_UNDEFINED)
+ {
+ if (*cp == ICONV_HTOLES(UTF16_BOM))
+ *state = UTF16_LITTLE_ENDIAN;
+ else
+ *state = UTF16_BIG_ENDIAN;
+
+ if ( *cp == ICONV_HTOBES (UTF16_BOM)
+ || *cp == ICONV_HTOLES (UTF16_BOM))
+ {
+ if (*inbytesleft < (bytes += sizeof (ucs2_t)))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+ cp += 1;
+ }
+ }
+
+ if (*state == UTF16_LITTLE_ENDIAN)
+ w1 = ICONV_LETOHS (*cp);
+ else
+ w1 = ICONV_BETOHS (*cp);
+
+ if (w1 < 0xD800 || w1 > 0xDFFF)
+ {
+ if (w1 == 0xFFFF || w1 == 0xFFFE)
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+ res = (ucs4_t)w1;
}
- if (mark) {
- if (*inbytesleft < 4)
- return UCS_CHAR_NONE; /* Not enough bytes in the input buffer */
- *inbytesleft -= 2;
- res = msb((*inbuf) += 2);
+ else
+ {
+ /* Process surrogate pair */
+ if (*inbytesleft < (bytes += 2))
+ return (ucs4_t)ICONV_CES_BAD_SEQUENCE;
+
+ if (w1 > 0xDBFF)
+ /* Broken surrogate character */
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ cp += 1;
+
+ if (*state == UTF16_LITTLE_ENDIAN)
+ w2 = ICONV_LETOHS (*cp);
+ else
+ w2 = ICONV_BETOHS (*cp);
+
+ if (w2 < 0xDC00 || w2 > 0xDFFF)
+ /* Broken surrogate character */
+ return (ucs4_t)ICONV_CES_INVALID_CHARACTER;
+
+ res = (ucs4_t)(w2 & 0x03FF) | ((ucs4_t)(w1 & 0x03FF) << 10);
+ res += 0x00010000;
}
- if (*state == 2) { /* LSB order */
- res = (*(*inbuf) ++);
- res |= (*(*inbuf) ++) << 8;
- } else
- *inbuf += 2;
- *inbytesleft -= 2;
- if ((res & 0xFC00) != 0xD800) /* Non-surrogate character */
- return res;
- if (*inbytesleft < 2)
- return UCS_CHAR_NONE; /* Not enough bytes in the input buffer */
- if (*state == 2) {
- res2 = (*inbuf)[0];
- res2 |= (*inbuf)[1] << 8;
- } else
- res2 = msb(*inbuf);
- if ((res2 & 0xFC00) != 0xDC00) /* Broken surrogate pair */
- return -1;
- (*inbuf) += 2;
- (*inbytesleft) -= 2;
- return (((res & 0x3FF) << 10) | (res2 & 0x3FF)) + 0x10000;
+
+ *inbuf += bytes;
+ *inbytesleft -= bytes;
+
+ return res;
}
+#endif /* ICONV_TO_UCS_CES_UTF_16 */
-ICONV_CES_STATEFUL_MODULE_DECL(utf_16);
+static int
+_DEFUN(utf_16_get_mb_cur_max, (data),
+ _VOID_PTR data)
+{
+ return 6;
+}
+
+#if defined (ICONV_TO_UCS_CES_UTF_16)
+_CONST iconv_to_ucs_ces_handlers_t
+_iconv_to_ucs_ces_handlers_utf_16 =
+{
+ utf_16_init_to_ucs,
+ utf_16_close,
+ utf_16_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ utf_16_convert_to_ucs
+};
+#endif
+
+#if defined (ICONV_FROM_UCS_CES_UTF_16)
+_CONST iconv_from_ucs_ces_handlers_t
+_iconv_from_ucs_ces_handlers_utf_16 =
+{
+ utf_16_init_from_ucs,
+ utf_16_close,
+ utf_16_get_mb_cur_max,
+ NULL,
+ NULL,
+ NULL,
+ utf_16_convert_from_ucs
+};
+#endif
-#endif /* #ifdef _ICONV_CONVERTER_UTF_16 */
+#endif /* ICONV_TO_UCS_CES_UTF_16 || ICONV_FROM_UCS_CES_UTF_16 */