URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/tags/gnu-src/newlib-1.18.0/newlib-1.18.0-or32-1.0rc1/newlib/libc/iconv/lib
- from Rev 207 to Rev 345
- ↔ Reverse comparison
Rev 207 → Rev 345
/encnames.h
0,0 → 1,63
/* |
* This file was automatically generated mkdeps.pl script. Don't edit. |
*/ |
|
#ifndef __ENCNAMES_H__ |
#define __ENCNAMES_H__ |
|
/* |
* Encodings name macros. |
*/ |
#define ICONV_ENCODING_BIG5 "big5" |
#define ICONV_ENCODING_CP775 "cp775" |
#define ICONV_ENCODING_CP850 "cp850" |
#define ICONV_ENCODING_CP852 "cp852" |
#define ICONV_ENCODING_CP855 "cp855" |
#define ICONV_ENCODING_CP866 "cp866" |
#define ICONV_ENCODING_EUC_JP "euc_jp" |
#define ICONV_ENCODING_EUC_KR "euc_kr" |
#define ICONV_ENCODING_EUC_TW "euc_tw" |
#define ICONV_ENCODING_ISO_8859_1 "iso_8859_1" |
#define ICONV_ENCODING_ISO_8859_10 "iso_8859_10" |
#define ICONV_ENCODING_ISO_8859_11 "iso_8859_11" |
#define ICONV_ENCODING_ISO_8859_13 "iso_8859_13" |
#define ICONV_ENCODING_ISO_8859_14 "iso_8859_14" |
#define ICONV_ENCODING_ISO_8859_15 "iso_8859_15" |
#define ICONV_ENCODING_ISO_8859_2 "iso_8859_2" |
#define ICONV_ENCODING_ISO_8859_3 "iso_8859_3" |
#define ICONV_ENCODING_ISO_8859_4 "iso_8859_4" |
#define ICONV_ENCODING_ISO_8859_5 "iso_8859_5" |
#define ICONV_ENCODING_ISO_8859_6 "iso_8859_6" |
#define ICONV_ENCODING_ISO_8859_7 "iso_8859_7" |
#define ICONV_ENCODING_ISO_8859_8 "iso_8859_8" |
#define ICONV_ENCODING_ISO_8859_9 "iso_8859_9" |
#define ICONV_ENCODING_ISO_IR_111 "iso_ir_111" |
#define ICONV_ENCODING_KOI8_R "koi8_r" |
#define ICONV_ENCODING_KOI8_RU "koi8_ru" |
#define ICONV_ENCODING_KOI8_U "koi8_u" |
#define ICONV_ENCODING_KOI8_UNI "koi8_uni" |
#define ICONV_ENCODING_UCS_2 "ucs_2" |
#define ICONV_ENCODING_UCS_2_INTERNAL "ucs_2_internal" |
#define ICONV_ENCODING_UCS_2BE "ucs_2be" |
#define ICONV_ENCODING_UCS_2LE "ucs_2le" |
#define ICONV_ENCODING_UCS_4 "ucs_4" |
#define ICONV_ENCODING_UCS_4_INTERNAL "ucs_4_internal" |
#define ICONV_ENCODING_UCS_4BE "ucs_4be" |
#define ICONV_ENCODING_UCS_4LE "ucs_4le" |
#define ICONV_ENCODING_US_ASCII "us_ascii" |
#define ICONV_ENCODING_UTF_16 "utf_16" |
#define ICONV_ENCODING_UTF_16BE "utf_16be" |
#define ICONV_ENCODING_UTF_16LE "utf_16le" |
#define ICONV_ENCODING_UTF_8 "utf_8" |
#define ICONV_ENCODING_WIN_1250 "win_1250" |
#define ICONV_ENCODING_WIN_1251 "win_1251" |
#define ICONV_ENCODING_WIN_1252 "win_1252" |
#define ICONV_ENCODING_WIN_1253 "win_1253" |
#define ICONV_ENCODING_WIN_1254 "win_1254" |
#define ICONV_ENCODING_WIN_1255 "win_1255" |
#define ICONV_ENCODING_WIN_1256 "win_1256" |
#define ICONV_ENCODING_WIN_1257 "win_1257" |
#define ICONV_ENCODING_WIN_1258 "win_1258" |
|
#endif /* !__ENCNAMES_H__ */ |
|
encnames.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: iconv.c
===================================================================
--- iconv.c (nonexistent)
+++ iconv.c (revision 345)
@@ -0,0 +1,349 @@
+/*
+ * 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+
+/*
+FUNCTION
+<>, <>, <>---charset conversion routines
+
+INDEX
+ iconv
+INDEX
+ iconv_open
+INDEX
+ iconv_close
+INDEX
+ _iconv_r
+INDEX
+ _iconv_open_r
+INDEX
+ _iconv_close_r
+
+ANSI_SYNOPSIS
+ #include
+ iconv_t iconv_open (const char *<[to]>, const char *<[from]>);
+ int iconv_close (iconv_t <[cd]>);
+ size_t iconv (iconv_t <[cd]>, char **<[inbuf]>,
+ size_t *<[inbytesleft]>,
+ char **<[outbuf]>, size_t *<[outbytesleft]>),
+
+ iconv_t _iconv_open_r (struct _reent *<[rptr]>,
+ const char *<[to]>, const char *<[from]>);
+ int _iconv_close_r (struct _reent *<[rptr]>, iconv_t <[cd]>);
+ size_t _iconv_r (struct _reent *<[rptr]>,
+ iconv_t <[cd]>, const char **<[inbuf]>,
+ size_t *<[inbytesleft]>,
+ char **<[outbuf]>, size_t *<[outbytesleft]>),
+
+TRAD_SYNOPSIS
+ #include
+ size_t iconv (<[cd]>, <[in]>, <[inleft]>, <[out]>, <[outleft]>)
+ iconv_t <[cd]>;
+ char **<[in]>;
+ size_t *<[inleft]>;
+ char **<[out]>;
+ size_t *<[outleft]>);
+
+ #include
+ iconv_t iconv_open (<[to]>, <[from]>);
+ const char *<[to]>;
+ const char *<[from]>;
+
+ #include
+ int iconv_close (<[cd]>);
+ iconv_t <[cd]>;
+
+ #include
+ size_t _iconv_r (<[rptr]>, <[cd]>, <[in]>, <[inleft]>, <[out]>, <[outleft]>)
+ struct _reent *<[rptr]>;
+ iconv_t <[cd]>;
+ const char **<[in]>;
+ size_t *<[inleft]>;
+ char **<[out]>;
+ size_t *<[outleft]>);
+
+ #include
+ iconv_t _iconv_open_r (<[rptr]>, <[to]>, <[from]>);
+ struct _reent *<[rptr]>;
+ const char *<[to]>;
+ const char *<[from]>;
+
+ #include
+ int iconv_close (<[rptr]>, <[cd]>);
+ struct _reent *<[rptr]>;
+ iconv_t <[cd]>;
+
+DESCRIPTION
+The function <> converts characters from <[in]> which are in one
+encoding to characters of another encoding, outputting them to <[out]>.
+The value <[inleft]> specifies the number of input bytes to convert whereas
+the value <[outleft]> specifies the size remaining in the <[out]> buffer.
+The conversion descriptor <[cd]> specifies the conversion being performed
+and is created via <>.
+
+An <> conversion stops if: the input bytes are exhausted, the output
+buffer is full, an invalid input character sequence occurs, or the
+conversion specifier is invalid.
+
+The function <> is used to specify a conversion from one
+encoding: <[from]> to another: <[to]>. The result of the call is
+to create a conversion specifier that can be used with <>.
+
+The function <> is used to close a conversion specifier after
+it is no longer needed.
+
+The <<_iconv_r>>, <<_iconv_open_r>>, and <<_iconv_close_r>> functions are
+reentrant versions of <>, <>, and <>,
+respectively. An additional reentrancy struct pointer: <[rptr]> is passed
+to properly set <>.
+
+RETURNS
+The <> function returns the number of non-identical conversions
+performed. If an error occurs, (size_t)-1 is returned and <>
+is set appropriately. The values of <[inleft]>, <[in]>, <[out]>,
+and <[outleft]> are modified to indicate how much input was processed
+and how much output was created.
+
+The <> function returns either a valid conversion specifier
+or (iconv_t)-1 to indicate failure. If failure occurs, <> is set
+appropriately.
+
+The <> function returns 0 on success or -1 on failure.
+If failure occurs <> is set appropriately.
+
+PORTABILITY
+<>, <>, and <> are non-ANSI and are specified
+by the Single Unix specification.
+
+No supporting OS subroutine calls are required.
+*/
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "local.h"
+#include "conv.h"
+#include "ucsconv.h"
+
+/*
+ * iconv interface functions as specified by Single Unix specification.
+ */
+
+iconv_t
+_DEFUN(iconv_open, (to, from),
+ _CONST char *to _AND
+ _CONST char *from)
+{
+ return _iconv_open_r (_REENT, to, from);
+}
+
+
+size_t
+_DEFUN(iconv, (cd, inbuf, inbytesleft, outbuf, outbytesleft),
+ iconv_t cd _AND
+ char **inbuf _AND
+ size_t *inbytesleft _AND
+ char **outbuf _AND
+ size_t *outbytesleft)
+{
+ return _iconv_r (_REENT, cd, (_CONST char **) inbuf, inbytesleft,
+ outbuf, outbytesleft);
+}
+
+
+int
+_DEFUN(iconv_close, (cd), iconv_t cd)
+{
+ return _iconv_close_r (_REENT, cd);
+}
+
+
+#ifndef _REENT_ONLY
+iconv_t
+_DEFUN(_iconv_open_r, (rptr, to, from),
+ struct _reent *rptr _AND
+ _CONST char *to _AND
+ _CONST char *from)
+{
+ iconv_conversion_t *ic;
+
+ if (to == NULL || from == NULL || *to == '\0' || *from == '\0')
+ return (iconv_t)-1;
+
+ if ((to = (_CONST char *)_iconv_resolve_encoding_name (rptr, to)) == NULL)
+ return (iconv_t)-1;
+
+ if ((from = (_CONST char *)_iconv_resolve_encoding_name (rptr, from)) == NULL)
+ {
+ _free_r (rptr, (_VOID_PTR)to);
+ return (iconv_t)-1;
+ }
+
+ ic = (iconv_conversion_t *)_malloc_r (rptr, sizeof (iconv_conversion_t));
+ if (ic == NULL)
+ return (iconv_t)-1;
+
+ /* Select which conversion type to use */
+ if (strcmp (from, to) == 0)
+ {
+ /* Use null conversion */
+ ic->handlers = &_iconv_null_conversion_handlers;
+ ic->data = ic->handlers->open (rptr, to, from);
+ }
+ else
+ {
+ /* Use UCS-based conversion */
+ ic->handlers = &_iconv_ucs_conversion_handlers;
+ ic->data = ic->handlers->open (rptr, to, from);
+ }
+
+ _free_r (rptr, (_VOID_PTR)to);
+ _free_r (rptr, (_VOID_PTR)from);
+
+ if (ic->data == NULL)
+ {
+ _free_r (rptr, (_VOID_PTR)ic);
+ return (iconv_t)-1;
+ }
+
+ return (_VOID_PTR)ic;
+}
+
+
+size_t
+_DEFUN(_iconv_r, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft),
+ struct _reent *rptr _AND
+ iconv_t cd _AND
+ _CONST char **inbuf _AND
+ size_t *inbytesleft _AND
+ char **outbuf _AND
+ size_t *outbytesleft)
+{
+ iconv_conversion_t *ic = (iconv_conversion_t *)cd;
+
+ if ((_VOID_PTR)cd == NULL || cd == (iconv_t)-1 || ic->data == NULL
+ || (ic->handlers != &_iconv_null_conversion_handlers
+ && ic->handlers != &_iconv_ucs_conversion_handlers))
+ {
+ __errno_r (rptr) = EBADF;
+ return (size_t)-1;
+ }
+
+ if (inbuf == NULL || *inbuf == NULL)
+ {
+ mbstate_t state_null = ICONV_ZERO_MB_STATE_T;
+
+ if (!ic->handlers->is_stateful(ic->data, 1))
+ return (size_t)0;
+
+ if (outbuf == NULL || *outbuf == NULL)
+ {
+ /* Reset shift state */
+ ic->handlers->set_state (ic->data, &state_null, 1);
+
+ return (size_t)0;
+ }
+
+ if (outbytesleft != NULL)
+ {
+ mbstate_t state_save = ICONV_ZERO_MB_STATE_T;
+
+ /* Save current shift state */
+ ic->handlers->get_state (ic->data, &state_save, 1);
+
+ /* Reset shift state */
+ ic->handlers->set_state (ic->data, &state_null, 1);
+
+ /* Get initial shift state sequence and it's length */
+ ic->handlers->get_state (ic->data, &state_null, 1);
+
+ if (*outbytesleft >= state_null.__count)
+ {
+ memcpy ((_VOID_PTR)(*outbuf), (_VOID_PTR)&state_null, state_null.__count);
+
+ *outbuf += state_null.__count;
+ *outbytesleft -= state_null.__count;
+
+ return (size_t)0;
+ }
+
+ /* Restore shift state if output buffer is too small */
+ ic->handlers->set_state (ic->data, &state_save, 1);
+ }
+
+ __errno_r (rptr) = E2BIG;
+ return (size_t)-1;
+ }
+
+ if (*inbytesleft == 0)
+ {
+ __errno_r (rptr) = EINVAL;
+ return (size_t)-1;
+ }
+
+ if (*outbytesleft == 0 || *outbuf == NULL)
+ {
+ __errno_r (rptr) = E2BIG;
+ return (size_t)-1;
+ }
+
+ return ic->handlers->convert (rptr,
+ ic->data,
+ (_CONST unsigned char**)inbuf,
+ inbytesleft,
+ (unsigned char**)outbuf,
+ outbytesleft,
+ 0);
+}
+
+
+int
+_DEFUN(_iconv_close_r, (rptr, cd),
+ struct _reent *rptr _AND
+ iconv_t cd)
+{
+ int res;
+ iconv_conversion_t *ic = (iconv_conversion_t *)cd;
+
+ if ((_VOID_PTR)cd == NULL || cd == (iconv_t)-1 || ic->data == NULL
+ || (ic->handlers != &_iconv_null_conversion_handlers
+ && ic->handlers != &_iconv_ucs_conversion_handlers))
+ {
+ __errno_r (rptr) = EBADF;
+ return -1;
+ }
+
+ res = (int)ic->handlers->close (rptr, ic->data);
+
+ _free_r (rptr, (_VOID_PTR)cd);
+
+ return res;
+}
+#endif /* !_REENT_ONLY */
iconv.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: encoding.deps
===================================================================
--- encoding.deps (nonexistent)
+++ encoding.deps (revision 345)
@@ -0,0 +1,441 @@
+#
+# This file describes dependencies between encodings, CES, CCS, etc.
+# File relates only to UCS-based conversions and is needed for automatic
+# generation of C source files and C header files.
+#
+# This configuration file consists of sections, each section consists of
+# entries.
+#
+# Use only normalized names.
+#
+
+#
+# The first section named "ENCODINGS" describes:
+# 1. CES converter corresponding for each enoding;
+# 2. Each encoding's aliases;
+# 3. CCS tables corresponding for each enoding.
+#
+SECTION ENCODINGS
+
+# ISO-10646-UCS-2. Big Endian, NBSP is always interpreted as NBSP (BOM isn't supported).
+ENTRY
+ENCODING: ucs_2
+CES: ucs_2
+ALIASES: ucs2 iso_10646_ucs_2 iso10646_ucs_2 iso_10646_ucs2 iso10646_ucs2 iso10646ucs2 csUnicode
+ENTRY END
+
+# Big Endian version of ISO-10646-UCS-2 (in fact, equivalent to ucs_2).
+# Big Endian, NBSP is always interpreted as NBSP (BOM isn't supported).
+ENTRY
+ENCODING: ucs_2be
+CES: ucs_2
+ALIASES: ucs2be
+ENTRY END
+
+# Little Endian version of ISO-10646-UCS-2.
+# Little Endian, NBSP is always interpreted as NBSP (BOM isn't supported).
+ENTRY
+ENCODING: ucs_2le
+CES: ucs_2
+ALIASES: ucs2le
+ENTRY END
+
+# ISO-10646-UCS-2 in system byte order.
+# NBSP is always interpreted as NBSP (BOM isn't supported).
+# NOTE: Dont delete and rename this since it is used as widechar's
+# encoding when sizeof(wchar_t) == 2
+ENTRY
+ENCODING: ucs_2_internal
+CES: ucs_2_internal
+ALIASES: ucs2_internal ucs_2internal ucs2internal
+ENTRY END
+
+# ISO-10646-UCS-4. Big Endian, NBSP is always interpreted as NBSP (BOM isn't supported).
+ENTRY
+ENCODING: ucs_4
+CES: ucs_4
+ALIASES: ucs4 iso_10646_ucs_4 iso10646_ucs_4 iso_10646_ucs4 iso10646_ucs4 iso10646ucs4
+ENTRY END
+
+# Big Endian version of ISO-10646-UCS-4 (in fact, equivalent to ucs_4).
+# Big Endian, NBSP is always interpreted as NBSP (BOM isn't supported).
+ENTRY
+ENCODING: ucs_4be
+CES: ucs_4
+ALIASES: ucs4be
+ENTRY END
+
+# Little Endian version of ISO-10646-UCS-4.
+# Little Endian, NBSP is always interpreted as NBSP (BOM isn't supported).
+ENTRY
+ENCODING: ucs_4le
+CES: ucs_4
+ALIASES: ucs4le
+ENTRY END
+
+# ISO-10646-UCS-4 in system byte order.
+# NBSP is always interpreted as NBSP (BOM isn't supported).
+# NOTE: Dont delete and rename this since it is used as widechar's
+# encoding when sizeof(wchar_t) == 4
+ENTRY
+ENCODING: ucs_4_internal
+CES: ucs_4_internal
+ALIASES: ucs4_internal ucs_4internal ucs4internal
+ENTRY END
+
+# RFC 3629 UTF-8
+ENTRY
+ENCODING: utf_8
+CES: utf_8
+ALIASES: utf8
+ENTRY END
+
+# RFC 2781 UTF-16. The very first NBSP code in stream is interpreted as BOM.
+ENTRY
+ENCODING: utf_16
+CES: utf_16
+ALIASES: utf16
+ENTRY END
+
+# Big Endian version of RFC 2781 UTF-16.
+# NBSP is always interpreted as NBSP (BOM isn't supported).
+ENTRY
+ENCODING: utf_16be
+CES: utf_16
+ALIASES: utf16be
+ENTRY END
+
+# Little Endian version of RFC 2781 UTF-16.
+# NBSP is always interpreted as NBSP (BOM isn't supported).
+ENTRY
+ENCODING: utf_16le
+CES: utf_16
+ALIASES: utf16le
+ENTRY END
+
+# 7-bit ASCII.
+ENTRY
+ENCODING: us_ascii
+CES: us_ascii
+ALIASES: ansi_x3.4_1968 ansi_x3.4_1986 iso_646.irv:1991 ascii iso646_us us ibm367 cp367 csascii
+ENTRY END
+
+# RFC 1489 Cyrillic
+ENTRY
+ENCODING: koi8_r
+CES: table
+CCS: koi8_r
+ALIASES: cskoi8r koi8r koi8
+ENTRY END
+
+# Obsoleted Ukrainian
+ENTRY
+ENCODING: koi8_ru
+CES: table
+CCS: koi8_ru
+ALIASES: koi8ru
+ENTRY END
+
+# RFC 2319 Ukrainian
+ENTRY
+ENCODING: koi8_u
+CES: table
+CCS: koi8_u
+ALIASES: koi8u
+ENTRY END
+
+# KOI8 Unified
+ENTRY
+ENCODING: koi8_uni
+CES: table
+CCS: koi8_uni
+ALIASES: koi8uni
+ENTRY END
+
+# ISO IR 111/ECMA Cyrillic.
+ENTRY
+ENCODING: iso_ir_111
+CES: table
+CCS: iso_ir_111
+ALIASES: ecma_cyrillic koi8_e koi8e csiso111ecmacyrillic
+ENTRY END
+
+# ISO 8859-1:1987 - Latin 1, West European
+ENTRY
+ENCODING: iso_8859_1
+CES: table
+CCS: iso_8859_1
+ALIASES: iso8859_1 iso88591 iso_8859_1:1987 iso_ir_100 latin1 l1 ibm819 cp819 csisolatin1
+ENTRY END
+
+# ISO 8859-2:1987 - Latin 2, East European
+ENTRY
+ENCODING: iso_8859_2
+CES: table
+CCS: iso_8859_2
+ALIASES: iso8859_2 iso88592 iso_8859_2:1987 iso_ir_101 latin2 l2 csisolatin2
+ENTRY END
+
+# ISO 8859-3:1988 - Latin 3, South European
+ENTRY
+ENCODING: iso_8859_3
+CES: table
+CCS: iso_8859_3
+ALIASES: iso_8859_3:1988 iso_ir_109 iso8859_3 latin3 l3 csisolatin3 iso88593
+ENTRY END
+
+# ISO 8859-4:1988 - Latin 4, North European
+ENTRY
+ENCODING: iso_8859_4
+CES: table
+CCS: iso_8859_4
+ALIASES: iso8859_4 iso88594 iso_8859_4:1988 iso_ir_110 latin4 l4 csisolatin4
+ENTRY END
+
+# ISO 8859-5:1988 - Cyrillic
+ENTRY
+ENCODING: iso_8859_5
+CES: table
+CCS: iso_8859_5
+ALIASES: iso8859_5 iso88595 iso_8859_5:1988 iso_ir_144 cyrillic csisolatincyrillic
+ENTRY END
+
+# ISO i8859-6:1987 - Arabic
+ENTRY
+ENCODING: iso_8859_6
+CES: table
+CCS: iso_8859_6
+ALIASES: iso_8859_6:1987 iso_ir_127 iso8859_6 ecma_114 asmo_708 arabic csisolatinarabic iso88596
+ENTRY END
+
+# ISO 8859-7:1987 - Greek
+ENTRY
+ENCODING: iso_8859_7
+CES: table
+CCS: iso_8859_7
+ALIASES: iso_8859_7:1987 iso_ir_126 iso8859_7 elot_928 ecma_118 greek greek8 csisolatingreek iso88597
+ENTRY END
+
+# ISO 8859-8:1988 - Hebrew
+ENTRY
+ENCODING: iso_8859_8
+CES: table
+CCS: iso_8859_8
+ALIASES: iso_8859_8:1988 iso_ir_138 iso8859_8 hebrew csisolatinhebrew iso88598
+ENTRY END
+
+# ISO 8859-9:1989 - Latin 5, Turkish
+ENTRY
+ENCODING: iso_8859_9
+CES: table
+CCS: iso_8859_9
+ALIASES: iso_8859_9:1989 iso_ir_148 iso8859_9 latin5 l5 csisolatin5 iso88599
+ENTRY END
+
+# ISO 8859-10:1992 - Latin 6, Nordic
+ENTRY
+ENCODING: iso_8859_10
+CES: table
+CCS: iso_8859_10
+ALIASES: iso_8859_10:1992 iso_ir_157 iso885910 latin6 l6 csisolatin6 iso8859_10
+ENTRY END
+
+# ISO 8859-11 - Thai
+ENTRY
+ENCODING: iso_8859_11
+CES: table
+CCS: iso_8859_11
+ALIASES: iso8859_11 iso885911
+ENTRY END
+
+# ISO 8859-13:1998 - Latin 7, Baltic Rim
+ENTRY
+ENCODING: iso_8859_13
+CES: table
+CCS: iso_8859_13
+ALIASES: iso_8859_13:1998 iso8859_13 iso885913
+ENTRY END
+
+# ISO 8859-14:1998 - Latin 8, Celtic
+ENTRY
+ENCODING: iso_8859_14
+CES: table
+CCS: iso_8859_14
+ALIASES: iso_8859_14:1998 iso885914 iso8859_14
+ENTRY END
+
+# ISO 8859-15:1998 - Latin 9, West Europe, successor of Latin 1
+ENTRY
+ENCODING: iso_8859_15
+CES: table
+CCS: iso_8859_15
+ALIASES: iso885915 iso_8859_15:1998 iso8859_15
+ENTRY END
+
+# Win-1250
+ENTRY
+ENCODING: win_1250
+CES: table
+CCS: win_1250
+ALIASES: cp1250
+ENTRY END
+
+# Win-1251 - Cyrillic
+ENTRY
+ENCODING: win_1251
+CES: table
+CCS: win_1251
+ALIASES: cp1251
+ENTRY END
+
+# Win-1252 - Latin 1
+ENTRY
+ENCODING: win_1252
+CES: table
+CCS: win_1252
+ALIASES: cp1252
+ENTRY END
+
+# Win-1253 - Greek
+ENTRY
+ENCODING: win_1253
+CES: table
+CCS: win_1253
+ALIASES: cp1253
+ENTRY END
+
+# Win-1254 - Turkish
+ENTRY
+ENCODING: win_1254
+CES: table
+CCS: win_1254
+ALIASES: cp1254
+ENTRY END
+
+# Win-1255 - Hebrew
+ENTRY
+ENCODING: win_1255
+CES: table
+CCS: win_1255
+ALIASES: cp1255
+ENTRY END
+
+# Win-1256 - Arabic
+ENTRY
+ENCODING: win_1256
+CES: table
+CCS: win_1256
+ALIASES: cp1256
+ENTRY END
+
+# Win-1257 - Baltic
+ENTRY
+ENCODING: win_1257
+CES: table
+CCS: win_1257
+ALIASES: cp1257
+ENTRY END
+
+# Win-1258 - Vietnamese7 that supports Cyrillic
+ENTRY
+ENCODING: win_1258
+CES: table
+CCS: win_1258
+ALIASES: cp1258
+ENTRY END
+
+# big5 - an encoding for Traditional Chinese
+ENTRY
+ENCODING: big5
+CES: table_pcs
+CCS: big5
+ALIASES: csbig5 big_five bigfive cn_big5 cp950
+ENTRY END
+
+# IBM 775 - an updated version of CP 437 that supports balitic languages.
+ENTRY
+ENCODING: cp775
+CES: table
+CCS: cp775
+ALIASES: ibm775 cspc775baltic
+ENTRY END
+
+# IBM 850 - an updated version of CP 437 where several Latin 1 characters have been
+# added instead of some less-often used characters like line-drawing and greek ones.
+ENTRY
+ENCODING: cp850
+CES: table
+CCS: cp850
+ALIASES: ibm850 850 cspc850multilingual
+ENTRY END
+
+# IBM 852 - an updated version of CP 437 where several Latin 2 characters have been added
+# instead of some less-often used characters like line-drawing and greek ones.
+ENTRY
+ENCODING: cp852
+CES: table
+CCS: cp852
+ALIASES: ibm852 852 cspcp852
+ENTRY END
+
+# IBM 855 - an updated version of CP 437 that supports Cyrillic.
+ENTRY
+ENCODING: cp855
+CES: table
+CCS: cp855
+ALIASES: ibm855 855 csibm855
+ENTRY END
+
+# IBM 866 - an updated version of CP 855 which followes the more logical Russian alphabet
+# ordering of the alternativny variant that is preferred by many Russian users.
+ENTRY
+ENCODING: cp866
+CES: table
+CCS: cp866
+ALIASES: 866 IBM866 CSIBM866
+ENTRY END
+
+# EUC-JP - The EUC for Japanese
+ENTRY
+ENCODING: euc_jp
+CES: euc
+CCS: jis_x0208_1990 jis_x0201_1976 jis_x0212_1990
+ALIASES: eucjp
+ENTRY END
+
+# EUC-KR - The EUC for Korean
+ENTRY
+ENCODING: euc_kr
+CES: euc
+CCS: ksx1001
+ALIASES: euckr
+ENTRY END
+
+# EUC-TW - The EUC for Traditional Chinese
+ENTRY
+ENCODING: euc_tw
+CES: euc
+CCS: cns11643_plane1 cns11643_plane2 cns11643_plane14
+ALIASES: euctw
+ENTRY END
+
+SECTION END
+
+#
+# This section is named "CES_DEPENDENCIES" and describes dependencies
+# between CES converters (some CES converters may use another CES converters).
+#
+SECTION CES_DEPENDENCIES
+
+ENTRY
+CES: table_pcs
+USED_CES: table
+ENTRY END
+
+ENTRY
+CES: euc
+USED_CES: table us_ascii
+ENTRY END
+
+SECTION END
+
Index: local.h
===================================================================
--- local.h (nonexistent)
+++ local.h (revision 345)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+#ifndef __ICONV_LIB_LOCAL_H__
+#define __ICONV_LIB_LOCAL_H__
+
+#include <_ansi.h>
+#include
+#include
+#include
+
+/* void* type for K&R compilers compatibility */
+#define _VOID_PTR _PTR
+
+/* Encodings aliases file */
+#define ICONV_ALIASES_FNAME "encoding.aliases"
+/* iconv CCS data path */
+#define ICONV_SUBDIR "iconv_data"
+/* iconv data files extension */
+#define ICONV_DATA_EXT ".cct"
+
+/* This macro is used to zero mbstate_t objects */
+#ifdef __GNUC__
+#define ICONV_ZERO_MB_STATE_T ((mbstate_t){0, {0}})
+#else
+#define ICONV_ZERO_MB_STATE_T {0}
+#endif
+
+/* Define the maximum multi-byte character length produced by iconv library */
+#if MB_LEN_MAX < 6
+# define ICONV_MB_LEN_MAX 6
+#else
+# define ICONV_MB_LEN_MAX MB_LEN_MAX
+#endif
+
+/* 16-bit UCS-2 type */
+typedef __uint16_t ucs2_t;
+
+/* 32-bit UCS-4 type */
+typedef __uint32_t ucs4_t;
+
+
+/* The list of built-in encoding names and aliases */
+extern _CONST char *
+_iconv_aliases;
+
+#endif /* !__ICONV_LIB_LOCAL_H__ */
+
local.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: iconvnls.h
===================================================================
--- iconvnls.h (nonexistent)
+++ iconvnls.h (revision 345)
@@ -0,0 +1,37 @@
+#ifndef __ICONV_ICONVNLS_H__
+#define __ICONV_ICONVNLS_H__
+
+#include
+
+/*
+ * Include ucs-2-internal or ucs-4-internal if Newlib is configured as
+ * "multibyte-capable".
+ * ============================================================================
+ */
+#ifdef _MB_CAPABLE
+/*
+ * Determine size of wchar_t. If size of wchar_t is 2, UCS-2-INTERNAL is used
+ * as widechar's encoding. If size of wchar_t is 4, UCS-4-INTERNAL is used as
+ * widechar's encoding.
+ */
+# if WCHAR_MAX > 0xFFFF
+# ifndef _ICONV_FROM_ENCODING_UCS_4_INTERNAL
+# define _ICONV_FROM_ENCODING_UCS_4_INTERNAL
+# endif
+# ifndef _ICONV_TO_ENCODING_UCS_4_INTERNAL
+# define _ICONV_TO_ENCODING_UCS_4_INTERNAL
+# endif
+# elif WCHAR_MAX > 0xFF
+# ifndef _ICONV_FROM_ENCODING_UCS_2_INTERNAL
+# define _ICONV_FROM_ENCODING_UCS_2_INTERNAL
+# endif
+# ifndef _ICONV_TO_ENCODING_UCS_2_INTERNAL
+# define _ICONV_TO_ENCODING_UCS_2_INTERNAL
+# endif
+# else
+# error Do not know how to work with 1 byte widechars.
+# endif
+#endif /* _MB_CAPABLE */
+
+#endif /* !__ICONV_ICONVNLS_H__ */
+
iconvnls.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nullconv.c
===================================================================
--- nullconv.c (nonexistent)
+++ nullconv.c (revision 345)
@@ -0,0 +1,143 @@
+/*
+ * 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include
+#include "local.h"
+#include "conv.h"
+
+static int null_conversion_dummy_data;
+
+
+static _VOID_PTR
+_DEFUN(null_conversion_open, (rptr, to, from),
+ struct _reent *rptr _AND
+ _CONST char *to _AND
+ _CONST char *from)
+{
+ return (_VOID_PTR)&null_conversion_dummy_data;
+}
+
+
+static size_t
+_DEFUN(null_conversion_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ return 0;
+}
+
+
+static size_t
+_DEFUN(null_conversion_convert,
+ (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft),
+ struct _reent *rptr _AND
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft _AND
+ int flags)
+{
+ size_t result;
+ size_t len;
+
+ if (*inbytesleft < *outbytesleft)
+ {
+ result = 0;
+ len = *inbytesleft;
+ }
+ else
+ {
+ result = (size_t)-1;
+ len = *outbytesleft;
+ __errno_r (rptr) = E2BIG;
+ }
+
+ if ((flags & 1) == 0)
+ memcpy (*outbuf, *inbuf, len);
+
+ *inbuf += len;
+ *outbuf += len;
+ *inbytesleft -= len;
+ *outbytesleft -= len;
+
+ return result;
+}
+
+
+static int
+_DEFUN(null_conversion_get_mb_cur_max, (data, direction),
+ _VOID_PTR data _AND
+ int direction)
+{
+ return ICONV_MB_LEN_MAX;
+}
+
+
+static _VOID
+_DEFUN(null_conversion_get_state, (data, state, size),
+ _VOID_PTR data _AND
+ mbstate_t *state _AND
+ int direction)
+{
+ return;
+}
+
+
+static int
+_DEFUN(null_conversion_set_state, (data, state, direction),
+ _VOID_PTR data _AND
+ mbstate_t *state _AND
+ int direction)
+{
+ return 0;
+}
+
+static int
+_DEFUN(null_conversion_is_stateful, (data, direction),
+ _VOID_PTR data _AND
+ int direction)
+{
+ return 0;
+}
+
+/* Null conversion definition object */
+_CONST iconv_conversion_handlers_t
+_iconv_null_conversion_handlers =
+{
+ null_conversion_open,
+ null_conversion_close,
+ null_conversion_convert,
+ null_conversion_get_state,
+ null_conversion_set_state,
+ null_conversion_get_mb_cur_max,
+ null_conversion_is_stateful
+};
+
nullconv.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ucsconv.c
===================================================================
--- ucsconv.c (nonexistent)
+++ ucsconv.c (revision 345)
@@ -0,0 +1,357 @@
+/*
+ * 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include
+#include "local.h"
+#include "conv.h"
+#include "ucsconv.h"
+
+static int fake_data;
+
+static int
+_EXFUN(find_encoding_name, (_CONST char *searchee,
+ _CONST char **names));
+
+
+/*
+ * UCS-based conversion interface functions implementation.
+ */
+
+static _VOID_PTR
+_DEFUN(ucs_based_conversion_open, (rptr, to, from),
+ struct _reent *rptr _AND
+ _CONST char *to _AND
+ _CONST char *from)
+{
+ iconv_ucs_conversion_t *uc;
+ _CONST iconv_to_ucs_ces_t *to_ucs_bices;
+ _CONST iconv_from_ucs_ces_t *from_ucs_bices;
+
+ uc = (iconv_ucs_conversion_t *)
+ _calloc_r (rptr, 1, sizeof (iconv_ucs_conversion_t));
+ if (uc == NULL)
+ return NULL;
+
+ /*
+ * Find CES converter for "from" encoding ("from" source encoding corresponds
+ * to "to_ucs" CES converter).
+ */
+ for (to_ucs_bices = &_iconv_to_ucs_ces[0];
+ to_ucs_bices->names != NULL;
+ to_ucs_bices++)
+ {
+ if (find_encoding_name (from, to_ucs_bices->names) == 0)
+ break;
+ }
+
+ /*
+ * Find CES converter for "to" encoding ("to" source encoding corresponds
+ * to "from_ucs" CES converter).
+ */
+ for (from_ucs_bices = &_iconv_from_ucs_ces[0];
+ from_ucs_bices->names != NULL;
+ from_ucs_bices++)
+ {
+ if (find_encoding_name (to, from_ucs_bices->names) == 0)
+ break;
+ }
+
+ if (to_ucs_bices->names == NULL || from_ucs_bices->names == NULL)
+ goto error;
+
+ uc->to_ucs.handlers = to_ucs_bices->handlers;
+ uc->from_ucs.handlers = from_ucs_bices->handlers;
+
+ /* Initialize "to UCS" CES converter */
+ if (to_ucs_bices->handlers->init != NULL)
+ {
+ uc->to_ucs.data = to_ucs_bices->handlers->init (rptr, from);
+ if (uc->to_ucs.data == NULL)
+ goto error;
+ }
+ else
+ uc->to_ucs.data = (_VOID_PTR)&fake_data;
+
+
+ /* Initialize "from UCS" CES converter */
+ if (from_ucs_bices->handlers->init != NULL)
+ {
+ uc->from_ucs.data = from_ucs_bices->handlers->init (rptr, to);
+ if (uc->from_ucs.data == NULL)
+ goto error;
+ }
+ else
+ uc->from_ucs.data = (_VOID_PTR)&fake_data;
+
+ return uc;
+
+error:
+ if (uc->to_ucs.data != NULL && uc->to_ucs.handlers->close != NULL)
+ uc->to_ucs.handlers->close (rptr, uc->to_ucs.data);
+
+ _free_r (rptr, (_VOID_PTR)uc);
+
+ return NULL;
+}
+
+
+static size_t
+_DEFUN(ucs_based_conversion_close, (rptr, data),
+ struct _reent *rptr _AND
+ _VOID_PTR data)
+{
+ iconv_ucs_conversion_t *uc;
+ size_t res = 0;
+
+ uc = (iconv_ucs_conversion_t *)data;
+
+ if (uc->from_ucs.handlers->close != NULL)
+ res = uc->from_ucs.handlers->close (rptr, uc->from_ucs.data);
+ if (uc->to_ucs.handlers->close != NULL)
+ res |= uc->to_ucs.handlers->close (rptr, uc->to_ucs.data);
+
+ _free_r (rptr, (_VOID_PTR)data);
+
+ return res;
+}
+
+
+static size_t
+_DEFUN(ucs_based_conversion_convert,
+ (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft, flags),
+ struct _reent *rptr _AND
+ _VOID_PTR data _AND
+ _CONST unsigned char **inbuf _AND
+ size_t *inbytesleft _AND
+ unsigned char **outbuf _AND
+ size_t *outbytesleft _AND
+ int flags)
+{
+ unsigned char outbuf1[ICONV_MB_LEN_MAX];
+ unsigned char *poutbuf1;
+ size_t res = 0;
+ iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data;
+
+ while (*inbytesleft > 0)
+ {
+ register size_t bytes;
+ register ucs4_t ch;
+ _CONST unsigned char *inbuf_save = *inbuf;
+ size_t inbyteslef_save = *inbytesleft;
+
+ if (*outbytesleft == 0)
+ {
+ __errno_r (rptr) = E2BIG;
+ return (size_t)-1;
+ }
+
+ ch = uc->to_ucs.handlers->convert_to_ucs (uc->to_ucs.data,
+ inbuf, inbytesleft);
+
+ if (ch == (ucs4_t)ICONV_CES_BAD_SEQUENCE)
+ {
+ __errno_r (rptr) = EINVAL;
+ return (size_t)-1;
+ }
+
+ if (ch == (ucs4_t)ICONV_CES_INVALID_CHARACTER)
+ {
+ __errno_r (rptr) = EILSEQ;
+ return (size_t)-1;
+ }
+
+ if (flags & ICONV_DONT_SAVE_BIT)
+ {
+ poutbuf1 = &outbuf1[0];
+ outbuf = &poutbuf1;
+ }
+
+ bytes = uc->from_ucs.handlers->convert_from_ucs (uc->from_ucs.data, ch,
+ outbuf, outbytesleft);
+
+ if (bytes == (size_t)ICONV_CES_NOSPACE)
+ {
+ *inbuf = inbuf_save;
+ *inbytesleft = inbyteslef_save;
+ __errno_r (rptr) = E2BIG;
+ return (size_t)-1;
+ }
+ else if (bytes == (size_t)ICONV_CES_INVALID_CHARACTER)
+ {
+ if (flags & ICONV_FAIL_BIT)
+ {
+ /* Generate error */
+ __errno_r (rptr) = EILSEQ;
+ return (size_t)-1;
+ }
+ /*
+ * For this case SUSv3 stands: "if iconv() encounters a character in the
+ * input buffer that is valid, but for which an identical character does
+ * not exist in the target encoding, iconv() shall perform an
+ * implementation-defined conversion on this character".
+ * Don't generate error, just write default character.
+ */
+ bytes = uc->from_ucs.handlers->convert_from_ucs (
+ uc->from_ucs.data,
+ (ucs4_t)DEFAULT_CHARACTER,
+ outbuf,
+ outbytesleft);
+ if ((__int32_t)bytes < 0)
+ {
+ __errno_r (rptr) = E2BIG;
+ return (size_t)-1;
+ }
+
+ res += 1;
+ }
+ }
+
+ return res;
+}
+
+
+static int
+_DEFUN(ucs_based_conversion_get_mb_cur_max, (data, direction),
+ _VOID_PTR data _AND
+ int direction)
+{
+ iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data;
+
+ if (direction == 0)
+ return uc->to_ucs.handlers->get_mb_cur_max (uc->to_ucs.data);
+ else
+ return uc->from_ucs.handlers->get_mb_cur_max (uc->from_ucs.data);
+}
+
+
+static _VOID
+_DEFUN(ucs_based_conversion_get_state, (data, state, direction),
+ _VOID_PTR data _AND
+ mbstate_t *state _AND
+ int direction)
+{
+ iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data;
+ mbstate_t nullstate = ICONV_ZERO_MB_STATE_T;
+
+ if (direction == 0)
+ {
+ if (uc->to_ucs.handlers->get_state != NULL)
+ uc->to_ucs.handlers->get_state (uc->to_ucs.data, state);
+ else
+ *state = nullstate; /* internal copy */
+ }
+ else
+ {
+ if (uc->from_ucs.handlers->get_state != NULL)
+ uc->from_ucs.handlers->get_state (uc->from_ucs.data, state);
+ else
+ *state = nullstate; /* internal copy */
+ }
+
+ return;
+}
+
+
+static int
+_DEFUN(ucs_based_conversion_set_state, (data, state, direction),
+ _VOID_PTR data _AND
+ mbstate_t *state _AND
+ int direction)
+{
+ iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data;
+
+ if (direction == 0)
+ {
+ if (uc->to_ucs.handlers->set_state != NULL)
+ return uc->to_ucs.handlers->set_state (uc->to_ucs.data, state);
+ }
+ else
+ {
+ if (uc->from_ucs.handlers->set_state != NULL)
+ return uc->from_ucs.handlers->set_state (uc->from_ucs.data, state);
+ }
+
+ return 0;
+}
+
+static int
+_DEFUN(ucs_based_conversion_is_stateful, (data, direction),
+ _VOID_PTR data _AND
+ int direction)
+{
+ iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data;
+
+ if (direction == 0)
+ {
+ if (uc->to_ucs.handlers->is_stateful != NULL)
+ return uc->to_ucs.handlers->is_stateful (uc->to_ucs.data);
+ }
+ else
+ {
+ if (uc->from_ucs.handlers->is_stateful != NULL)
+ return uc->from_ucs.handlers->is_stateful (uc->from_ucs.data);
+ }
+
+ return 0;
+}
+
+
+/* UCS-based conversion definition object */
+_CONST iconv_conversion_handlers_t
+_iconv_ucs_conversion_handlers =
+{
+ ucs_based_conversion_open,
+ ucs_based_conversion_close,
+ ucs_based_conversion_convert,
+ ucs_based_conversion_get_state,
+ ucs_based_conversion_set_state,
+ ucs_based_conversion_get_mb_cur_max,
+ ucs_based_conversion_is_stateful
+};
+
+
+/*
+ * Supplementary functions.
+ */
+
+static int
+_DEFUN(find_encoding_name, (searchee, names),
+ _CONST char *searchee _AND
+ _CONST char **names)
+{
+ _CONST char *p;
+
+ for (p = *names; p != NULL; p = *(names++))
+ if (strcmp (p, searchee) == 0)
+ return 0;
+
+ return -1;
+}
+
ucsconv.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: Makefile.in
===================================================================
--- Makefile.in (nonexistent)
+++ Makefile.in (revision 345)
@@ -0,0 +1,530 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/../../../Makefile.shared $(srcdir)/Makefile.in \
+ $(srcdir)/Makefile.am
+subdir = iconv/lib
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/../../ltoptions.m4 \
+ $(top_srcdir)/../../ltsugar.m4 \
+ $(top_srcdir)/../../ltversion.m4 \
+ $(top_srcdir)/../../lt~obsolete.m4 \
+ $(top_srcdir)/../acinclude.m4 $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+lib_a_AR = $(AR) $(ARFLAGS)
+lib_a_LIBADD =
+am__objects_1 = lib_a-aliasesi.$(OBJEXT) lib_a-ucsconv.$(OBJEXT) \
+ lib_a-nullconv.$(OBJEXT) lib_a-iconv.$(OBJEXT) \
+ lib_a-aliasesbi.$(OBJEXT) lib_a-iconvnls.$(OBJEXT)
+@ELIX_LEVEL_1_FALSE@am__objects_2 = lib_a-aliasesi.$(OBJEXT) \
+@ELIX_LEVEL_1_FALSE@ lib_a-ucsconv.$(OBJEXT) \
+@ELIX_LEVEL_1_FALSE@ lib_a-nullconv.$(OBJEXT) \
+@ELIX_LEVEL_1_FALSE@ lib_a-iconv.$(OBJEXT) \
+@ELIX_LEVEL_1_FALSE@ lib_a-aliasesbi.$(OBJEXT) \
+@ELIX_LEVEL_1_FALSE@ lib_a-iconvnls.$(OBJEXT)
+am_lib_a_OBJECTS = $(am__objects_1) $(am__objects_2)
+lib_a_OBJECTS = $(am_lib_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(lib_a_SOURCES)
+DATA = $(noinst_DATA)
+ETAGS = etags
+CTAGS = ctags
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CRT0 = @CRT0@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBC_EXTRA_DEF = @LIBC_EXTRA_DEF@
+LIBC_EXTRA_LIB = @LIBC_EXTRA_LIB@
+LIBC_MACHINE_LIB = @LIBC_MACHINE_LIB@
+LIBC_POSIX_LIB = @LIBC_POSIX_LIB@
+LIBC_SIGNAL_DEF = @LIBC_SIGNAL_DEF@
+LIBC_SIGNAL_LIB = @LIBC_SIGNAL_LIB@
+LIBC_STDIO64_DEF = @LIBC_STDIO64_DEF@
+LIBC_STDIO64_LIB = @LIBC_STDIO64_LIB@
+LIBC_STDIO_DEF = @LIBC_STDIO_DEF@
+LIBC_STDIO_LIB = @LIBC_STDIO_LIB@
+LIBC_SYSCALL_LIB = @LIBC_SYSCALL_LIB@
+LIBC_SYS_LIB = @LIBC_SYS_LIB@
+LIBC_UNIX_LIB = @LIBC_UNIX_LIB@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+READELF = @READELF@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+aext = @aext@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extra_dir = @extra_dir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libm_machine_dir = @libm_machine_dir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lpfx = @lpfx@
+lt_ECHO = @lt_ECHO@
+machine_dir = @machine_dir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+newlib_basedir = @newlib_basedir@
+oext = @oext@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+subdirs = @subdirs@
+sys_dir = @sys_dir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = cygnus
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+GENERAL_SOURCES = \
+ aliasesi.c \
+ ucsconv.c \
+ nullconv.c \
+ iconv.c \
+ aliasesbi.c \
+ iconvnls.c
+
+@ELIX_LEVEL_1_FALSE@ELIX_SOURCES = \
+@ELIX_LEVEL_1_FALSE@ aliasesi.c \
+@ELIX_LEVEL_1_FALSE@ ucsconv.c \
+@ELIX_LEVEL_1_FALSE@ nullconv.c \
+@ELIX_LEVEL_1_FALSE@ iconv.c \
+@ELIX_LEVEL_1_FALSE@ aliasesbi.c \
+@ELIX_LEVEL_1_FALSE@ iconvnls.c
+
+@ELIX_LEVEL_1_TRUE@ELIX_SOURCES =
+noinst_LIBRARIES = lib.a
+lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
+lib_a_CFLAGS = $(AM_CFLAGS)
+noinst_DATA =
+CHEWOUT_FILES = iconv.def
+SUFFIXES = .def
+CHEW = ../../../doc/makedoc -f $(srcdir)/../../../doc/doc.str
+CLEANFILES = $(CHEWOUT_FILES) *.ref
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .def .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../Makefile.shared $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus iconv/lib/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --cygnus iconv/lib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
+ -rm -f lib.a
+ $(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
+ $(RANLIB) lib.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -c -o $@ $<
+
+lib_a-aliasesi.o: aliasesi.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aliasesi.o `test -f 'aliasesi.c' || echo '$(srcdir)/'`aliasesi.c
+
+lib_a-aliasesi.obj: aliasesi.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aliasesi.obj `if test -f 'aliasesi.c'; then $(CYGPATH_W) 'aliasesi.c'; else $(CYGPATH_W) '$(srcdir)/aliasesi.c'; fi`
+
+lib_a-ucsconv.o: ucsconv.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucsconv.o `test -f 'ucsconv.c' || echo '$(srcdir)/'`ucsconv.c
+
+lib_a-ucsconv.obj: ucsconv.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ucsconv.obj `if test -f 'ucsconv.c'; then $(CYGPATH_W) 'ucsconv.c'; else $(CYGPATH_W) '$(srcdir)/ucsconv.c'; fi`
+
+lib_a-nullconv.o: nullconv.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nullconv.o `test -f 'nullconv.c' || echo '$(srcdir)/'`nullconv.c
+
+lib_a-nullconv.obj: nullconv.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nullconv.obj `if test -f 'nullconv.c'; then $(CYGPATH_W) 'nullconv.c'; else $(CYGPATH_W) '$(srcdir)/nullconv.c'; fi`
+
+lib_a-iconv.o: iconv.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-iconv.o `test -f 'iconv.c' || echo '$(srcdir)/'`iconv.c
+
+lib_a-iconv.obj: iconv.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-iconv.obj `if test -f 'iconv.c'; then $(CYGPATH_W) 'iconv.c'; else $(CYGPATH_W) '$(srcdir)/iconv.c'; fi`
+
+lib_a-aliasesbi.o: aliasesbi.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aliasesbi.o `test -f 'aliasesbi.c' || echo '$(srcdir)/'`aliasesbi.c
+
+lib_a-aliasesbi.obj: aliasesbi.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aliasesbi.obj `if test -f 'aliasesbi.c'; then $(CYGPATH_W) 'aliasesbi.c'; else $(CYGPATH_W) '$(srcdir)/aliasesbi.c'; fi`
+
+lib_a-iconvnls.o: iconvnls.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-iconvnls.o `test -f 'iconvnls.c' || echo '$(srcdir)/'`iconvnls.c
+
+lib_a-iconvnls.obj: iconvnls.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-iconvnls.obj `if test -f 'iconvnls.c'; then $(CYGPATH_W) 'iconvnls.c'; else $(CYGPATH_W) '$(srcdir)/iconvnls.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+check-am:
+check: check-am
+all-am: Makefile $(LIBRARIES) $(DATA)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+objectlist.awk.in: $(noinst_LTLIBRARIES)
+ -rm -f objectlist.awk.in
+ for i in `ls *.lo` ; \
+ do \
+ echo $$i `pwd`/$$i >> objectlist.awk.in ; \
+ done
+
+.c.def:
+ $(CHEW) < $< > $*.def 2> $*.ref
+ touch stmp-def
+
+doc: $(CHEWOUT_FILES)
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: endian.h
===================================================================
--- endian.h (nonexistent)
+++ endian.h (revision 345)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+#ifndef __ICONV_CES_ENDIAN_H__
+#define __ICONV_CES_ENDIAN_H__
+
+#include
+
+#if (BYTE_ORDER == LITTLE_ENDIAN)
+
+# define ICONV_BETOHS(s) \
+ ((((s) << 8) & 0xFF00) | (((s) >> 8) & 0x00FF))
+
+# define ICONV_BETOHL(l) \
+ ((((l) << 24) & 0xFF000000) | \
+ (((l) << 8) & 0x00FF0000) | \
+ (((l) >> 8) & 0x0000FF00) | \
+ (((l) >> 24) & 0x000000FF))
+
+# define ICONV_LETOHS(s) (s)
+# define ICONV_LETOHL(l) (l)
+
+# define ICONV_HTOLES(s) ICONV_LETOHS (s)
+# define ICONV_HTOLEL(l) ICONV_LETOHL (l)
+# define ICONV_HTOBES(s) ICONV_BETOHS (s)
+# define ICONV_HTOBEL(l) ICONV_BETOHL (l)
+
+#elif (BYTE_ORDER == BIG_ENDIAN)
+
+# define ICONV_BETOHS(s) (s)
+# define ICONV_BETOHL(l) (l)
+
+# define ICONV_LETOHS(s) \
+ ((((s) << 8) & 0xFF00) | (((s) >> 8) & 0x00FF))
+
+# define ICONV_LETOHL(l) \
+ ((((l) << 24) & 0xFF000000) | \
+ (((l) << 8) & 0x00FF0000) | \
+ (((l) >> 8) & 0x0000FF00) | \
+ (((l) >> 24) & 0x000000FF))
+
+# define ICONV_HTOBES(s) ICONV_BETOHS (s)
+# define ICONV_HTOBEL(l) ICONV_BETOHL (l)
+# define ICONV_HTOLES(s) ICONV_LETOHS (s)
+# define ICONV_HTOLEL(l) ICONV_LETOHL (l)
+
+#else
+# error "Unknown byte order."
+#endif
+
+#endif /* !__ICONV_CES_ENDIAN_H__ */
+
endian.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ucsconv.h
===================================================================
--- ucsconv.h (nonexistent)
+++ ucsconv.h (revision 345)
@@ -0,0 +1,327 @@
+/*
+ * 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+#ifndef __ICONV_UCS_CONVERSION_H__
+#define __ICONV_UCS_CONVERSION_H__
+
+#include <_ansi.h>
+#include
+#include
+#include
+#include "local.h"
+
+/* No enough space in output buffer */
+#define ICONV_CES_NOSPACE 0
+/* Invalid input character */
+#define ICONV_CES_INVALID_CHARACTER -1
+/* No corespondent character in destination encoding */
+#define ICONV_CES_BAD_SEQUENCE -2
+/* All unknown characters are marked by this code */
+#define DEFAULT_CHARACTER 0x3f /* ASCII '?' */
+
+
+/*
+ * iconv_to_ucs_ces_handlers_t - "to UCS" CES converter handlers.
+ *
+ * Structure contains function pointers which should be provided by
+ * "to_ucs" CES converter.
+ *
+ * ============================================================================
+ */
+typedef struct
+{
+ /*
+ * init - initialize CES converter.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - reent structure of current thread/process;
+ * _CONST char *encoding - encoding name.
+ *
+ * DESCRIPTION:
+ * Initializes CES converter. CES converter may deal with a series of
+ * encodings, such as Table or EUC CES converters. 'encoding' parameter
+ * indicates which encoding CES converter should use.
+ *
+ * RETURN:
+ * Returns CES-specific data pointer if success. In case of error returns
+ * NULL and sets current thread's/process's errno.
+ */
+ _VOID_PTR _EXFNPTR(init, (struct _reent *rptr,
+ _CONST char *encoding));
+
+ /*
+ * close - close CES converter.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - reent structure of current thread/process;
+ * _VOID_PTR data - CES converter-specific data.
+ *
+ * DESCRIPTION:
+ * Preforms CES converter closing. *
+ * RETURN:
+ * Returns (size_t)0 if success. In case of error returns (size_t)-1 and
+ * sets current thread's/process's errno.
+ */
+ size_t _EXFNPTR(close, (struct _reent *rptr,
+ _VOID_PTR data));
+
+ /*
+ * get_mb_cur_max - get maximum character length in bytes.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - conversion-specific data;
+ *
+ * DESCRIPTION:
+ * Returns encoding's maximum character length.
+ */
+ int _EXFNPTR(get_mb_cur_max, (_VOID_PTR data));
+
+ /*
+ * get_state - get current shift state.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - conversion-specific data;
+ * mbstate_t *state - mbstate_t object where shift state will be stored;
+ *
+ * DESCRIPTION:
+ * Returns encoding's current shift sequence.
+ */
+ _VOID _EXFNPTR(get_state, (_VOID_PTR data,
+ mbstate_t *state));
+
+ /*
+ * set_state - set shift state.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - conversion-specific data;
+ * mbstate_t *state - mbstate_t value to which shift state will be set.
+ *
+ * DESCRIPTION:
+ * Sets encoding's current shift state to 'state'. if 'state'
+ * object is zero-object - reset current shift state.
+ * Returns 0 if '*state' object has right format, -1 else.
+ */
+ int _EXFNPTR(set_state, (_VOID_PTR data,
+ mbstate_t *state));
+
+ /*
+ * is_stateful - is encoding stateful state.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - conversion-specific data;
+ *
+ * DESCRIPTION:
+ * Returns 0 if encoding is stateless, else returns 1.
+ */
+ int _EXFNPTR(is_stateful, (_VOID_PTR data));
+
+ /*
+ * convert_to_ucs - convert character to UCS.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - CES converter-specific data;
+ * _CONST unsigned char **inbuf - buffer with input character byte sequence;
+ * size_t *inbytesleft - output buffer bytes count.
+ *
+ * DESCRIPTION:
+ * Converts input characters into UCS encoding. 'inbuf' is
+ * incremented accordingly. 'bytesleft' is decremented accordingly. Should
+ * be provided by correspondent CES module.
+ *
+ * RETURN:
+ * Returns resulting UCS code if success. If input character is invalid,
+ * returns ICONV_CES_INVALID_CHARACTER. If invalid or incomplete bytes
+ * sequence was met, returns ICONV_CES_BAD_SEQUENCE.
+ */
+ ucs4_t _EXFNPTR(convert_to_ucs, (_VOID_PTR data,
+ _CONST unsigned char **inbuf,
+ size_t *inbytesleft));
+} iconv_to_ucs_ces_handlers_t;
+
+
+/*
+ * iconv_from_ucs_ces_handlers_t - "from UCS" CES converter handlers.
+ *
+ * Structure contains function pointers which should be provided by
+ * "from_ucs" CES converter.
+ *
+ * ============================================================================
+ */
+typedef struct
+{
+ /* Same as in iconv_to_ucs_ces_handlers_t */
+ _VOID_PTR _EXFNPTR(init, (struct _reent *rptr,
+ _CONST char *encoding));
+
+ /* Same as in iconv_to_ucs_ces_handlers_t */
+ size_t _EXFNPTR(close, (struct _reent *rptr,
+ _VOID_PTR data));
+
+ /* Same as in iconv_to_ucs_ces_handlers_t */
+ int _EXFNPTR(get_mb_cur_max, (_VOID_PTR data));
+
+ /* Same as in iconv_to_ucs_ces_handlers_t */
+ _VOID _EXFNPTR(get_state, (_VOID_PTR data,
+ mbstate_t *state));
+
+ /* Same as in iconv_to_ucs_ces_handlers_t */
+ int _EXFNPTR(set_state, (_VOID_PTR data,
+ mbstate_t *state));
+
+ /* Same as in iconv_to_ucs_ces_handlers_t */
+ int _EXFNPTR(is_stateful, (_VOID_PTR data));
+
+ /*
+ * convert_from_ucs - convert UCS character to destination encoding.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - CES converter-specific data;
+ * ucs4_t in - input UCS-4 character;
+ * unsigned char **outbuf - output buffer for the result;
+ * size_t *outbytesleft - output buffer bytes count.
+ *
+ * DESCRIPTION:
+ * Converts input UCS characters to destination encoding and stores result
+ * in 'outbuf' if there is sufficient free space present. 'outbuf' is
+ * incremented accordingly. 'outbytesleft' is decremented accordingly. Should
+ * be provided by correspondent CES module.
+ * Output buffer always has at least 1 byte.
+ *
+ * RETURN:
+ * Returns number of bytes that was written into output buffer if success.
+ * If there is no enough space in output buffer, returns ICONV_CES_NOSPACE.
+ * If there is no corresponding character in destination encoding, returns
+ * ICONV_CES_INVALID_CHARACTER.
+ */
+ size_t _EXFNPTR(convert_from_ucs, (_VOID_PTR data,
+ ucs4_t in,
+ unsigned char **outbuf,
+ size_t *outbytesleft));
+} iconv_from_ucs_ces_handlers_t;
+
+
+/*
+ * iconv_to_ucs_ces_desc_t - "to UCS" CES converter definition structure for
+ * usage in iconv_ucs_conversion_t conversion description structure.
+ *
+ * ============================================================================
+ */
+typedef struct
+{
+ /* CES converter handlers */
+ _CONST iconv_to_ucs_ces_handlers_t *handlers;
+
+ /* "to_ucs" CES converter-specific data. */
+ _VOID_PTR data;
+} iconv_to_ucs_ces_desc_t;
+
+
+/*
+ * iconv_from_ucs_ces_desc_t - "from UCS" CES converter definition structure for
+ * usage in iconv_ucs_conversion_t conversion description structure.
+ *
+ * ============================================================================
+ */
+typedef struct
+{
+ /* CES converter handlers */
+ _CONST iconv_from_ucs_ces_handlers_t *handlers;
+
+ /* "from_ucs" CES converter-specific data. */
+ _VOID_PTR data;
+} iconv_from_ucs_ces_desc_t;
+
+
+/*
+ * iconv_ucs_conversion_t - UCS-based conversion definition structure.
+ *
+ * Defines special type of conversion where every character is first
+ * converted into UCS-4 (UCS-2 for table-driven), and after this the
+ * resulting UCS character is converted to destination encoding.
+ * UCS-based conversion is composed of two *converters*, defined by
+ * iconv_ces_t structure. The iconv_ucs_conversion_t object is referred
+ * from iconv_conversion_t object using 'data' field.
+ *
+ * Structure contains two objects - 'to_ucs' and 'from_ucs' which define
+ * "source encoding to UCS" and "UCS to destination encoding" converters.
+ *
+ * ============================================================================
+ */
+typedef struct
+{
+ /* Source encoding -> CES converter. */
+ iconv_to_ucs_ces_desc_t to_ucs;
+
+ /* UCS -> destination encoding CES converter. */
+ iconv_from_ucs_ces_desc_t from_ucs;
+} iconv_ucs_conversion_t;
+
+
+/*
+ * iconv_to_ucs_ces_t - defines "to UCS" CES converter.
+ *
+ * ============================================================================
+ */
+typedef struct
+{
+ /*
+ * An array of encodings names, supported by CES converter.
+ * The end of array should be marked by NULL pointer.
+ */
+ _CONST char **names;
+
+ /* CES converter description structure */
+ _CONST iconv_to_ucs_ces_handlers_t *handlers;
+} iconv_to_ucs_ces_t;
+
+
+/*
+ * iconv_from_ucs_ces_t - defines "from UCS" CES converter.
+ *
+ * ============================================================================
+ */
+typedef struct
+{
+ /*
+ * An array of encodings names, supported by CES converter.
+ * The end of array should be marked by NULL pointer.
+ */
+ _CONST char **names;
+
+ /* CES converter description structure */
+ _CONST iconv_from_ucs_ces_handlers_t *handlers;
+} iconv_from_ucs_ces_t;
+
+
+/* List of "to UCS" linked-in CES converters. */
+extern _CONST iconv_to_ucs_ces_t
+_iconv_to_ucs_ces[];
+
+/* List of "from UCS" linked-in CES converters. */
+extern _CONST iconv_from_ucs_ces_t
+_iconv_from_ucs_ces[];
+
+#endif /* !__ICONV_UCS_CONVERSION_H__ */
+
ucsconv.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: Makefile.am
===================================================================
--- Makefile.am (nonexistent)
+++ Makefile.am (revision 345)
@@ -0,0 +1,49 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+GENERAL_SOURCES = \
+ aliasesi.c \
+ ucsconv.c \
+ nullconv.c \
+ iconv.c \
+ aliasesbi.c \
+ iconvnls.c
+
+
+## The following interfaces are EL/IX level 2
+if ELIX_LEVEL_1
+ELIX_SOURCES =
+else
+ELIX_SOURCES = \
+ aliasesi.c \
+ ucsconv.c \
+ nullconv.c \
+ iconv.c \
+ aliasesbi.c \
+ iconvnls.c
+endif
+
+noinst_LIBRARIES = lib.a
+lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
+lib_a_CFLAGS = $(AM_CFLAGS)
+noinst_DATA =
+
+include $(srcdir)/../../../Makefile.shared
+
+CHEWOUT_FILES = iconv.def
+
+SUFFIXES = .def
+
+CHEW = ../../../doc/makedoc -f $(srcdir)/../../../doc/doc.str
+
+.c.def:
+ $(CHEW) < $< > $*.def 2> $*.ref
+ touch stmp-def
+
+doc: $(CHEWOUT_FILES)
+
+CLEANFILES = $(CHEWOUT_FILES) *.ref
+
Makefile.am
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: aliasesi.c
===================================================================
--- aliasesi.c (nonexistent)
+++ aliasesi.c (revision 345)
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "local.h"
+
+/*
+ * strnstr - locate a substring in a fixed-size string.
+ *
+ * PARAMETERS:
+ * _CONST char *haystack - the string in which to search.
+ * _CONST char *needle - the string which to search.
+ * int length - the maximum 'haystack' string length.
+ *
+ * DESCRIPTION:
+ * The strstr() function finds the first occurrence of the substring
+ * 'needle' in the string 'haystack'. At most 'length' bytes are searched.
+ *
+ * RETURN:
+ * Returns a pointer to the beginning of substring, or NULL if substring
+ * was not found.
+ */
+static char *
+_DEFUN(strnstr, (haystack, needle, length),
+ _CONST char *haystack _AND
+ _CONST char *needle _AND
+ int length)
+{
+ _CONST char *max = haystack + length;
+
+ if (*haystack == '\0')
+ return *needle == '\0' ? (char *)haystack : (char *)NULL;
+
+ while (haystack < max)
+ {
+ int i = 0;
+ while (1)
+ {
+ if (needle[i] == '\0')
+ return (char *)haystack;
+ if (needle[i] != haystack[i])
+ break;
+ i += 1;
+ }
+ haystack += 1;
+ }
+ return (char *)NULL;
+}
+
+/*
+ * canonical_form - canonize 'str'.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - reent structure of current thread/process.
+ * _CONST char *str - string to canonize.
+ *
+ * DESCRIPTION:
+ * Converts all letters to small and substitute all '-' characters by '_'
+ * characters.
+ *
+ * RETURN:
+ * Returns canonical form of 'str' if success, NULL if failure.
+ */
+static _CONST char *
+_DEFUN(canonical_form, (rptr, str),
+ struct _reent *rptr _AND
+ _CONST char *str)
+{
+ char *p, *p1;
+
+ if (str == NULL || (p = p1 = _strdup_r (rptr, str)) == NULL)
+ return (_CONST char *)NULL;
+
+ for (; *str; str++, p++)
+ {
+ if (*str == '-')
+ *p = '_';
+ else
+ *p = tolower (*str);
+ }
+
+ return (_CONST char *)p1;
+}
+
+/*
+ * find_alias - find encoding name name by it's alias.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - reent structure of current thread/process.
+ * _CONST char *alias - alias by which "official" name should be found.
+ * _CONST char *table - aliases table.
+ * int len - aliases table length.
+ *
+ * DESCRIPTION:
+ * 'table' contains the list of encoding names and aliases.
+ * Names go first, e.g.:
+ *
+ * name1 alias11 alias12 alias1N
+ * name2 alias21 alias22 alias2N
+ * nameM aliasM1 aliasM2 aliasMN
+ *
+ * If line begins with backspace it is considered as the continuation of
+ * previous line.
+ *
+ * RETURN:
+ * Returns pointer to name found if success. In case of error returns NULL
+ * and sets current thread's/process's errno.
+ */
+static char *
+_DEFUN(find_alias, (rptr, alias, table, len),
+ struct _reent *rptr _AND
+ _CONST char *alias _AND
+ _CONST char *table _AND
+ int len)
+{
+ _CONST char *end;
+ _CONST char *p;
+ int l = strlen (alias);
+ _CONST char *ptable = table;
+ _CONST char *table_end = table + len;
+
+ if (table == NULL || alias == NULL || *table == '\0' || *alias == '\0')
+ return NULL;
+
+search_again:
+ if (len < l || (p = strnstr (ptable, alias, len)) == NULL)
+ return NULL;
+
+ /* Check that substring is segregated by '\n', '\t' or ' ' */
+ if (!((p == table || isspace (*(p-1)) || *(p-1) == '\n')
+ && (p+l == table_end || isspace (*(p+l)) || *(p+l) == '\n')))
+ {
+ ptable = p + l;
+ len -= table - p;
+ goto search_again;
+ }
+
+ while(--p > table && *p != '\n');
+
+ if (*(++p) == '#')
+ return NULL;
+
+ for (end = p + 1; !isspace (*end) && *end != '\n' && *end != '\0'; end++);
+
+ return _strndup_r (rptr, p, (size_t)(end - p));
+}
+
+/*
+ * _iconv_resolve_encoding_name - resolves encoding's name by given alias.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - reent structure of current thread/process.
+ * _CONST char *ca - encoding alias to resolve.
+ *
+ * DESCRIPTION:
+ * First, tries to find 'ca' among built-in aliases. If not found, tries to
+ * find it external file.
+ *
+ * RETURN:
+ * Encoding name if found. In case of error returns NULL
+ * and sets current thread's/process's errno.
+ */
+char *
+_DEFUN(_iconv_resolve_encoding_name, (rptr, cname, path),
+ struct _reent *rptr _AND
+ _CONST char *ca)
+{
+ char *p = (char *)ca;
+
+ /* Alias shouldn't contain white spaces, '\n' and '\r' symbols */
+ while (*p)
+ if (*p == ' ' || *p == '\r' || *p++ == '\n')
+ return NULL;
+
+ if ((ca = canonical_form (rptr, ca)) == NULL)
+ return NULL;
+
+ p = find_alias (rptr, ca, _iconv_aliases, strlen (_iconv_aliases));
+
+ _free_r (rptr, (_VOID_PTR)ca);
+ return p;
+}
+
aliasesi.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: conv.h
===================================================================
--- conv.h (nonexistent)
+++ conv.h (revision 345)
@@ -0,0 +1,221 @@
+/*
+ * 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+#ifndef __ICONV_CONVERSION_H__
+#define __ICONV_CONVERSION_H__
+
+#include <_ansi.h>
+#include
+#include
+#include
+
+/* Bits for 'flags' parameter of 'convert' call */
+#define ICONV_DONT_SAVE_BIT 1
+#define ICONV_FAIL_BIT 2
+
+/*
+ * iconv_conversion_handlers_t - keeps iconv conversion handlers.
+ *
+ * Keeps 6 interface function handlers:
+ * open(), close(), convert(), get_mb_cur_max(), get_state(), set_state(),
+ * get_mb_cur_max() and is_stateful(). Last 5 interface functions are needed to
+ * support locale subsystem.
+ *
+ * ============================================================================
+ */
+typedef struct
+{
+ /*
+ * open - open and initialize conversion.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - reent structure of current thread/process;
+ * _CONST char *to - output encoding's normalized name;
+ * _CONST char *from - input encoding's normalized name.
+ *
+ * DESCRIPTION:
+ * This function is called from iconv_open() to open conversion. Returns
+ * a pointer to conversion-specific data.
+ *
+ * RETURN:
+ * Pointer to conversion-specific data if success. In case of error
+ * returns NULL and sets current thread's/process's errno.
+ */
+ _VOID_PTR _EXFNPTR(open, (struct _reent *rptr,
+ _CONST char *to,
+ _CONST char *from));
+
+ /*
+ * close - close conversion.
+ *
+ * PARAMETRS:
+ * struct _reent *rptr - reent structure of current thread/process;
+ * _VOID_PTR data - conversion-specific data.
+ *
+ * DESCRIPTION:
+ * This function is called from iconv_close() to close conversion.
+ *
+ * RETURN:
+ * When successful, returns (size_t)0. In case of error, sets current
+ * thread's/process's errno and returns (size_t)-1 (same as iconv_open()).
+ */
+ size_t _EXFNPTR(close, (struct _reent *rptr,
+ _VOID_PTR data));
+
+ /* convert - perform encoding conversion.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - reent structure of current thread/process.
+ * _VOID_PTR data - conversion-specific data;
+ * _CONST unsigned char **inbuf - input data buffer;
+ * size_t *inbytesleft - input buffer's length;
+ * unsigned char **outbuf - output data buffer;
+ * size_t *outbytesleft - output buffer free space;
+ * int flags - conversion options.
+ *
+ * DESCRIPTION:
+ * This function is called from iconv() to perform conversion and, if 'flags'
+ * is 0, behaves similarly to iconv(). 'inbuf', 'inbytesleft', 'outbuf' and
+ * 'outbytesleft' are same as in case of iconv() function.
+ *
+ * When flags & 1 isn't 0, 'outbuf' value is ignored and result isn't saved.
+ * Another conversion aspects aren't changed.
+ *
+ * When flags & 2 isn't 0, function changes it's behavior in situations,
+ * when there is no character in "to" encoding that corresponds to valid
+ * character from "from" encoding. iconv() specification stands to perform
+ * implimentation-spacific default conversion. If flag & 2 isn't 0,
+ * function generates error.
+ *
+ * RETURN:
+ * Returns the number of characters converted in a non-reversible way.
+ * Reversible conversions are not counted. In case of error, sets current
+ * thread's/process's errno and returns (size_t)-1 (same as iconv()).
+ */
+ size_t _EXFNPTR(convert, (struct _reent *rptr,
+ _VOID_PTR data,
+ _CONST unsigned char **inbuf,
+ size_t *inbytesleft,
+ unsigned char **outbuf,
+ size_t *outbytesleft,
+ int flags));
+
+ /*
+ * get_state - get current shift state.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - conversion-specific data;
+ * mbstate_t *state - mbstate_t object where shift state will be written;
+ * int direction - 0-"from", 1-"to".
+ *
+ * DESCRIPTION:
+ * Returns encoding's current shift sequence.
+ * If 'direction' is 0, "from" encoding is tested, else
+ * "to" encoding is tested.
+ */
+ _VOID _EXFNPTR(get_state, (_VOID_PTR data,
+ mbstate_t *state,
+ int direction));
+
+ /*
+ * set_state - set shift state.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - conversion-specific data;
+ * mbstate_t *state - mbstate_t object to which shift state will be set.
+ * int direction - 0-"from", 1-"to".
+ *
+ * DESCRIPTION:
+ * Sets encoding's current shift state to 'state'. if 'state'
+ * object is zero-object - reset current shift state.
+ * If 'direction' is 0, "from" encoding is set, else
+ * "to" encoding is set.
+ * Returns 0 if '*state' object has right format, -1 else.
+ */
+ int _EXFNPTR(set_state, (_VOID_PTR data,
+ mbstate_t *state,
+ int direction));
+
+ /*
+ * get_mb_cur_max - get maximum character length in bytes.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - conversion-specific data;
+ * int direction - 0-"from", 1-"to".
+ *
+ * DESCRIPTION:
+ * Returns encoding's maximum character length.
+ * If 'direction' is 0, "from" encoding is tested, else
+ * "to" encoding is tested.
+ */
+ int _EXFNPTR(get_mb_cur_max, (_VOID_PTR data,
+ int direction));
+
+ /*
+ * is_stateful - is encoding stateful or stateless.
+ *
+ * PARAMETERS:
+ * _VOID_PTR data - conversion-specific data;
+ * int direction - 0-"from", 1-"to".
+ *
+ * DESCRIPTION:
+ * Returns 0 if encoding is stateless and 1 if stateful.
+ * If 'direction' is 0, "from" encoding is tested, else
+ * "to" encoding is tested.
+ */
+ int _EXFNPTR(is_stateful, (_VOID_PTR data,
+ int direction));
+
+} iconv_conversion_handlers_t;
+
+
+/*
+ * iconv_conversion_t - iconv conversion definition structure.
+ *
+ * ============================================================================
+ */
+typedef struct
+{
+ /* Iconv conversion handlers. */
+ _CONST iconv_conversion_handlers_t *handlers;
+
+ /*
+ * Conversion-specific data (e.g., points to iconv_ucs_conversion_t
+ * object if UCS-based conversion is used).
+ */
+ _VOID_PTR data;
+} iconv_conversion_t;
+
+
+/* UCS-based conversion handlers */
+extern _CONST iconv_conversion_handlers_t
+_iconv_ucs_conversion_handlers;
+
+/* Null conversion handlers */
+extern _CONST iconv_conversion_handlers_t
+_iconv_null_conversion_handlers;
+
+#endif /* !__ICONV_CONVERSION_H__ */
+
conv.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: iconvnls.c
===================================================================
--- iconvnls.c (nonexistent)
+++ iconvnls.c (revision 345)
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 2003-2004, Artem B. Bityuckiy
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
+ */
+#include <_ansi.h>
+#include
+#include
+#include
+#include
+#include
+#include
+#ifdef _MB_CAPABLE
+#include
+#include
+#include
+#include
+#include
+#include "local.h"
+#include "conv.h"
+#include "ucsconv.h"
+#include "iconvnls.h"
+#endif
+
+/*
+ * _iconv_nls_construct_filename -- constructs full file name.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - reent structure of current thread/process.
+ * _CONST char *file - the name of file.
+ * _CONST char *dir - the name of subdirectory;
+ * _CONST char *ext - file extension.
+ *
+ * DESCRIPTION:
+ * Function constructs patch to icionv-related file.
+ * 'file' shouldn't be NULL. Doesn't use extension if 'ext' is NULL.
+ *
+ * RETURN:
+ * The pointer to file name if success, In case of error returns NULL
+ * and sets current thread's/process's errno.
+ */
+_CONST char *
+_DEFUN(_iconv_nls_construct_filename, (rptr, file, ext),
+ struct _reent *rptr _AND
+ _CONST char *file _AND
+ _CONST char *dir _AND
+ _CONST char *ext)
+{
+ int len1, len2, len3;
+ char *path;
+ char *p;
+ int dirlen = strlen (dir);
+
+ if ((path = _getenv_r (rptr, NLS_ENVVAR_NAME)) == NULL || *path == '\0')
+ path = ICONV_DEFAULT_NLSPATH;
+
+ len1 = strlen (path);
+ len2 = strlen (file);
+ len3 = strlen (ext);
+
+ if ((p = _malloc_r (rptr, len1 + dirlen + len2 + len3 + 3)) == NULL)
+ return (_CONST char *)NULL;
+
+ memcpy (p, path, len1);
+ if (p[len1 - 1] != '/')
+ p[len1++] = '/';
+ memcpy (p + len1, dir, dirlen);
+ len1 += dirlen;
+ p[len1++] = '/';
+ memcpy (p + len1, file, len2);
+ len1 += len2;
+ if (ext != NULL)
+ {
+ memcpy (p + len1, ext, len3);
+ len1 += len3;
+ }
+ p[len1] = '\0';
+
+ return (_CONST char *)p;
+}
+
+
+#ifdef _MB_CAPABLE
+/*
+ * _iconv_nls_get_mb_cur_max -- return encoding's maximum length
+ * of a multi-byte character.
+ *
+ * PARAMETERS:
+ * iconv_t cd - opened iconv conversion descriptor;
+ * int direction - "from encoding" or "to encoding" direction.
+ *
+ * DESCRIPTION:
+ * Return maximum length of a multi-byte character in one of 'cd's
+ * encoding. Return "from" encoding's value if 'direction' is 0 and
+ * "to" encoding's value if 'direction' isn't 0.
+ */
+int
+_DEFUN(_iconv_nls_get_mb_cur_max, (cd, direction),
+ iconv_t cd _AND
+ int direction)
+{
+ iconv_conversion_t *ic = (iconv_conversion_t *)cd;
+
+ return ic->handlers->get_mb_cur_max (ic->data, direction);
+}
+
+/*
+ * _iconv_nls_is_stateful -- is encoding stateful?
+ *
+ * PARAMETERS:
+ * iconv_t cd - opened iconv conversion descriptor;
+ * int direction - "from encoding" or "to encoding" direction.
+ *
+ * DESCRIPTION:
+ * Returns 0 if encoding is stateless or 1 if stateful.
+ * Tests "from" encoding if 'direction' is 0 and
+ * "to" encoding's value if 'direction' isn't 0.
+
+ */
+int
+_DEFUN(_iconv_nls_is_stateful, (cd, direction),
+ iconv_t cd _AND
+ int direction)
+{
+ iconv_conversion_t *ic = (iconv_conversion_t *)cd;
+
+ return ic->handlers->is_stateful (ic->data, direction);
+}
+
+/*
+ * _iconv_nls_conv - special version of iconv for NLS.
+ *
+ * PARAMETERS:
+ * Same as _iconv_r.
+ *
+ * DESCRIPTION:
+ * Function behaves as _iconv_r but:
+ * 1. Don't handle reset/return shift states queries
+ * (like iconv does when 'inbuf' == NULL, etc);
+ * 2. Don't save result if 'outbuf' == NULL or
+ * '*outbuf' == NULL;
+ * 3. Don't perform default conversion if there is no character
+ * in "to" encoding that corresponds to character from "from"
+ * encoding.
+ *
+ * RETURN:
+ * Same as _iconv_r.
+ */
+size_t
+_DEFUN(_iconv_nls_conv, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft),
+ struct _reent *rptr _AND
+ iconv_t cd _AND
+ _CONST char **inbuf _AND
+ size_t *inbytesleft _AND
+ char **outbuf _AND
+ size_t *outbytesleft)
+{
+ iconv_conversion_t *ic = (iconv_conversion_t *)cd;
+ int flags = ICONV_FAIL_BIT;
+
+ if ((_VOID_PTR)cd == NULL || cd == (iconv_t)-1 || ic->data == NULL
+ || (ic->handlers != &_iconv_null_conversion_handlers
+ && ic->handlers != &_iconv_ucs_conversion_handlers))
+ {
+ __errno_r (rptr) = EBADF;
+ return (size_t)-1;
+ }
+
+ if (inbytesleft == NULL || *inbytesleft == 0)
+ return (size_t)0;
+
+ if (outbuf == NULL || *outbuf == NULL)
+ flags |= ICONV_DONT_SAVE_BIT;
+
+ if (outbytesleft == NULL || *outbytesleft == 0)
+ {
+ __errno_r (rptr) = E2BIG;
+ return (size_t)-1;
+ }
+
+ return ic->handlers->convert (rptr,
+ ic->data,
+ (_CONST unsigned char**)inbuf,
+ inbytesleft,
+ (unsigned char**)outbuf,
+ outbytesleft,
+ flags);
+}
+
+/*
+ * _iconv_nls_get_state -- get encoding's current shift state value.
+ *
+ * PARAMETERS:
+ * iconv_t cd - iconv descriptor;
+ * mbstate_t *ps - where to save shift state;
+ * int direction - "from" encoding if 0, "to" encoding if 1.
+ *
+ * DESCRIPTION:
+ * Save encoding's current shift state to 'ps'. Save "from" encoding's
+ * shift state if 'direction' is 0 and "to" encodings's shift state
+ * if 'direction' isn't 0.
+ */
+_VOID
+_DEFUN(_iconv_nls_get_state, (cd, ps, direction),
+ iconv_t cd _AND
+ mbstate_t *ps _AND
+ int direction)
+{
+ iconv_conversion_t *ic = (iconv_conversion_t *)cd;
+
+ ic->handlers->get_state (ic->data, ps, direction);
+
+ return;
+}
+
+/*
+ * _iconv_nls_set_state -- set encoding's current shift state value.
+ *
+ * PARAMETERS:
+ * iconv_t cd - iconv descriptor;
+ * mbstate_t *ps - where to save shift state.
+ * int direction - "from" encoding if 0, "to" encoding if 1.
+ *
+ * DESCRIPTION:
+ * Set encoding's current shift state.
+ *
+ * RETURN:
+ * 0 if success, -1 if failure.
+ */
+int
+_DEFUN(_iconv_nls_set_state, (cd, ps, direction),
+ iconv_t cd _AND
+ mbstate_t *ps _AND
+ int direction)
+{
+ iconv_conversion_t *ic = (iconv_conversion_t *)cd;
+
+ return ic->handlers->set_state (ic->data, ps, direction);
+}
+
+/* Same as iconv_open() but don't perform name resolving */
+static iconv_t
+_DEFUN(iconv_open1, (rptr, to, from),
+ struct _reent *rptr _AND
+ _CONST char *to _AND
+ _CONST char *from)
+{
+ iconv_conversion_t *ic;
+
+ if (to == NULL || from == NULL || *to == '\0' || *from == '\0')
+ return (iconv_t)-1;
+
+ ic = (iconv_conversion_t *)_malloc_r (rptr, sizeof (iconv_conversion_t));
+ if (ic == NULL)
+ return (iconv_t)-1;
+
+ /* Select which conversion type to use */
+ if (strcmp (from, to) == 0)
+ {
+ /* Use null conversion */
+ ic->handlers = &_iconv_null_conversion_handlers;
+ ic->data = ic->handlers->open (rptr, to, from);
+ }
+ else
+ {
+ /* Use UCS-based conversion */
+ ic->handlers = &_iconv_ucs_conversion_handlers;
+ ic->data = ic->handlers->open (rptr, to, from);
+ }
+
+ if (ic->data == NULL)
+ {
+ _free_r (rptr, (_VOID_PTR)ic);
+ return (iconv_t)-1;
+ }
+
+ return (_VOID_PTR)ic;
+}
+
+/*
+ * _iconv_nls_open - open iconv descriptors for NLS.
+ *
+ * PARAMETERS:
+ * struct _reent *rptr - process's reent structure;
+ * _CONST char *encoding - encoding name;
+ * iconv_t *tomb - wchar -> encoding iconv descriptor pointer;
+ * iconv_t *towc - encoding -> wchar iconv descriptor pointer;
+ * int flag - perform encoding name resolving flag.
+ *
+ * DESCRIPTION:
+ * Opens two iconv descriptors for 'encoding' -> wchar and
+ * wchar -> 'encoding' iconv conversions. Function is used when locale or
+ * wide-oriented stream is opened. If 'flag' is 0, don't perform encoding
+ * name resolving ('encoding' must not be alias in this case).
+ *
+ * RETURN:
+ * If successful - return 0, else set errno and return -1.
+ */
+int
+_DEFUN(_iconv_nls_open, (rptr, encoding, towc, tomb),
+ struct _reent *rptr _AND
+ _CONST char *encoding _AND
+ iconv_t *tomb _AND
+ iconv_t *towc _AND
+ int flag)
+{
+ _CONST char *wchar_encoding;
+
+ if (sizeof (wchar_t) > 2 && WCHAR_MAX > 0xFFFF)
+ wchar_encoding = "ucs_4_internal";
+ else if (sizeof (wchar_t) > 1 && WCHAR_MAX > 0xFF)
+ wchar_encoding = "ucs_2_internal";
+ else
+ wchar_encoding = ""; /* This shuldn't happen */
+
+ if (flag)
+ {
+ if ((*towc = _iconv_open_r (rptr, wchar_encoding, encoding)) == (iconv_t)-1)
+ return -1;
+
+ if ((*tomb = _iconv_open_r (rptr, encoding, wchar_encoding)) == (iconv_t)-1)
+ {
+ _iconv_close_r (rptr, *towc);
+ return -1;
+ }
+ }
+ else
+ {
+ if ((*towc = iconv_open1 (rptr, wchar_encoding, encoding)) == (iconv_t)-1)
+ return -1;
+
+ if ((*tomb = iconv_open1 (rptr, encoding, wchar_encoding)) == (iconv_t)-1)
+ {
+ _iconv_close_r (rptr, *towc);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+#endif /* _MB_CAPABLE */
+
iconvnls.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: aliasesbi.c
===================================================================
--- aliasesbi.c (nonexistent)
+++ aliasesbi.c (revision 345)
@@ -0,0 +1,213 @@
+/*
+ * This file was automatically generated mkdeps.pl script. Don't edit.
+ */
+
+#include <_ansi.h>
+#include "encnames.h"
+
+_CONST char *
+_iconv_aliases =
+{
+#if defined (_ICONV_FROM_ENCODING_BIG5) \
+ || defined (_ICONV_TO_ENCODING_BIG5)
+ ICONV_ENCODING_BIG5 " csbig5 big_five bigfive cn_big5 cp950\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_CP775) \
+ || defined (_ICONV_TO_ENCODING_CP775)
+ ICONV_ENCODING_CP775 " ibm775 cspc775baltic\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_CP850) \
+ || defined (_ICONV_TO_ENCODING_CP850)
+ ICONV_ENCODING_CP850 " ibm850 850 cspc850multilingual\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_CP852) \
+ || defined (_ICONV_TO_ENCODING_CP852)
+ ICONV_ENCODING_CP852 " ibm852 852 cspcp852\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_CP855) \
+ || defined (_ICONV_TO_ENCODING_CP855)
+ ICONV_ENCODING_CP855 " ibm855 855 csibm855\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_CP866) \
+ || defined (_ICONV_TO_ENCODING_CP866)
+ ICONV_ENCODING_CP866 " 866 IBM866 CSIBM866\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_EUC_JP) \
+ || defined (_ICONV_TO_ENCODING_EUC_JP)
+ ICONV_ENCODING_EUC_JP " eucjp\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_EUC_KR) \
+ || defined (_ICONV_TO_ENCODING_EUC_KR)
+ ICONV_ENCODING_EUC_KR " euckr\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_EUC_TW) \
+ || defined (_ICONV_TO_ENCODING_EUC_TW)
+ ICONV_ENCODING_EUC_TW " euctw\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_1) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_1)
+ ICONV_ENCODING_ISO_8859_1 " iso8859_1 iso88591 iso_8859_1:1987 iso_ir_100 latin1 l1 ibm819 cp819 csisolatin1\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_10) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_10)
+ ICONV_ENCODING_ISO_8859_10 " iso_8859_10:1992 iso_ir_157 iso885910 latin6 l6 csisolatin6 iso8859_10\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_11) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_11)
+ ICONV_ENCODING_ISO_8859_11 " iso8859_11 iso885911\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_13) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_13)
+ ICONV_ENCODING_ISO_8859_13 " iso_8859_13:1998 iso8859_13 iso885913\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_14) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_14)
+ ICONV_ENCODING_ISO_8859_14 " iso_8859_14:1998 iso885914 iso8859_14\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_15) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_15)
+ ICONV_ENCODING_ISO_8859_15 " iso885915 iso_8859_15:1998 iso8859_15 \n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_2) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_2)
+ ICONV_ENCODING_ISO_8859_2 " iso8859_2 iso88592 iso_8859_2:1987 iso_ir_101 latin2 l2 csisolatin2\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_3) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_3)
+ ICONV_ENCODING_ISO_8859_3 " iso_8859_3:1988 iso_ir_109 iso8859_3 latin3 l3 csisolatin3 iso88593\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_4) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_4)
+ ICONV_ENCODING_ISO_8859_4 " iso8859_4 iso88594 iso_8859_4:1988 iso_ir_110 latin4 l4 csisolatin4\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_5) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_5)
+ ICONV_ENCODING_ISO_8859_5 " iso8859_5 iso88595 iso_8859_5:1988 iso_ir_144 cyrillic csisolatincyrillic\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_6) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_6)
+ ICONV_ENCODING_ISO_8859_6 " iso_8859_6:1987 iso_ir_127 iso8859_6 ecma_114 asmo_708 arabic csisolatinarabic iso88596\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_7) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_7)
+ ICONV_ENCODING_ISO_8859_7 " iso_8859_7:1987 iso_ir_126 iso8859_7 elot_928 ecma_118 greek greek8 csisolatingreek iso88597\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_8) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_8)
+ ICONV_ENCODING_ISO_8859_8 " iso_8859_8:1988 iso_ir_138 iso8859_8 hebrew csisolatinhebrew iso88598\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_8859_9) \
+ || defined (_ICONV_TO_ENCODING_ISO_8859_9)
+ ICONV_ENCODING_ISO_8859_9 " iso_8859_9:1989 iso_ir_148 iso8859_9 latin5 l5 csisolatin5 iso88599\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_ISO_IR_111) \
+ || defined (_ICONV_TO_ENCODING_ISO_IR_111)
+ ICONV_ENCODING_ISO_IR_111 " ecma_cyrillic koi8_e koi8e csiso111ecmacyrillic\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_KOI8_R) \
+ || defined (_ICONV_TO_ENCODING_KOI8_R)
+ ICONV_ENCODING_KOI8_R " cskoi8r koi8r koi8\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_KOI8_RU) \
+ || defined (_ICONV_TO_ENCODING_KOI8_RU)
+ ICONV_ENCODING_KOI8_RU " koi8ru\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_KOI8_U) \
+ || defined (_ICONV_TO_ENCODING_KOI8_U)
+ ICONV_ENCODING_KOI8_U " koi8u\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_KOI8_UNI) \
+ || defined (_ICONV_TO_ENCODING_KOI8_UNI)
+ ICONV_ENCODING_KOI8_UNI " koi8uni\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UCS_2) \
+ || defined (_ICONV_TO_ENCODING_UCS_2)
+ ICONV_ENCODING_UCS_2 " ucs2 iso_10646_ucs_2 iso10646_ucs_2 iso_10646_ucs2 iso10646_ucs2 iso10646ucs2 csUnicode\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UCS_2_INTERNAL) \
+ || defined (_ICONV_TO_ENCODING_UCS_2_INTERNAL)
+ ICONV_ENCODING_UCS_2_INTERNAL " ucs2_internal ucs_2internal ucs2internal\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UCS_2BE) \
+ || defined (_ICONV_TO_ENCODING_UCS_2BE)
+ ICONV_ENCODING_UCS_2BE " ucs2be\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UCS_2LE) \
+ || defined (_ICONV_TO_ENCODING_UCS_2LE)
+ ICONV_ENCODING_UCS_2LE " ucs2le\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UCS_4) \
+ || defined (_ICONV_TO_ENCODING_UCS_4)
+ ICONV_ENCODING_UCS_4 " ucs4 iso_10646_ucs_4 iso10646_ucs_4 iso_10646_ucs4 iso10646_ucs4 iso10646ucs4\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UCS_4_INTERNAL) \
+ || defined (_ICONV_TO_ENCODING_UCS_4_INTERNAL)
+ ICONV_ENCODING_UCS_4_INTERNAL " ucs4_internal ucs_4internal ucs4internal\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UCS_4BE) \
+ || defined (_ICONV_TO_ENCODING_UCS_4BE)
+ ICONV_ENCODING_UCS_4BE " ucs4be\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UCS_4LE) \
+ || defined (_ICONV_TO_ENCODING_UCS_4LE)
+ ICONV_ENCODING_UCS_4LE " ucs4le\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_US_ASCII) \
+ || defined (_ICONV_TO_ENCODING_US_ASCII)
+ ICONV_ENCODING_US_ASCII " ansi_x3.4_1968 ansi_x3.4_1986 iso_646.irv:1991 ascii iso646_us us ibm367 cp367 csascii \n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UTF_16) \
+ || defined (_ICONV_TO_ENCODING_UTF_16)
+ ICONV_ENCODING_UTF_16 " utf16\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UTF_16BE) \
+ || defined (_ICONV_TO_ENCODING_UTF_16BE)
+ ICONV_ENCODING_UTF_16BE " utf16be\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UTF_16LE) \
+ || defined (_ICONV_TO_ENCODING_UTF_16LE)
+ ICONV_ENCODING_UTF_16LE " utf16le\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_UTF_8) \
+ || defined (_ICONV_TO_ENCODING_UTF_8)
+ ICONV_ENCODING_UTF_8 " utf8\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_WIN_1250) \
+ || defined (_ICONV_TO_ENCODING_WIN_1250)
+ ICONV_ENCODING_WIN_1250 " cp1250\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_WIN_1251) \
+ || defined (_ICONV_TO_ENCODING_WIN_1251)
+ ICONV_ENCODING_WIN_1251 " cp1251\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_WIN_1252) \
+ || defined (_ICONV_TO_ENCODING_WIN_1252)
+ ICONV_ENCODING_WIN_1252 " cp1252\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_WIN_1253) \
+ || defined (_ICONV_TO_ENCODING_WIN_1253)
+ ICONV_ENCODING_WIN_1253 " cp1253\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_WIN_1254) \
+ || defined (_ICONV_TO_ENCODING_WIN_1254)
+ ICONV_ENCODING_WIN_1254 " cp1254\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_WIN_1255) \
+ || defined (_ICONV_TO_ENCODING_WIN_1255)
+ ICONV_ENCODING_WIN_1255 " cp1255\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_WIN_1256) \
+ || defined (_ICONV_TO_ENCODING_WIN_1256)
+ ICONV_ENCODING_WIN_1256 " cp1256\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_WIN_1257) \
+ || defined (_ICONV_TO_ENCODING_WIN_1257)
+ ICONV_ENCODING_WIN_1257 " cp1257\n"
+#endif
+#if defined (_ICONV_FROM_ENCODING_WIN_1258) \
+ || defined (_ICONV_TO_ENCODING_WIN_1258)
+ ICONV_ENCODING_WIN_1258 " cp1258\n"
+#endif
+ ""
+};
+
aliasesbi.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property