diff options
Diffstat (limited to 'newlib/libc/iconv/lib')
-rw-r--r-- | newlib/libc/iconv/lib/Makefile.am | 50 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/Makefile.in | 364 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/aliasesbi.c | 213 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/aliasesi.c | 212 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/conv.h | 221 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/encnames.h | 63 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/encoding.deps | 441 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/endian.h | 73 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/iconv.c | 348 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/iconvnls.c | 362 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/iconvnls.h | 37 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/local.h | 65 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/nullconv.c | 143 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/ucsconv.c | 356 | ||||
-rw-r--r-- | newlib/libc/iconv/lib/ucsconv.h | 327 |
15 files changed, 0 insertions, 3275 deletions
diff --git a/newlib/libc/iconv/lib/Makefile.am b/newlib/libc/iconv/lib/Makefile.am deleted file mode 100644 index e138ddd0e..000000000 --- a/newlib/libc/iconv/lib/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -## 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 -LIB_OBJS = -else -LIB_OBJS = \ -aliasesi.$(oext) \ -ucsconv.$(oext) \ -nullconv.$(oext) \ -iconv.$(oext) \ -aliasesbi.$(oext) \ -iconvnls.$(oext) -endif - -noinst_LIBRARIES = lib.a -lib_a_SOURCES = $(GENERAL_SOURCES) -lib_a_LIBADD = $(LIB_OBJS) -lib_a_DEPENDENCIES = $(LIB_OBJS) -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 - diff --git a/newlib/libc/iconv/lib/Makefile.in b/newlib/libc/iconv/lib/Makefile.in deleted file mode 100644 index 7b9d5979d..000000000 --- a/newlib/libc/iconv/lib/Makefile.in +++ /dev/null @@ -1,364 +0,0 @@ -# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999, 2001 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. - - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = ../.. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -AR = @AR@ -AS = @AS@ -CC = @CC@ -CPP = @CPP@ -CRT0 = @CRT0@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -DLLTOOL = @DLLTOOL@ -EXEEXT = @EXEEXT@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ -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_SYSCALL_LIB = @LIBC_SYSCALL_LIB@ -LIBC_SYS_LIB = @LIBC_SYS_LIB@ -LIBC_UNIX_LIB = @LIBC_UNIX_LIB@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -VERSION = @VERSION@ -aext = @aext@ -extra_dir = @extra_dir@ -libm_machine_dir = @libm_machine_dir@ -machine_dir = @machine_dir@ -newlib_basedir = @newlib_basedir@ -oext = @oext@ -sys_dir = @sys_dir@ - -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_TRUE@LIB_OBJS = -@ELIX_LEVEL_1_FALSE@LIB_OBJS = aliasesi.$(oext) ucsconv.$(oext) nullconv.$(oext) iconv.$(oext) aliasesbi.$(oext) iconvnls.$(oext) - -noinst_LIBRARIES = lib.a -lib_a_SOURCES = $(GENERAL_SOURCES) -lib_a_LIBADD = $(LIB_OBJS) -lib_a_DEPENDENCIES = $(LIB_OBJS) -noinst_DATA = - -CHEWOUT_FILES = iconv.def - -SUFFIXES = .def - -CHEW = ../../../doc/makedoc -f $(srcdir)/../../../doc/doc.str - -CLEANFILES = $(CHEWOUT_FILES) *.ref -mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ -lib_a_OBJECTS = aliasesi.$(OBJEXT) ucsconv.$(OBJEXT) nullconv.$(OBJEXT) \ -iconv.$(OBJEXT) aliasesbi.$(OBJEXT) iconvnls.$(OBJEXT) -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DATA = $(noinst_DATA) - -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -SOURCES = $(lib_a_SOURCES) -OBJECTS = $(lib_a_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .def .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../../Makefile.shared - cd $(top_srcdir) && $(AUTOMAKE) --cygnus iconv/lib/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -rm -f *.$(OBJEXT) - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -maintainer-clean-libtool: - -lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) - -rm -f lib.a - $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) - $(RANLIB) lib.a - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = iconv/lib - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: -check: check-am -installcheck-am: -installcheck: installcheck-am -install-info-am: -install-info: install-info-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) $(DATA) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-libtool mostlyclean-tags \ - mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-noinstLIBRARIES clean-compile clean-libtool clean-tags \ - clean-generic mostlyclean-am - -clean: clean-am - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-libtool distclean-tags distclean-generic \ - clean-am - -rm -f libtool - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-info-am \ -install-info install-exec-am install-exec install-data-am install-data \ -install-am install uninstall-am uninstall all-redirect all-am all \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean - - -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: diff --git a/newlib/libc/iconv/lib/aliasesbi.c b/newlib/libc/iconv/lib/aliasesbi.c deleted file mode 100644 index 36c434e16..000000000 --- a/newlib/libc/iconv/lib/aliasesbi.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * 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 - "" -}; - diff --git a/newlib/libc/iconv/lib/aliasesi.c b/newlib/libc/iconv/lib/aliasesi.c deleted file mode 100644 index f94ac8fb9..000000000 --- a/newlib/libc/iconv/lib/aliasesi.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * 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 <reent.h> -#include <newlib.h> -#include <sys/types.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#include <ctype.h> -#include <sys/iconvnls.h> -#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; -} - diff --git a/newlib/libc/iconv/lib/conv.h b/newlib/libc/iconv/lib/conv.h deleted file mode 100644 index 03c7c119d..000000000 --- a/newlib/libc/iconv/lib/conv.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - * 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 <reent.h> -#include <sys/types.h> -#include <wchar.h> - -/* 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 _EXPARM(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 _EXPARM(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 _EXPARM(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 _EXPARM(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 _EXPARM(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 _EXPARM(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 _EXPARM(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__ */ - diff --git a/newlib/libc/iconv/lib/encnames.h b/newlib/libc/iconv/lib/encnames.h deleted file mode 100644 index 9ca16adfb..000000000 --- a/newlib/libc/iconv/lib/encnames.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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__ */ - diff --git a/newlib/libc/iconv/lib/encoding.deps b/newlib/libc/iconv/lib/encoding.deps deleted file mode 100644 index 280cffd10..000000000 --- a/newlib/libc/iconv/lib/encoding.deps +++ /dev/null @@ -1,441 +0,0 @@ -# -# 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 - diff --git a/newlib/libc/iconv/lib/endian.h b/newlib/libc/iconv/lib/endian.h deleted file mode 100644 index 2db6c6df9..000000000 --- a/newlib/libc/iconv/lib/endian.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 <sys/param.h> - -#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__ */ - diff --git a/newlib/libc/iconv/lib/iconv.c b/newlib/libc/iconv/lib/iconv.c deleted file mode 100644 index ee7124b41..000000000 --- a/newlib/libc/iconv/lib/iconv.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * 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 -<<iconv>>, <<iconv_open>>, <<iconv_close>>---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.h> - iconv_t iconv_open (const char *<[to]>, const char *<[from]>); - int iconv_close (iconv_t <[cd]>); - size_t iconv (iconv_t <[cd]>, const 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 <iconv.h> - size_t iconv (<[cd]>, <[in]>, <[inleft]>, <[out]>, <[outleft]>) - iconv_t <[cd]>; - const char **<[in]>; - size_t *<[inleft]>; - char **<[out]>; - size_t *<[outleft]>); - - #include <iconv.h> - iconv_t iconv_open (<[to]>, <[from]>); - const char *<[to]>; - const char *<[from]>; - - #include <iconv.h> - int iconv_close (<[cd]>); - iconv_t <[cd]>; - - #include <iconv.h> - 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.h> - iconv_t _iconv_open_r (<[rptr]>, <[to]>, <[from]>); - struct _reent *<[rptr]>; - const char *<[to]>; - const char *<[from]>; - - #include <iconv.h> - int iconv_close (<[rptr]>, <[cd]>); - struct _reent *<[rptr]>; - iconv_t <[cd]>; - -DESCRIPTION -The function <<iconv>> 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 <<iconv_open>>. - -An <<iconv>> 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 <<iconv_open>> 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 <<iconv>>. - -The function <<iconv_close>> 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 <<iconv>>, <<iconv_open>>, and <<iconv_close>>, -respectively. An additional reentrancy struct pointer: <[rptr]> is passed -to properly set <<errno>>. - -RETURNS -The <<iconv>> function returns the number of non-identical conversions -performed. If an error occurs, (size_t)-1 is returned and <<errno>> -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 <<iconv_open>> function returns either a valid conversion specifier -or (iconv_t)-1 to indicate failure. If failure occurs, <<errno>> is set -appropriately. - -The <<iconv_close>> function returns 0 on success or -1 on failure. -If failure occurs <<errno>> is set appropriately. - -PORTABILITY -<<iconv>>, <<iconv_open>>, and <<iconv_close>> are non-ANSI and are specified -by the Single Unix specification. - -No supporting OS subroutine calls are required. -*/ -#include <_ansi.h> -#include <reent.h> -#include <sys/types.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <iconv.h> -#include <wchar.h> -#include <sys/iconvnls.h> -#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 - _CONST char **inbuf _AND - size_t *inbytesleft _AND - char **outbuf _AND - size_t *outbytesleft) -{ - return _iconv_r (_REENT, cd, 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 */ diff --git a/newlib/libc/iconv/lib/iconvnls.c b/newlib/libc/iconv/lib/iconvnls.c deleted file mode 100644 index 1b42f2c7b..000000000 --- a/newlib/libc/iconv/lib/iconvnls.c +++ /dev/null @@ -1,362 +0,0 @@ -/* - * 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 <reent.h> -#include <newlib.h> -#include <sys/types.h> -#include <string.h> -#include <stdlib.h> -#include <sys/iconvnls.h> -#ifdef _MB_CAPABLE -#include <wchar.h> -#include <iconv.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#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 */ - diff --git a/newlib/libc/iconv/lib/iconvnls.h b/newlib/libc/iconv/lib/iconvnls.h deleted file mode 100644 index f6d4866a8..000000000 --- a/newlib/libc/iconv/lib/iconvnls.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __ICONV_ICONVNLS_H__ -#define __ICONV_ICONVNLS_H__ - -#include <newlib.h> - -/* - * 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__ */ - diff --git a/newlib/libc/iconv/lib/local.h b/newlib/libc/iconv/lib/local.h deleted file mode 100644 index 85f22634c..000000000 --- a/newlib/libc/iconv/lib/local.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 <reent.h> -#include <sys/types.h> -#include <limits.h> - -/* 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 */ -#define ICONV_ZERO_MB_STATE_T ((mbstate_t){0, {0}}) - -/* 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__ */ - diff --git a/newlib/libc/iconv/lib/nullconv.c b/newlib/libc/iconv/lib/nullconv.c deleted file mode 100644 index d35027f9c..000000000 --- a/newlib/libc/iconv/lib/nullconv.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 <reent.h> -#include <sys/types.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#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 -}; - diff --git a/newlib/libc/iconv/lib/ucsconv.c b/newlib/libc/iconv/lib/ucsconv.c deleted file mode 100644 index 4dab2e19d..000000000 --- a/newlib/libc/iconv/lib/ucsconv.c +++ /dev/null @@ -1,356 +0,0 @@ -/* - * 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 <reent.h> -#include <sys/types.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#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; - - if (direction == 0) - { - if (uc->to_ucs.handlers->get_state != NULL) - uc->to_ucs.handlers->get_state (uc->to_ucs.data, state); - else - *state = ICONV_ZERO_MB_STATE_T; - } - else - { - if (uc->from_ucs.handlers->get_state != NULL) - uc->from_ucs.handlers->get_state (uc->from_ucs.data, state); - else - *state = ICONV_ZERO_MB_STATE_T; - } - - 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; -} - diff --git a/newlib/libc/iconv/lib/ucsconv.h b/newlib/libc/iconv/lib/ucsconv.h deleted file mode 100644 index 3c39f39d3..000000000 --- a/newlib/libc/iconv/lib/ucsconv.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - * 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 <reent.h> -#include <sys/types.h> -#include <wchar.h> -#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 _EXPARM(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 _EXPARM(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 _EXPARM(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 _EXPARM(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 _EXPARM(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 _EXPARM(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 _EXPARM(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 _EXPARM(init, (struct _reent *rptr, - _CONST char *encoding)); - - /* Same as in iconv_to_ucs_ces_handlers_t */ - size_t _EXPARM(close, (struct _reent *rptr, - _VOID_PTR data)); - - /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXPARM(get_mb_cur_max, (_VOID_PTR data)); - - /* Same as in iconv_to_ucs_ces_handlers_t */ - _VOID _EXPARM(get_state, (_VOID_PTR data, - mbstate_t *state)); - - /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXPARM(set_state, (_VOID_PTR data, - mbstate_t *state)); - - /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXPARM(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 _EXPARM(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__ */ - |