diff --git a/3rdparty/libiconv/1.15/lib/Makefile.in b/3rdparty/libiconv/1.15/lib/Makefile.in new file mode 100644 index 0000000000..9871a3c0b1 --- /dev/null +++ b/3rdparty/libiconv/1.15/lib/Makefile.in @@ -0,0 +1,372 @@ +# Makefile for libiconv/lib + +#### Start of system configuration section. #### + +# Directories used by "make": +srcdir = @srcdir@ + +# Directories used by "make install": +prefix = @prefix@ +local_prefix = /usr/local +exec_prefix = @exec_prefix@ +libdir = @libdir@ + +# Programs used by "make": +CC = @CC@ +CFLAGS = @CFLAGS@ @CFLAG_VISIBILITY@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ $(LDFLAGS_@WOE32DLL@) +LDFLAGS_yes = -Wl,--export-all-symbols +LDFLAGS_no = +INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include -I.. -I$(srcdir)/.. +# -DBUILDING_LIBICONV: Change expansion of LIBICONV_DLL_EXPORTED macro. +# -DBUILDING_DLL: Change expansion of RELOCATABLE_DLL_EXPORTED macro. +DEFS = -DLIBDIR=\"$(libdir)\" -DBUILDING_LIBICONV -DBUILDING_DLL \ +-DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \ +-Dset_relocation_prefix=libiconv_set_relocation_prefix \ +-Drelocate=libiconv_relocate @DEFS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile +LIBTOOL_LINK = $(LIBTOOL) --mode=link +LIBTOOL_INSTALL = $(LIBTOOL) --mode=install +LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall +# Windows resource compiler (windres). Used via libtool. +RC = @RC@ +CP = cp +MV = mv +LN = @LN@ +LN_S = @LN_S@ +RM = rm -f + +# Programs used by "make install": +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +mkinstalldirs = $(SHELL) @top_srcdir@/build-aux/mkinstalldirs + +#### End of system configuration section. #### + +SHELL = /bin/sh + +# Before making a release, change this according to the libtool documentation, +# section "Library interface versions". +LIBICONV_VERSION_INFO = 8:0:6 + +PACKAGE_VERSION = @VERSION@ + +# Needed by $(LIBTOOL). +top_builddir = .. + +SOURCES = $(srcdir)/iconv.c $(srcdir)/../libcharset/lib/localcharset.c $(srcdir)/relocatable.c + +OBJECTS = iconv.lo localcharset.lo relocatable.lo $(OBJECTS_EXP_@WOE32DLL@) $(OBJECTS_RES_@WOE32@) +OBJECTS_EXP_yes = iconv-exports.lo +OBJECTS_EXP_no = +OBJECTS_RES_yes = libiconv.res.lo +OBJECTS_RES_no = + +all : libiconv.la + +libiconv.la : $(OBJECTS) + $(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(CFLAGS) -o libiconv.la -rpath $(libdir) -version-info $(LIBICONV_VERSION_INFO) -no-undefined $(OBJECTS) + +iconv.lo : $(srcdir)/iconv.c $(srcdir)/converters.h \ + $(srcdir)/encodings.def $(srcdir)/encodings_aix.def $(srcdir)/encodings_osf1.def $(srcdir)/encodings_dos.def $(srcdir)/encodings_local.def \ + $(srcdir)/aliases.h $(srcdir)/aliases_sysaix.h $(srcdir)/aliases_syshpux.h $(srcdir)/aliases_sysosf1.h $(srcdir)/aliases_syssolaris.h \ + $(srcdir)/aliases_aix.h $(srcdir)/aliases_aix_sysaix.h \ + $(srcdir)/aliases_osf1.h $(srcdir)/aliases_osf1_sysosf1.h \ + $(srcdir)/aliases_dos.h \ + $(srcdir)/aliases_extra.h \ + $(srcdir)/flags.h $(srcdir)/translit.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c $(srcdir)/iconv.c + +localcharset.lo : $(srcdir)/../libcharset/lib/localcharset.c $(srcdir)/relocatable.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c $(srcdir)/../libcharset/lib/localcharset.c + +relocatable.lo : $(srcdir)/relocatable.c $(srcdir)/relocatable.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c $(srcdir)/relocatable.c + +iconv-exports.lo : $(srcdir)/../woe32dll/iconv-exports.c + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c $(srcdir)/../woe32dll/iconv-exports.c + +libiconv.res.lo : $(srcdir)/../windows/libiconv.rc + $(LIBTOOL_COMPILE) --tag=RC $(RC) `$(SHELL) $(srcdir)/../windows/windres-options --escape $(PACKAGE_VERSION)` -i $(srcdir)/../windows/libiconv.rc -o libiconv.res.lo --output-format=coff + +# Installs the library and include files only. Typically called with only +# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here. +install-lib : all force + if [ ! -d $(libdir) ] ; then $(mkinstalldirs) $(libdir) ; fi + $(LIBTOOL_INSTALL) $(INSTALL) libiconv.la $(libdir)/libiconv.la + +# On AIX, libiconv.a must include the object files of /lib/libiconv.a, +# otherwise the setlocale() call fails when invoked from executables linked +# with -rpath $(libdir), even if linked without -liconv. +install : all force + if [ ! -d $(DESTDIR)$(libdir) ] ; then $(mkinstalldirs) $(DESTDIR)$(libdir) ; fi + $(LIBTOOL_INSTALL) $(INSTALL) libiconv.la $(DESTDIR)$(libdir)/libiconv.la + case "@host_os@" in \ + aix*) (cd $(DESTDIR)$(libdir) && \ + objects=`ar t libiconv.a`" "`ar t /lib/libiconv.a` && \ + ar x libiconv.a && ar x /lib/libiconv.a && \ + ar q libiconv.new.a $$objects && \ + rm -f $$objects && \ + mv -f libiconv.new.a libiconv.a) ;; \ + esac + +install-strip : install + +installdirs : force + if [ ! -d $(DESTDIR)$(libdir) ] ; then $(mkinstalldirs) $(DESTDIR)$(libdir) ; fi + +uninstall : force + $(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libiconv.la + +check : all + +mostlyclean : clean + +clean : force + $(RM) *.o *.lo *.a *.la core *.stackdump so_locations + $(RM) -r .libs _libs + +distclean : clean + $(RM) Makefile config.h + +maintainer-clean : distclean + +# List of source files. +SOURCE_FILES = \ + Makefile.in config.h.in \ + encodings.def \ + encodings_aix.def \ + encodings_osf1.def \ + encodings_dos.def \ + encodings_extra.def \ + encodings_local.def \ + translit.def \ + genaliases.c \ + genaliases2.c \ + genflags.c \ + gentranslit.c \ + iconv.c \ + converters.h \ + ascii.h \ + utf8.h \ + ucs2.h \ + ucs2be.h \ + ucs2le.h \ + ucs4.h \ + ucs4be.h \ + ucs4le.h \ + utf16.h \ + utf16be.h \ + utf16le.h \ + utf32.h \ + utf32be.h \ + utf32le.h \ + utf7.h \ + ucs2internal.h \ + ucs2swapped.h \ + ucs4internal.h \ + ucs4swapped.h \ + c99.h \ + java.h \ + iso8859_1.h \ + iso8859_2.h \ + iso8859_3.h \ + iso8859_4.h \ + iso8859_5.h \ + iso8859_6.h \ + iso8859_7.h \ + iso8859_8.h \ + iso8859_9.h \ + iso8859_10.h \ + iso8859_11.h \ + iso8859_13.h \ + iso8859_14.h \ + iso8859_15.h \ + iso8859_16.h \ + koi8_r.h \ + koi8_u.h \ + koi8_ru.h \ + cp1250.h \ + cp1251.h \ + cp1252.h \ + cp1253.h \ + cp1254.h \ + cp1255.h \ + cp1256.h \ + cp1257.h \ + cp1258.h \ + vietcomb.h \ + cp850.h \ + cp862.h \ + cp866.h \ + cp1131.h \ + mac_roman.h \ + mac_centraleurope.h \ + mac_iceland.h \ + mac_croatian.h \ + mac_romania.h \ + mac_cyrillic.h \ + mac_ukraine.h \ + mac_greek.h \ + mac_turkish.h \ + mac_hebrew.h \ + mac_arabic.h \ + mac_thai.h \ + hp_roman8.h \ + nextstep.h \ + armscii_8.h \ + georgian_academy.h \ + georgian_ps.h \ + koi8_t.h \ + pt154.h \ + rk1048.h \ + mulelao.h \ + cp1133.h \ + tis620.h \ + cp874.h \ + viscii.h \ + tcvn.h \ + iso646_jp.h \ + jisx0201.h \ + jisx0208.h \ + jisx0212.h \ + iso646_cn.h \ + gb2312.h \ + isoir165.h \ + isoir165ext.h \ + gb12345.h \ + gb12345ext.h \ + gbk.h \ + gbkext1.h \ + gbkext2.h \ + gbkext_inv.h \ + cp936ext.h \ + cns11643.h \ + cns11643_1.h \ + cns11643_2.h \ + cns11643_3.h \ + cns11643_4.h \ + cns11643_4a.h \ + cns11643_4b.h \ + cns11643_5.h \ + cns11643_6.h \ + cns11643_7.h \ + cns11643_15.h \ + cns11643_inv.h \ + big5.h \ + ksc5601.h \ + johab_hangul.h \ + euc_jp.h \ + sjis.h \ + cp932.h \ + cp932ext.h \ + iso2022_jp.h \ + iso2022_jp1.h \ + iso2022_jp2.h \ + iso2022_jpms.h \ + cp50221_0208_ext.h \ + cp50221_0212_ext.h \ + euc_cn.h \ + ces_gbk.h \ + cp936.h \ + gb18030.h \ + gb18030ext.h \ + gb18030uni.h \ + iso2022_cn.h \ + iso2022_cnext.h \ + hz.h \ + euc_tw.h \ + ces_big5.h \ + cp950.h \ + cp950ext.h \ + big5hkscs1999.h \ + hkscs1999.h \ + big5hkscs2001.h \ + hkscs2001.h \ + big5hkscs2004.h \ + hkscs2004.h \ + big5hkscs2008.h \ + hkscs2008.h \ + euc_kr.h \ + cp949.h \ + uhc_1.h \ + uhc_2.h \ + johab.h \ + iso2022_kr.h \ + cp856.h \ + cp922.h \ + cp943.h \ + cp1046.h \ + cp1124.h \ + cp1129.h \ + cp1161.h \ + cp1162.h \ + cp1163.h \ + dec_kanji.h \ + dec_hanyu.h \ + cp437.h \ + cp737.h \ + cp775.h \ + cp852.h \ + cp853.h \ + cp855.h \ + cp857.h \ + cp858.h \ + cp860.h \ + cp861.h \ + cp863.h \ + cp864.h \ + cp865.h \ + cp869.h \ + cp1125.h \ + euc_jisx0213.h \ + jisx0213.h \ + shift_jisx0213.h \ + iso2022_jp3.h \ + big5_2003.h \ + tds565.h \ + atarist.h \ + riscos1.h \ + flushwc.h \ + cjk_variants.h \ + loops.h \ + loop_unicode.h \ + loop_wchar.h \ + aliases2.h \ + iconv_open1.h \ + iconv_open2.h \ + relocatable.h relocatable.c +# List of distributed files imported from other packages. +IMPORTED_FILES = +# List of distributed files generated by autotools or Makefile.devel. +GENERATED_FILES = \ + aliases.gperf aliases_sysaix.gperf aliases_syshpux.gperf aliases_sysosf1.gperf aliases_syssolaris.gperf \ + aliases.h aliases_sysaix.h aliases_syshpux.h aliases_sysosf1.h aliases_syssolaris.h \ + aliases_aix.h aliases_aix_sysaix.h \ + aliases_osf1.h aliases_osf1_sysosf1.h \ + aliases_dos.h \ + aliases_extra.h \ + canonical.h canonical_sysaix.h canonical_syshpux.h canonical_sysosf1.h canonical_syssolaris.h \ + canonical_aix.h canonical_aix_sysaix.h \ + canonical_osf1.h canonical_osf1_sysosf1.h \ + canonical_dos.h \ + canonical_extra.h \ + canonical_local.h canonical_local_sysaix.h canonical_local_syshpux.h canonical_local_sysosf1.h canonical_local_syssolaris.h \ + flags.h \ + translit.h +# List of distributed files generated by "make". +DISTRIBUTED_BUILT_FILES = +# List of distributed files. +DISTFILES = $(SOURCE_FILES) $(IMPORTED_FILES) $(GENERATED_FILES) $(DISTRIBUTED_BUILT_FILES) + +distdir : $(DISTFILES) + for file in $(DISTFILES); do \ + if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \ + cp -p "$$dir/$$file" '$(distdir)'/$$file || exit 1; \ + done + +force : + diff --git a/3rdparty/libiconv/1.15/lib/config.h.in b/3rdparty/libiconv/1.15/lib/config.h.in new file mode 100644 index 0000000000..89abce2fed --- /dev/null +++ b/3rdparty/libiconv/1.15/lib/config.h.in @@ -0,0 +1,82 @@ +/* Copyright (C) 1999-2003, 2005, 2007, 2010, 2012 Free Software Foundation, Inc. + This file is part of the GNU LIBICONV Library. + + The GNU LIBICONV Library is free software; you can redistribute it + and/or modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + The GNU LIBICONV Library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU LIBICONV Library; see the file COPYING.LIB. + If not, see . */ + + +/* Define to 1 to enable a few rarely used encodings. */ +#undef ENABLE_EXTRA + +/* Define to 1 if the package shall run at any location in the filesystem. */ +#undef ENABLE_RELOCATABLE + +/* Define to a type if does not define. */ +#undef mbstate_t + +/* Define if you have , the iconv_t type, and the + iconv_open, iconv, iconv_close functions. */ +#undef HAVE_ICONV +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST /* empty by default */ + +/* Define to 1 if you have the getc_unlocked() function. */ +#undef HAVE_GETC_UNLOCKED + +/* Define if you have and nl_langinfo(CODESET). */ +#undef HAVE_LANGINFO_CODESET + +/* Define if you have the mbrtowc() function. */ +#undef HAVE_MBRTOWC + +/* Define to 1 if you have the setlocale() function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#undef HAVE_VISIBILITY + +/* Define if you have the wcrtomb() function. */ +#undef HAVE_WCRTOMB + +/* Define to 1 if O_NOFOLLOW works. */ +#undef HAVE_WORKING_O_NOFOLLOW + +/* Define if the machine's byte ordering is little endian. */ +#undef WORDS_LITTLEENDIAN + +/* Define to the value of ${prefix}, as a string. */ +#undef INSTALLPREFIX + +/* Define to '__inline__' or '__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to 'int' if does not define. */ +#undef mode_t + +/* Define as a signed type of the same size as size_t. */ +#undef ssize_t + diff --git a/3rdparty/libiconv/1.15/lib/cp50221_0208_ext.h b/3rdparty/libiconv/1.15/lib/cp50221_0208_ext.h new file mode 100644 index 0000000000..d2c7edb69f --- /dev/null +++ b/3rdparty/libiconv/1.15/lib/cp50221_0208_ext.h @@ -0,0 +1,149 @@ +/* + * Copyright (C) 1999-2012, 2016 Free Software Foundation, Inc. + * This file is part of the GNU LIBICONV Library. + * + * The GNU LIBICONV Library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * The GNU LIBICONV Library is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with the GNU LIBICONV Library; see the file COPYING.LIB. + * If not, see . + */ + +/* + * CP50221 JISX0208 extensions + */ + +static const unsigned short cp50221_0208_ext_2uni[96] = { + /* 0x00 */ + 0xfffd, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, + 0x2467, 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, + /* 0x10 */ + 0x246f, 0x2470, 0x2471, 0x2472, 0x2473, 0x2160, 0x2161, 0x2162, + 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0xfffd, + /* 0x20 */ + 0x3349, 0x3314, 0x3322, 0x334d, 0x3318, 0x3327, 0x3303, 0x3336, + 0x3351, 0x3357, 0x330d, 0x3326, 0x3323, 0x332b, 0x334a, 0x333b, + /* 0x30 */ + 0x339c, 0x339d, 0x339e, 0x338e, 0x338f, 0x33c4, 0x33a1, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x337b, + /* 0x40 */ + 0x301e, 0x301f, 0x2116, 0x33cd, 0x2121, 0x32a4, 0x32a5, 0x32a6, + 0x32a7, 0x32a8, 0x3231, 0x3232, 0x3239, 0x337e, 0x337d, 0x337c, + /* 0x50 */ + 0xfffd, 0xfffd, 0xfffd, 0x222e, 0x2211, 0xfffd, 0xfffd, 0xfffd, + 0x221f, 0x22bf, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, +}; + +static int +cp50221_0208_ext_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) +{ + unsigned char c = *s; + if (c < 0x60) { + unsigned short wc = cp50221_0208_ext_2uni[c]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char cp50221_0208_ext_page21[96] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, /* 0x60-0x67 */ + 0x1d, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ +}; +static const unsigned char cp50221_0208_ext_page22[32] = { + 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, /* 0x28-0x2f */ +}; +static const unsigned char cp50221_0208_ext_page24[24] = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, /* 0x60-0x67 */ + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, /* 0x68-0x6f */ + 0x11, 0x12, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ +}; +static const unsigned char cp50221_0208_ext_page30[8] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x41, /* 0x18-0x1f */ +}; +static const unsigned char cp50221_0208_ext_page32[16] = { + 0x00, 0x4a, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; +static const unsigned char cp50221_0208_ext_page32_1[16] = { + 0x00, 0x00, 0x00, 0x00, 0x45, 0x46, 0x47, 0x48, /* 0xa0-0xa7 */ + 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ +}; +static const unsigned char cp50221_0208_ext_page33[208] = { + 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x22, 0x2c, 0x00, 0x00, 0x2b, 0x25, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x20, 0x2e, 0x00, 0x00, 0x23, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x3f, 0x4f, 0x4e, 0x4d, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x34, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x30, 0x31, 0x32, 0x00, /* 0x98-0x9f */ + 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, /* 0xc8-0xcf */ +}; + +static int +cp50221_0208_ext_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) +{ + unsigned char c = 0; + if (wc >= 0x2110 && wc < 0x2170) + c = cp50221_0208_ext_page21[wc-0x2110]; + else if (wc >= 0x2210 && wc < 0x2230) + c = cp50221_0208_ext_page22[wc-0x2210]; + else if (wc == 0x22bf) + c = 0x59; + else if (wc >= 0x2460 && wc < 0x2478) + c = cp50221_0208_ext_page24[wc-0x2460]; + else if (wc >= 0x3018 && wc < 0x3020) + c = cp50221_0208_ext_page30[wc-0x3018]; + else if (wc >= 0x3230 && wc < 0x3240) + c = cp50221_0208_ext_page32[wc-0x3230]; + else if (wc >= 0x32a0 && wc < 0x32b0) + c = cp50221_0208_ext_page32_1[wc-0x32a0]; + else if (wc >= 0x3300 && wc < 0x33d0) + c = cp50221_0208_ext_page33[wc-0x3300]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILUNI; +} diff --git a/3rdparty/libiconv/1.15/lib/cp50221_0212_ext.h b/3rdparty/libiconv/1.15/lib/cp50221_0212_ext.h new file mode 100644 index 0000000000..d07808d3a6 --- /dev/null +++ b/3rdparty/libiconv/1.15/lib/cp50221_0212_ext.h @@ -0,0 +1,212 @@ +/* + * Copyright (C) 1999-2011, 2016 Free Software Foundation, Inc. + * This file is part of the GNU LIBICONV Library. + * + * The GNU LIBICONV Library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * The GNU LIBICONV Library is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with the GNU LIBICONV Library; see the file COPYING.LIB. + * If not, see . + */ + +/* + * CP50221 JISX0212 extensions + */ + +static const unsigned short cp50221_0212_ext_2uni[112] = { + /* 0x00 */ + 0xfffd, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, + 0x2177, 0x2178, 0x2179, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x10 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xff07, 0xff02, 0xfffd, + 0xfffd, 0xfffd, 0x70bb, 0x4efc, 0x50f4, 0x51ec, 0x5307, 0x5324, + /* 0x20 */ + 0xfa0e, 0x548a, 0x5759, 0xfa0f, 0xfa10, 0x589e, 0x5bec, 0x5cf5, + 0x5d53, 0xfa11, 0x5fb7, 0x6085, 0x6120, 0x654e, 0xfffd, 0x6665, + /* 0x30 */ + 0xfa12, 0xf929, 0x6801, 0xfa13, 0xfa14, 0x6a6b, 0x6ae2, 0x6df8, + 0x6df2, 0x7028, 0xfa15, 0xfa16, 0x7501, 0x7682, 0x769e, 0xfa17, + /* 0x40 */ + 0x7930, 0xfa18, 0xfa19, 0xfa1a, 0xfa1b, 0x7ae7, 0xfa1c, 0xfa1d, + 0x7da0, 0x7dd6, 0xfa1e, 0x8362, 0xfa1f, 0x85b0, 0xfa20, 0xfa21, + /* 0x50 */ + 0x8807, 0xfa22, 0x8b7f, 0x8cf4, 0x8d76, 0xfa23, 0xfa24, 0xfa25, + 0x90de, 0xfa26, 0x9115, 0xfa27, 0xfa28, 0x9592, 0xf9dc, 0xfa29, + /* 0x60 */ + 0x973b, 0xfffd, 0x9751, 0xfa2a, 0xfa2b, 0xfa2c, 0x999e, 0x9ad9, + 0x9b72, 0xfa2d, 0x9ed1, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, +}; + +static int +cp50221_0212_ext_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) +{ + unsigned char c = *s; + if (c < 0x70) { + unsigned short wc = cp50221_0212_ext_2uni[c]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + else if (c == 0xa1) { + *pwc = 0x974d; + return 1; + } + return RET_ILSEQ; +} + +static const unsigned char cp50221_0212_ext_page21[16] = { + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, /* 0x70-0x77 */ + 0x09, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ +}; +static const unsigned char cp50221_0212_ext_page53[40] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, /* 0x20-0x27 */ +}; +static const unsigned char cp50221_0212_ext_page6d[16] = { + 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ + 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ +}; +static const unsigned char cp50221_0212_ext_page76[32] = { + 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, /* 0x98-0x9f */ +}; +static const unsigned char cp50221_0212_ext_page7d[56] = { + 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, /* 0xd0-0xd7 */ +}; +static const unsigned char cp50221_0212_ext_page97[32] = { + 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ +}; +static const unsigned char cp50221_0212_ext_pagefa[40] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x23, /* 0x08-0x0f */ + 0x24, 0x29, 0x30, 0x33, 0x34, 0x3a, 0x3b, 0x3f, /* 0x10-0x17 */ + 0x41, 0x42, 0x43, 0x44, 0x46, 0x47, 0x4a, 0x4c, /* 0x18-0x1f */ + 0x4e, 0x4f, 0x51, 0x55, 0x56, 0x57, 0x59, 0x5b, /* 0x20-0x27 */ + 0x5c, 0x5f, 0x63, 0x64, 0x65, 0x69, 0x00, 0x00, /* 0x28-0x2f */ +}; +static const unsigned char cp50221_0212_ext_pageff[8] = { + 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x15, /* 0x00-0x07 */ +}; + +static int +cp50221_0212_ext_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) +{ + unsigned char c = 0; + if (wc >= 0x2170 && wc < 0x2180) + c = cp50221_0212_ext_page21[wc-0x2170]; + else if (wc == 0x4efc) + c = 0x1b; + else if (wc == 0x50f4) + c = 0x1c; + else if (wc == 0x51ec) + c = 0x1d; + else if (wc >= 0x5300 && wc < 0x5328) + c = cp50221_0212_ext_page53[wc-0x5300]; + else if (wc == 0x548a) + c = 0x21; + else if (wc == 0x5759) + c = 0x22; + else if (wc == 0x589e) + c = 0x25; + else if (wc == 0x5bec) + c = 0x26; + else if (wc == 0x5cf5) + c = 0x27; + else if (wc == 0x5d53) + c = 0x28; + else if (wc == 0x5fb7) + c = 0x2a; + else if (wc == 0x6085) + c = 0x2b; + else if (wc == 0x6120) + c = 0x2c; + else if (wc == 0x654e) + c = 0x2d; + else if (wc == 0x6665) + c = 0x2f; + else if (wc == 0x6801) + c = 0x32; + else if (wc == 0x6a6b) + c = 0x35; + else if (wc == 0x6ae2) + c = 0x36; + else if (wc >= 0x6df0 && wc < 0x6e00) + c = cp50221_0212_ext_page6d[wc-0x6df0]; + else if (wc == 0x7028) + c = 0x39; + else if (wc == 0x70bb) + c = 0x1a; + else if (wc == 0x7501) + c = 0x3c; + else if (wc >= 0x7680 && wc < 0x76a0) + c = cp50221_0212_ext_page76[wc-0x7680]; + else if (wc == 0x7930) + c = 0x40; + else if (wc == 0x7ae7) + c = 0x45; + else if (wc >= 0x7da0 && wc < 0x7dd8) + c = cp50221_0212_ext_page7d[wc-0x7da0]; + else if (wc == 0x8362) + c = 0x4b; + else if (wc == 0x85b0) + c = 0x4d; + else if (wc == 0x8807) + c = 0x50; + else if (wc == 0x8b7f) + c = 0x52; + else if (wc == 0x8cf4) + c = 0x53; + else if (wc == 0x8d76) + c = 0x54; + else if (wc == 0x90de) + c = 0x58; + else if (wc == 0x9115) + c = 0x5a; + else if (wc == 0x9592) + c = 0x5d; + else if (wc >= 0x9738 && wc < 0x9758) + c = cp50221_0212_ext_page97[wc-0x9738]; + else if (wc == 0x999e) + c = 0x66; + else if (wc == 0x9ad9) + c = 0x67; + else if (wc == 0x9b72) + c = 0x68; + else if (wc == 0x9ed1) + c = 0x6a; + else if (wc == 0xf929) + c = 0x31; + else if (wc == 0xf9dc) + c = 0x5e; + else if (wc >= 0xfa08 && wc < 0xfa30) + c = cp50221_0212_ext_pagefa[wc-0xfa08]; + else if (wc >= 0xff00 && wc < 0xff08) + c = cp50221_0212_ext_pageff[wc-0xff00]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILUNI; +} diff --git a/3rdparty/libiconv/1.15/lib/iso2022_jpms.h b/3rdparty/libiconv/1.15/lib/iso2022_jpms.h new file mode 100644 index 0000000000..64d88bd63f --- /dev/null +++ b/3rdparty/libiconv/1.15/lib/iso2022_jpms.h @@ -0,0 +1,445 @@ +/* + * Copyright (C) 1999-2001, 2008, 2011-2012, 2016 Free Software Foundation, Inc. + * This file is part of the GNU LIBICONV Library. + * + * The GNU LIBICONV Library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * The GNU LIBICONV Library is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with the GNU LIBICONV Library; see the file COPYING.LIB. + * If not, see . + */ + +/* + * ISO-2022-JP-MS + * alias CP50221 + * + * This is an extension of ISO-2022-JP-1 with larger character sets. + * It uses ESC $ B and ESC $ ( D to denote *extensions* of JIS X 0208 and + * JIS X 0212, respectively. This violates the principles of ISO 2022, + * where + * 1. character sets to be used by ISO 2022 have to be registered at the + * ISO IR registry , + * 2. different character sets are designated by different escape + * sequences. + * It's a typical instance of the "embrace and extend" strategy by Microsoft + * . + */ + +/* + * Windows has three encodings CP50220, CP50221, CP50222. + * The common parts are: + * - US-ASCII (0x00..0x7F) + * - JIS X 0208 extended by + * - one row (0x2D), + * - a private use area (rows 0x75..0x7E = U+E000..U+E3AB), + * enabled with ESC $ B, disabled with ESC ( B. + * - JIS X 0212 extended by + * - two rows (0x73..0x74), + * - a private use area (rows 0x75..0x7E = U+E3AC..U+E757), + * enabled with ESC $ ( D, disabled with ESC ( B. + * They differ in the handling of JIS X 0201 characters (halfwidth Katakana) + * in the conversion direction Unicode -> CP5022x: + * * CP50220 maps the halfwidth Katakana to fullwidth Katakana characters. + * * CP50221 contains the JIS X 0201 halfwidth Katakana characters, + * enabled with ESC ( I, disabled with ESC ( B. + * * CP50222 contains the JIS X 0201 halfwidth Katakana characters, + * enabled with ESC ( J 0x0E, disabled with ESC ( B. + * In the conversion direction CP5022x -> Unicode, all three operate the same: + * - ESC ( I is supported and understood. + * - ESC ( J 0x0E is not accepted. (Tested on Windows XP SP3.) + * Conclusion: + * - CP50222 should not be used, because the multibyte sequence that it + * produces cannot be parsed by either of the three encodings. + * - CP50221 is preferrable to CP50220, because it can faithfully represent + * the halfwidth Katakana characters. + * We therefore implement CP50221. As an extension, in the mbtowc conversion + * direction, we support also ESC ( J 0x0E, just in case. + */ + +#include "cp50221_0208_ext.h" +#include "cp50221_0212_ext.h" + +#define ESC 0x1b +#define SO 0x0e +#define SI 0x0f + +/* + * The state can be one of the following values. + */ +#define STATE_ASCII 0 /* Esc ( B */ +#define STATE_JISX0201ROMAN 1 /* Esc ( J */ /* only in mbtowc direction */ +#define STATE_JISX0201KATAKANA 2 /* Esc ( I */ +#define STATE_JISX0208MS 3 /* Esc $ @ or Esc $ B */ +#define STATE_JISX0212MS 4 /* Esc $ ( D */ + +static int +iso2022_jpms_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) +{ + state_t state = conv->istate; + int count = 0; + unsigned char c; + for (;;) { + c = *s; + if (c == ESC) { + if (n < count+3) + goto none; + if (s[1] == '(') { + if (s[2] == 'B') { + state = STATE_ASCII; + s += 3; count += 3; + if (n < count+1) + goto none; + continue; + } + if (s[2] == 'I') { + state = STATE_JISX0201KATAKANA; + s += 3; count += 3; + if (n < count+1) + goto none; + continue; + } + if (s[2] == 'J') { + state = STATE_JISX0201ROMAN; + s += 3; count += 3; + if (n < count+1) + goto none; + continue; + } + goto ilseq; + } + if (s[1] == '$') { + if (s[2] == '@' || s[2] == 'B') { + /* We don't distinguish JIS X 0208-1978 and JIS X 0208-1983. */ + state = STATE_JISX0208MS; + s += 3; count += 3; + if (n < count+1) + goto none; + continue; + } + if (s[2] == '(') { + if (n < count+4) + goto none; + if (s[3] == 'D') { + state = STATE_JISX0212MS; + s += 4; count += 4; + if (n < count+1) + goto none; + continue; + } + } + goto ilseq; + } + goto ilseq; + } + if (c == SO) { + if (state == STATE_JISX0201ROMAN) + state = STATE_JISX0201KATAKANA; + s += 1; count += 1; + if (n < count+1) + goto none; + continue; + } + if (c == SI) { + if (state == STATE_JISX0201KATAKANA) + state = STATE_JISX0201ROMAN; + s += 1; count += 1; + if (n < count+1) + goto none; + continue; + } + break; + } + switch (state) { + case STATE_ASCII: + if (c < 0x80) { + int ret = ascii_mbtowc(conv,pwc,s,1); + if (ret == RET_ILSEQ) + goto ilseq; + if (ret != 1) abort(); + conv->istate = state; + return count+1; + } else + goto ilseq; + case STATE_JISX0201ROMAN: + if (c < 0x80) { + int ret = jisx0201_mbtowc(conv,pwc,s,1); + if (ret == RET_ILSEQ) + goto ilseq; + if (ret != 1) abort(); + conv->istate = state; + return count+1; + } else + goto ilseq; + case STATE_JISX0201KATAKANA: + if (c < 0x80) { + unsigned char buf = c+0x80; + int ret = jisx0201_mbtowc(conv,pwc,&buf,1); + if (ret == RET_ILSEQ) + goto ilseq; + if (ret != 1) abort(); + conv->istate = state; + return count+1; + } else + goto ilseq; + case STATE_JISX0208MS: + if (n < count+2) + goto none; + if (s[0] < 0x80 && s[1] < 0x80) { + int ret; + if (s[0] < 0x75) { + if (s[0] == 0x2d) { + /* Extension of JIS X 0208. */ + if (s[1] >= 0x21 && s[1] <= 0x79) { + unsigned char i = (s[1] - 0x21) + 1; + ret = cp50221_0208_ext_mbtowc(conv,pwc,&i,1); + if (ret == 1) + ret = 2; + } else + ret = RET_ILSEQ; + } else { + /* JIS X 0208. */ + ret = jisx0208_mbtowc(conv,pwc,s,2); + } + } else { + /* Extension of JIS X 0208. + 0x{75..7E}{21..8E} maps to U+E000..U+E3AB. + But some rows maps to characters present in CP932. */ + if (s[0] <= 0x7e && (s[1] >= 0x21 && s[1] <= 0x7e)) { + unsigned short wc = 0xfffd; + if (s[0] >= 0x79 && s[0] <= 0x7c) + wc = cp932ext_2uni_pageed[(s[0] - 0x79) * 94 + (s[1] - 0x21)]; + if (wc == 0xfffd) + wc = (s[0] - 0x75) * 94 + (s[1] - 0x21) + 0xe000; + *pwc = wc; + ret = 2; + } else + ret = RET_ILSEQ; + } + if (ret == RET_ILSEQ) + goto ilseq; + if (ret != 2) abort(); + conv->istate = state; + return count+2; + } else + goto ilseq; + case STATE_JISX0212MS: + if (n < count+2) + goto none; + if (s[0] < 0x80 && s[1] < 0x80) { + int ret; + if (s[0] < 0x73) { + /* JIS X 0212. */ + ret = jisx0212_mbtowc(conv,pwc,s,2); + } else { + if (s[0] < 0x75) { + /* Extension of JIS X 0212. */ + if (s[1] >= 0x21 && s[1] <= 0x7e) { + unsigned char i = (s[0] - 0x73) * 94 + (s[1] - 0x21) + 1; + ret = cp50221_0212_ext_mbtowc(conv,pwc,&i,1); + if (ret == 1) + ret = 2; + } else + ret = RET_ILSEQ; + } else { + /* Extension of JIS X 0208. + 0x{75..7E}{21..8E} maps to U+E3AC..U+E757. */ + if (s[0] <= 0x7e && (s[1] >= 0x21 && s[1] <= 0x7e)) { + *pwc = (s[0] - 0x75) * 94 + (s[1] - 0x21) + 0xe3ac; + ret = 2; + } else + ret = RET_ILSEQ; + } + } + if (ret == RET_ILSEQ) + goto ilseq; + if (ret != 2) abort(); + conv->istate = state; + return count+2; + } else + goto ilseq; + default: abort(); + } + +none: + conv->istate = state; + return RET_TOOFEW(count); + +ilseq: + conv->istate = state; + return RET_SHIFT_ILSEQ(count); +} + +static int +iso2022_jpms_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) +{ + state_t state = conv->ostate; + unsigned char buf[2]; + int ret; + + /* Try ASCII. */ + ret = ascii_wctomb(conv,buf,wc,1); + if (ret != RET_ILUNI) { + if (ret != 1) abort(); + if (buf[0] < 0x80) { + int count = (state == STATE_ASCII ? 1 : 4); + if (n < count) + return RET_TOOSMALL; + if (state != STATE_ASCII) { + r[0] = ESC; + r[1] = '('; + r[2] = 'B'; + r += 3; + state = STATE_ASCII; + } + r[0] = buf[0]; + conv->ostate = state; + return count; + } + } + + /* Try JIS X 0201-1976 Katakana. */ + ret = jisx0201_wctomb(conv,buf,wc,1); + if (ret != RET_ILUNI) { + if (ret != 1) abort(); + if (buf[0] >= 0x80) { + int count = (state == STATE_JISX0201KATAKANA ? 1 : 4); + if (n < count) + return RET_TOOSMALL; + if (state != STATE_JISX0201KATAKANA) { + r[0] = ESC; + r[1] = '('; + r[2] = 'I'; + r += 3; + state = STATE_JISX0201KATAKANA; + } + r[0] = buf[0]-0x80; + conv->ostate = state; + return count; + } + } + + /* Try JIS X 0208-1990, in place of JIS X 0208-1978 and JIS X 0208-1983, + and the extensions mentioned above. */ + if (wc >= 0xe000 && wc < 0xe3ac) { + unsigned short i = wc - 0xe000; + buf[0] = (i / 94) + 0x75; + buf[1] = (i % 94) + 0x21; + ret = 2; + } else { + ret = jisx0208_wctomb(conv,buf,wc,2); + if (ret == RET_ILUNI) { + /* Extension of JIS X 0208. */ + unsigned char i; + ret = cp50221_0208_ext_wctomb(conv,&i,wc,1); + if (ret == 1) { + buf[0] = 0x2d; + buf[1] = i-1 + 0x21; + ret = 2; + } else if (wc == 0x663B) { + buf[0] = 0x7a; + buf[1] = 0x36; + ret = 2; + } else if (wc == 0xffe2) { + buf[0] = 0x7c; + buf[1] = 0x7b; + ret = 2; + } else if (wc == 0xffe4) { + buf[0] = 0x7c; + buf[1] = 0x7c; + ret = 2; + } + } + } + if (ret != RET_ILUNI) { + if (ret != 2) abort(); + if (buf[0] < 0x80 && buf[1] < 0x80) { + int count = (state == STATE_JISX0208MS ? 2 : 5); + if (n < count) + return RET_TOOSMALL; + if (state != STATE_JISX0208MS) { + r[0] = ESC; + r[1] = '$'; + r[2] = 'B'; + r += 3; + state = STATE_JISX0208MS; + } + r[0] = buf[0]; + r[1] = buf[1]; + conv->ostate = state; + return count; + } + } + + /* Try JIS X 0212-1990 and the extensions mentioned above. */ + if (wc >= 0xe3ac && wc < 0xe758) { + unsigned short i = wc - 0xe3ac; + buf[0] = (i / 94) + 0x75; + buf[1] = (i % 94) + 0x21; + ret = 2; + } else { + ret = jisx0212_wctomb(conv,buf,wc,2); + if (ret == RET_ILUNI) { + /* Extension of JIS X 0212. */ + unsigned char i; + ret = cp50221_0212_ext_wctomb(conv,&i,wc,1); + if (ret == 1) { + i -= 1; + buf[0] = (i / 94) + 0x73; + buf[1] = (i % 94) + 0x21; + ret = 2; + } + } + } + if (ret != RET_ILUNI) { + if (ret != 2) abort(); + if (buf[0] < 0x80 && buf[1] < 0x80) { + int count = (state == STATE_JISX0212MS ? 2 : 6); + if (n < count) + return RET_TOOSMALL; + if (state != STATE_JISX0212MS) { + r[0] = ESC; + r[1] = '$'; + r[2] = '('; + r[3] = 'D'; + r += 4; + state = STATE_JISX0212MS; + } + r[0] = buf[0]; + r[1] = buf[1]; + conv->ostate = state; + return count; + } + } + + return RET_ILUNI; +} + +static int +iso2022_jpms_reset (conv_t conv, unsigned char *r, size_t n) +{ + state_t state = conv->ostate; + if (state != STATE_ASCII) { + if (n < 3) + return RET_TOOSMALL; + r[0] = ESC; + r[1] = '('; + r[2] = 'B'; + /* conv->ostate = 0; will be done by the caller */ + return 3; + } else + return 0; +} + +#undef STATE_JISX0212MS +#undef STATE_JISX0208MS +#undef STATE_JISX0201KATAKANA +#undef STATE_JISX0201ROMAN +#undef STATE_ASCII diff --git a/3rdparty/libiconv/1.15/libcharset/lib/Makefile.in b/3rdparty/libiconv/1.15/libcharset/lib/Makefile.in new file mode 100644 index 0000000000..569b23fd96 --- /dev/null +++ b/3rdparty/libiconv/1.15/libcharset/lib/Makefile.in @@ -0,0 +1,177 @@ +# Makefile for libcharset/lib + +#### Start of system configuration section. #### + +# Directories used by "make": +srcdir = @srcdir@ + +# Directories used by "make install": +prefix = @prefix@ +local_prefix = /usr/local +exec_prefix = @exec_prefix@ +libdir = @libdir@ + +# Programs used by "make": +CC = @CC@ +CFLAGS = @CFLAGS@ @CFLAG_VISIBILITY@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +INCLUDES = -I. -I$(srcdir) -I.. -I$(srcdir)/.. -I../include +# -DBUILDING_LIBCHARSET: Change expansion of LIBCHARSET_DLL_EXPORTED macro. +# -DBUILDING_DLL: Change expansion of RELOCATABLE_DLL_EXPORTED macro. +DEFS = -DLIBDIR=\"$(libdir)\" -DBUILDING_LIBCHARSET -DBUILDING_DLL \ +-DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \ +-Dset_relocation_prefix=libcharset_set_relocation_prefix \ +-Drelocate=libcharset_relocate @DEFS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile +LIBTOOL_LINK = $(LIBTOOL) --mode=link +LIBTOOL_INSTALL = $(LIBTOOL) --mode=install +LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall +RM = rm -f + +# Programs used by "make install": +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +mkinstalldirs = $(SHELL) @top_srcdir@/build-aux/mkinstalldirs + +#### End of system configuration section. #### + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh + +# Before making a release, change this according to the libtool documentation, +# section "Library interface versions". +LIBCHARSET_VERSION_INFO = 1:0:0 + +# Needed by $(LIBTOOL). +top_builddir = .. + +SOURCES = $(srcdir)/localcharset.c $(srcdir)/relocatable.c + +OBJECTS = localcharset.lo relocatable.lo + +all : libcharset.la charset.alias ref-add.sed ref-del.sed + +libcharset.la : $(OBJECTS) + $(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(CFLAGS) -o libcharset.la -rpath $(libdir) -version-info $(LIBCHARSET_VERSION_INFO) -no-undefined $(OBJECTS) + +localcharset.lo : $(srcdir)/localcharset.c + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/localcharset.c + +relocatable.lo : $(srcdir)/relocatable.c $(srcdir)/relocatable.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/relocatable.c + +charset.alias: $(srcdir)/config.charset + $(SHELL) $(srcdir)/config.charset '@host@' > t-$@ + mv t-$@ $@ + +ref-add.sed : $(srcdir)/ref-add.sin + sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-add.sin > t-$@ + mv t-$@ $@ + +ref-del.sed : $(srcdir)/ref-del.sin + sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-del.sin > t-$@ + mv t-$@ $@ + +# Installs the library and include files only. Typically called with only +# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here. +install-lib : all force + $(mkinstalldirs) $(libdir) + $(LIBTOOL_INSTALL) $(INSTALL) libcharset.la $(libdir)/libcharset.la + test -f $(libdir)/charset.alias && orig=$(libdir)/charset.alias \ + || orig=charset.alias; \ + sed -f ref-add.sed $$orig > $(libdir)/t-charset.alias; \ + $(INSTALL_DATA) $(libdir)/t-charset.alias $(libdir)/charset.alias; \ + rm -f $(libdir)/t-charset.alias + +# The following is needed in order to install a simple file in $(libdir) +# which is shared with other installed packages. We use a list of referencing +# packages so that "make uninstall" will remove the file if and only if it +# is not used by another installed package. +# On systems with glibc-2.1 or newer, the file is redundant, therefore we +# avoid installing it. + +install : all force + if test @GLIBC21@ = no; then \ + case '@host_os@' in \ + darwin[56]*) \ + need_charset_alias=true ;; \ + darwin* | cygwin* | mingw* | pw32* | cegcc*) \ + need_charset_alias=false ;; \ + *) \ + need_charset_alias=true ;; \ + esac ; \ + else \ + need_charset_alias=false ; \ + fi ; \ + $(mkinstalldirs) $(DESTDIR)$(libdir) ; \ + $(LIBTOOL_INSTALL) $(INSTALL) libcharset.la $(DESTDIR)$(libdir)/libcharset.la + if test -f $(DESTDIR)$(libdir)/charset.alias; then \ + sed -f ref-add.sed $(DESTDIR)$(libdir)/charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \ + $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \ + rm -f $(DESTDIR)$(libdir)/t-charset.alias; \ + else \ + if $$need_charset_alias; then \ + sed -f ref-add.sed charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \ + $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \ + rm -f $(DESTDIR)$(libdir)/t-charset.alias; \ + fi ; \ + fi + +install-strip : install + +installdirs : force + $(mkinstalldirs) $(DESTDIR)$(libdir) + +uninstall : force + $(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libcharset.la + if test -f $(DESTDIR)$(libdir)/charset.alias; then \ + sed -f ref-del.sed $(DESTDIR)$(libdir)/charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \ + if grep '^# Packages using this file: $$' $(DESTDIR)$(libdir)/t-charset.alias > /dev/null; then \ + rm -f $(DESTDIR)$(libdir)/charset.alias; \ + else \ + $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \ + fi; \ + rm -f $(DESTDIR)$(libdir)/t-charset.alias; \ + fi + +check : all + +mostlyclean : clean + +clean : force + $(RM) *.o *.lo *.a *.la *.o.lock core *.stackdump charset.alias ref-add.sed ref-del.sed + $(RM) -r .libs _libs + +distclean : clean + $(RM) Makefile + +maintainer-clean : distclean + +# List of source files. +SOURCE_FILES = \ + ChangeLog Makefile.in +# List of files bidirectionally synced with gnulib. +GNULIB_SYNCED_FILES = \ + config.charset localcharset.c ref-add.sin ref-del.sin \ + relocatable.h relocatable.c +# List of distributed files imported from other packages. +IMPORTED_FILES = +# List of distributed files generated by autotools or Makefile.devel. +GENERATED_FILES = +# List of distributed files generated by "make". +DISTRIBUTED_BUILT_FILES = +# List of distributed files. +DISTFILES = $(SOURCE_FILES) $(GNULIB_SYNCED_FILES) $(IMPORTED_FILES) $(GENERATED_FILES) $(DISTRIBUTED_BUILT_FILES) + +distdir : $(DISTFILES) + for file in $(DISTFILES); do \ + if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \ + cp -p "$$dir/$$file" '$(distdir)'/$$file || exit 1; \ + done + +force : +