Date: Wed, 13 Jan 2010 22:15:51 GMT From: Gabor Kovesdan <gabor@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 173099 for review Message-ID: <201001132215.o0DMFp29033716@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=173099 Change 173099 by gabor@gabor_aspire on 2010/01/13 22:14:54 MFHg: LIBRARY ===================================================================== - Fix segfault of BIG5 module [1] - Fix some mapping problems of Big5-family, so these encodings can be used now - Some more mapping improvements for other encodings - GNU: Implement ICONV_HOOKS for iconvctl() - GNU: Initial implementation of ICONV_FALLBACKS for iconvctl() (these also seem to be incomplete in GNU) - GNU: Correct prototype of iconv_canonicalize() - Fix segfaults in iconv_none - Eliminate icconv.dir lookup facility; use iconv_none for identical conversions and iconv_std for the rest - GNU: Add _libiconv_version variable - Eliminate ABI versioning, we will not need it - Excessive reduce in warnings, higher WARNS levels - Add ISCII-DEV alias for MACDEVANAGARI - Fix 1 -> 2, 1 -> 3 and 1 -> 4 mappings in NONE module, which makes it possible to use more accurate transliteration, just like GNU - Improved transliteration for the following encodings: ARMSCII-8, ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5, ISO8859-6, ISO8859-7, ISO8859-8, ISO8859-9, ISO8859-10, ISO8859-11, ISO8859-13, ISO8859-14, ISO8859-15, ISO8859-16, KOI8-R, KOI8-U, KOI8-RU, PT154, VISCII, CP1131, CP1251, CP866 - Rename _iconv.c to iconv.c - GNU: Add support for iconv_open_into() - GNU: Add libiconv_open_into alias BIN ===================================================================== - iconv: Add support for "-" as an alias of stdin per POSIX - iconv: Rename -ll to -L per POSIX.1-2008 Utility Syntax Guidelines REGRESSION-TEST ===================================================================== - gnu/posix: Some new test cases - tablegen: Add -d for diagnostical output - tablegen: skip illegal Unicode input, which only works in GNU - Remove check between UTF-x, it is not necessary - tablegen: Add -c to generate Citrus-like tables DOCS ===================================================================== - MLINKS for iconv_open.3 and iconv_close.3 - Added manpages: - iconvlist.3 - iconv_canonicalize.3 - __iconv_get_list.3 - MLINKS for __iconv_free_list.3 - iconv.3: Document POSIX.1-2008 conformance - mkesdb.3: Document -m - esdb.5: Improved description - csmapper.5: Improved description MISC ===================================================================== - Cleanup of redundant alias names (duplicates) - Cleanup of unused code parts - Axe out unused interfaces - Provide a freshinstall target for first-time install - Add my copyright to some files I have touched Submitted by: Kuang-Chung Chiu <buganini@gmail.com> Affected files ... .. //depot/projects/soc2009/gabor_iconv/extracted/Makefile#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/TESTING-HOWTO#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/include/iconv.h#3 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/Makefile#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/_iconv.c#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_ctype.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_ctype.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_ctype_fallback.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_ctype_fallback.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_ctype_local.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_ctype_template.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_esdb.h#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_iconv.c#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_iconv.h#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_iconv_local.h#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_mapper.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_mapper.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_mapper_local.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_none.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_none.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_prop.c#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_prop.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_stdenc.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_stdenc.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_stdenc_local.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_stdenc_template.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/iconvctl.3#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/BIG5/citrus_big5.c#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/BIG5/citrus_big5.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/DECHanyu/citrus_dechanyu.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/EUC/citrus_euc.c#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/EUC/citrus_euc.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/EUCTW/citrus_euctw.c#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/EUCTW/citrus_euctw.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/GBK2K/citrus_gbk2k.c#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/GBK2K/citrus_gbk2k.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/HZ/citrus_hz.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/HZ/citrus_hz.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/ISO2022/citrus_iso2022.c#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/ISO2022/citrus_iso2022.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/JOHAB/citrus_johab.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/JOHAB/citrus_johab.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/MSKanji/citrus_mskanji.c#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/MSKanji/citrus_mskanji.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/UES/citrus_ues.c#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/UES/citrus_ues.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/UTF7/citrus_utf7.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/UTF7/citrus_utf7.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/UTF8/citrus_utf8.c#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/UTF8/citrus_utf8.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/VIQR/citrus_viqr.c#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/VIQR/citrus_viqr.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/ZW/citrus_zw.c#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/ZW/citrus_zw.h#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/iconv_none/Makefile#9 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/iconv_none/citrus_iconv_none.c#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/iconv_std/Makefile#9 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/iconv_std/citrus_iconv_std.c#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/mapper_646/citrus_mapper_646.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/mapper_none/Makefile#9 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/mapper_none/citrus_mapper_none.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/mapper_serial/citrus_mapper_serial.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/mapper_std/Makefile#9 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/mapper_std/citrus_mapper_std.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv_modules/mapper_zone/citrus_mapper_zone.c#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/Makefile#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/csmapper/BIG5/mapper.dir.BIG5.src#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/csmapper/CNS/mapper.dir.CNS.src#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/csmapper/JIS/mapper.dir.JIS.src#8 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/esdb/APPLE/MAC.alias#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/esdb/BIG5/Big5.alias#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/esdb/EBCDIC/EBCDIC.alias#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/esdb/EUC/EUC.alias#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/esdb/GB/GB.alias#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/esdb/ISO-2022/ISO-2022.alias#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/esdb/ISO-8859/ISO-8859.alias#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/esdb/ISO646/ISO646.alias#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/esdb/TCVN/TCVN.alias#4 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/iconv/Makefile#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/i18n/iconv/iconv.dir#5 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/man/man5/Makefile#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/man/man5/csmapper.5#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/share/man/man5/esdb.5#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/Makefile#6 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/gnu/Makefile#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/gnu/gnu.c#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/posix/posix.c#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ARMSCII-8-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ASCII-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/BIG5#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/BIG5-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/CP1131#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/CP1131-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/CP1251-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/CP866-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/CP949#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/CP949-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/EUC-CN-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/EUC-JP#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/EUC-JP-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/EUC-KR#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/EUC-KR-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/GB18030-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/GB2312-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/GBK-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-1-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-10-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-11-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-13-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-14-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-15-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-16-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-2-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-3-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-4-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-5-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-6-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-7-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-8-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/ISO8859-9-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/KOI8-R-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/KOI8-U-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/PT154-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/SHIFT_JIS#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/SHIFT_JIS-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/UTF-7#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/UTF-7-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/UTF-8-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/ref/VISCII-rev#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/refgen/Makefile#2 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/tablegen/Makefile#3 edit .. //depot/projects/soc2009/gabor_iconv/extracted/tools/test/iconv/tablegen/tablegen.c#4 edit .. //depot/projects/soc2009/gabor_iconv/extracted/usr.bin/iconv/iconv.1#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/usr.bin/iconv/iconv.c#7 edit .. //depot/projects/soc2009/gabor_iconv/extracted/usr.bin/mkesdb/mkesdb.1#2 edit Differences ... ==== //depot/projects/soc2009/gabor_iconv/extracted/Makefile#2 (text+ko) ==== @@ -7,4 +7,10 @@ usr.bin \ share +freshinstall: + cd include && make install + cd lib && make all install clean + cd usr.bin && make all install clean + cd share && make all install clean + .include <bsd.subdir.mk> ==== //depot/projects/soc2009/gabor_iconv/extracted/TESTING-HOWTO#7 (text+ko) ==== @@ -1,36 +1,12 @@ -The following instructions describe how you can try out Citrus iconv on -your system. +To install tthe library, the utility and the necessary pieces of metadata +on your system, jusr run "make freshinstall" in the top-level directory +(where this file is located). -You have to accomplish the following steps: +Now, you have the iconv utility installed in /usr/bin, and the library +in /usr/lib. The library is installed as libiconv.so, just like the GNU +version, so in some cases, they might interfere. Use this software for +your own responsability. -1, Install includes. - - cd include - make install - -2, Install the library. - - cd lib/libiconv - make all - make install LIBDIR=/usr/lib - -2, Install library modules. - - cd lib/libiconv_modules - make all - mkdir /usr/lib/i18n - make install - -3, Install the utilities. - - cd usr.bin - make all - make install BINDIR=/usr/bin - -2, Install conversion tables. - - cd share/i18n - make all install - -Now, you have the iconv utility installed in /usr/bin, and the library -in /usr/lib. +-- +Gabor Kovesdan +gabor@FreeBSD.org ==== //depot/projects/soc2009/gabor_iconv/extracted/include/iconv.h#3 (text+ko) ==== @@ -1,7 +1,8 @@ /* $NetBSD: iconv.h,v 1.6 2005/02/03 04:39:32 perry Exp $ */ /*- - * Copyright (c)2003 Citrus Project, + * Copyright (c) 2003 Citrus Project, + * Copyright (c) 2009, 2010 Gabor Kovesdan <gabor@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,13 +65,21 @@ */ /* Historical versions */ -#define libiconv_open iconv_open -#define libiconv_close iconv_close -#define libiconv iconv +#define libiconv_open iconv_open +#define libiconv_open_into iconv_open_into +#define libiconv_close iconv_close +#define libiconv iconv /* We have iconvctl() */ #define _LIBICONV_VERSION 0x0108 +extern int _libiconv_version; +typedef struct { + void *spaceholder[8]; +} iconv_allocation_t; + +int iconv_open_into(const char *, const char *, iconv_allocation_t *); + /* * iconvctl() request macros */ @@ -91,9 +100,31 @@ void *data; }; +typedef void (*iconv_unicode_mb_to_uc_fallback) (const char*, + size_t, void (*write_replacement) (const unsigned int *, + size_t, void*), void*, void*); +typedef void (*iconv_unicode_uc_to_mb_fallback) (unsigned int, + void (*write_replacement) (const char *, size_t, void*), + void*, void*); +typedef void (*iconv_wchar_mb_to_wc_fallback) (const char*, size_t, + void (*write_replacement) (const wchar_t *, size_t, void*), + void*, void*); +typedef void (*iconv_wchar_wc_to_mb_fallback) (wchar_t, + void (*write_replacement) (const char *, size_t, void*), + void*, void*); + +struct iconv_fallbacks { + iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback; + iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback; + iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback; + iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback; + void *data; +}; + + void iconvlist(int (*do_one) (unsigned int, const char * const *, void *), void *); -const char *_iconv_canonalize(const char *); +const char *iconv_canonicalize(const char *); int iconvctl(iconv_t, int, void *); __END_DECLS ==== //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/Makefile#8 (text+ko) ==== @@ -3,14 +3,17 @@ LIB= iconv SHLIB_MAJOR= 4 MAN= iconv.3 \ - iconvctl.3 -SRCS= _iconv.c \ - citrus_bcs.c \ + iconvctl.3 \ + iconv_canonicalize.3 \ + iconvlist.3 \ + __iconv_get_list.3 +MLINKS= iconv.3 iconv_open.3 \ + iconv.3 iconv_close.3 \ + __iconv_get_list.3 __iconv_free_list.3 +SRCS= citrus_bcs.c \ citrus_bcs_strtol.c \ citrus_bcs_strtoul.c \ citrus_csmapper.c \ - citrus_ctype.c \ - citrus_ctype_fallback.c \ citrus_db.c \ citrus_db_factory.c \ citrus_db_hash.c \ @@ -26,9 +29,11 @@ citrus_none.c \ citrus_pivot_factory.c \ citrus_prop.c \ - citrus_stdenc.c + citrus_stdenc.c \ + citrus_stdenc_fallbacks.c \ + iconv.c CFLAGS+= --param max-inline-insns-single=128 -I ${.CURDIR}/../../include -WARNS?= 3 +WARNS?= 6 .include <bsd.lib.mk> ==== //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/_iconv.c#7 (text+ko) ==== @@ -1,256 +1,0 @@ -/* $NetBSD: iconv.c,v 1.11 2009/03/03 16:22:33 explorer Exp $ */ - -/*- - * Copyright (c)2003 Citrus Project, - * 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 <sys/cdefs.h> - -#include <assert.h> -#include <errno.h> -#include <iconv.h> -#include <paths.h> -#include <stdbool.h> -#include <sys/queue.h> - -#include "netbsdism.h" - -#ifdef __weak_alias -__weak_alias(iconv, _iconv) -__weak_alias(iconv_open, _iconv_open) -__weak_alias(iconv_close, _iconv_close) -#endif - -#include <sys/types.h> -#include <string.h> -#include <stdlib.h> -#include "citrus_types.h" -#include "citrus_module.h" -#include "citrus_esdb.h" -#include "citrus_hash.h" -#include "citrus_iconv.h" - -#define ISBADF(_h_) (!(_h_) || (_h_) == (iconv_t)-1) - -iconv_t -iconv_open(const char *out, const char *in) -{ - int ret; - struct _citrus_iconv *handle; - char *out_truncated; - char *p; - - /* - * Remove anything following a //, as these are options (like - * //ignore, //translate, etc) and we just don't handle them. - * This is for compatibilty with software that uses thees - * blindly. - */ - out_truncated = strdup(out); - if (out_truncated == NULL) { - errno = ENOMEM; - return ((iconv_t)-1); - } - - p = out_truncated; - while (*p != 0) { - if (p[0] == '/' && p[1] == '/') { - *p = '\0'; - break; - } - p++; - } - - ret = _citrus_iconv_open(&handle, _PATH_ICONV, in, out_truncated); - free(out_truncated); - if (ret) { - errno = ret == ENOENT ? EINVAL : ret; - return ((iconv_t)-1); - } - - if (strcasestr(out, "//IGNORE")) - handle->cv_shared->ci_discard_ilseq = true; - else - handle->cv_shared->ci_discard_ilseq = false; - - return ((iconv_t)(void *)handle); -} - -int -iconv_close(iconv_t handle) -{ - if (ISBADF(handle)) { - errno = EBADF; - return (-1); - } - - _citrus_iconv_close((struct _citrus_iconv *)(void *)handle); - - return (0); -} - -size_t -iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout) -{ - int err; - size_t ret; - - if (ISBADF(handle)) { - errno = EBADF; - return ((size_t)-1); - } - - err = _citrus_iconv_convert( - (struct _citrus_iconv *)(void *)handle, in, szin, out, szout, - 0, &ret); - if (err) { - errno = err; - ret = (size_t)-1; - } - - return (ret); -} - -size_t -__iconv(iconv_t handle, const char **in, size_t *szin, char **out, - size_t *szout, u_int32_t flags, size_t *invalids) -{ - int err; - size_t ret; - - if (ISBADF(handle)) { - errno = EBADF; - return ((size_t)-1); - } - - err = _citrus_iconv_convert( - (struct _citrus_iconv *)(void *)handle, in, szin, out, szout, - flags, &ret); - if (invalids) - *invalids = ret; - if (err) { - errno = err; - ret = (size_t)-1; - } - - return (ret); -} - -int -__iconv_get_list(char ***rlist, size_t *rsz, bool l) -{ - int ret; - - ret = _citrus_esdb_get_list(rlist, rsz, l); - if (ret) { - errno = ret; - return -1; - } - - return 0; -} - -void -__iconv_free_list(char **list, size_t sz) -{ - _citrus_esdb_free_list(list, sz); -} - -/* - * GNU-compatibile non-standard interfaces. - */ -void -iconvlist(int (*do_one) (unsigned int, const char * const *, - void *), void *data) -{ - char **list; - size_t sz; - - if (__iconv_get_list(&list, &sz, true)) - list = NULL; - - const char * const * names = (const char * const *)list; - unsigned int i = sz; - do_one(i, names, data); - - __iconv_free_list(list, sz); -} - -__inline const char -*_iconv_canonalize(const char *name) -{ - return (_citrus_iconv_canonalize(name)); -} - -int -iconvctl(iconv_t cd, int request, void *argument) -{ - int *i = (int *)argument; - struct iconv_hooks *hooks = (struct iconv_hooks *)argument; - struct _citrus_iconv *cv = (struct _citrus_iconv *)(void *)cd; - const char *convname; - char *src, *dst; - - if (ISBADF(cd)) { - errno = EBADF; - return (-1); - } - - switch (request) { - case ICONV_TRIVIALP: - convname = cv->cv_shared->ci_convname; - dst = strchr(convname, '/'); - - strlcpy(src, convname, dst - convname + 1); - dst++; - if ((convname == NULL) || (src == NULL) || (dst == NULL)) - return (-1); - *i = strcmp(src, dst) == 0 ? 1 : 0; - return (0); - case ICONV_GET_TRANSLITERATE: - *i = 1; - return (0); - case ICONV_SET_TRANSLITERATE: - return ((*i == 1) ? 0 : -1); - case ICONV_GET_DISCARD_ILSEQ: - *i = cv->cv_shared->ci_discard_ilseq ? 1 : 0; - return (0); - case ICONV_SET_DISCARD_ILSEQ: - cv->cv_shared->ci_discard_ilseq = *i; - return (0); - case ICONV_SET_HOOKS: - if (hooks != NULL) - cv->cv_shared->ci_hooks = *hooks; - else { - cv->cv_shared->ci_hooks.uc_hook = NULL; - cv->cv_shared->ci_hooks.wc_hook = NULL; - cv->cv_shared->ci_hooks.data = NULL; - } - return (0); - default: - errno = EINVAL; - return (-1); - } -} ==== //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_ctype.c#6 (text+ko) ==== @@ -1,173 +1,0 @@ -/* $NetBSD: citrus_ctype.c,v 1.5 2008/06/14 16:01:07 tnozaki Exp $ */ - -/*- - * Copyright (c)1999, 2000, 2001, 2002 Citrus Project, - * 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 <sys/cdefs.h> - -#include <sys/types.h> -#include <assert.h> -#include <errno.h> -#include <limits.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <stddef.h> -#include <wchar.h> -#include "citrus_module.h" -#include "citrus_ctype.h" -#include "citrus_ctype_fallback.h" -#include "citrus_none.h" -#include _CITRUS_DEFAULT_CTYPE_HEADER - -_citrus_ctype_rec_t _citrus_ctype_default = { - &_CITRUS_DEFAULT_CTYPE_OPS, /* cc_ops */ - NULL, /* cc_closure */ - NULL /* cc_module */ -}; - -static int _initctypemodule(_citrus_ctype_t, char const *, _citrus_module_t, - void *, size_t, size_t); - -static int -_initctypemodule(_citrus_ctype_t cc, char const *modname, - _citrus_module_t handle, void *variable, size_t lenvar, - size_t szpriv) -{ - int ret; - _citrus_ctype_getops_t getops; - - cc->cc_module = handle; - - getops = (_citrus_ctype_getops_t)_citrus_find_getops(cc->cc_module, - modname, - "ctype"); - if (getops == NULL) - return (EINVAL); - - cc->cc_ops = (_citrus_ctype_ops_rec_t *)malloc(sizeof(*cc->cc_ops)); - if (cc->cc_ops == NULL) - return (ENOMEM); - - ret = (*getops)(cc->cc_ops, sizeof(*cc->cc_ops), - _CITRUS_CTYPE_ABI_VERSION); - if (ret) - goto bad; - - /* If return ABI version is not expected, fixup it here*/ - switch (cc->cc_ops->co_abi_version) { - case 0x00000001: - cc->cc_ops->co_btowc = &_citrus_ctype_btowc_fallback; - cc->cc_ops->co_wctob = &_citrus_ctype_wctob_fallback; - /* FALLTHROUGH */ - case 0x00000002: - /* FALLTHROUGH */ - default: - break; - } - - /* validation check */ - if (cc->cc_ops->co_init == NULL || - cc->cc_ops->co_uninit == NULL || - cc->cc_ops->co_get_mb_cur_max == NULL || - cc->cc_ops->co_mblen == NULL || - cc->cc_ops->co_mbrlen == NULL || - cc->cc_ops->co_mbrtowc == NULL || - cc->cc_ops->co_mbsinit == NULL || - cc->cc_ops->co_mbsrtowcs == NULL || - cc->cc_ops->co_mbstowcs == NULL || - cc->cc_ops->co_mbtowc == NULL || - cc->cc_ops->co_wcrtomb == NULL || - cc->cc_ops->co_wcsrtombs == NULL || - cc->cc_ops->co_wcstombs == NULL || - cc->cc_ops->co_wctomb == NULL || - cc->cc_ops->co_btowc == NULL || - cc->cc_ops->co_wctob == NULL) - goto bad; - - /* init and get closure */ - ret = (*cc->cc_ops->co_init)( - &cc->cc_closure, variable, lenvar, szpriv); - if (ret) - goto bad; - - return (0); - -bad: - if (cc->cc_ops) - free(cc->cc_ops); - cc->cc_ops = NULL; - - return (ret); -} - -int -_citrus_ctype_open(_citrus_ctype_t *rcc, - char const *encname, void *variable, size_t lenvar, - size_t szpriv) -{ - int ret; - _citrus_module_t handle; - _citrus_ctype_t cc; - - if (!strcmp(encname, _CITRUS_DEFAULT_CTYPE_NAME)) { - *rcc = &_citrus_ctype_default; - return (0); - } - ret = _citrus_load_module(&handle, encname); - if (ret) - return (ret); - - cc = calloc(1, sizeof(*cc)); - if (!cc) { - _citrus_unload_module(handle); - return (errno); - } - - ret = _initctypemodule(cc, encname, handle, variable, lenvar, szpriv); - if (ret) { - _citrus_unload_module(cc->cc_module); - free(cc); - return (ret); - } - - *rcc = cc; - - return (0); -} - -void -_citrus_ctype_close(_citrus_ctype_t cc) -{ - - if (cc == &_citrus_ctype_default) - return; - (*cc->cc_ops->co_uninit)(cc->cc_closure); - free(cc->cc_ops); - _citrus_unload_module(cc->cc_module); - free(cc); -} ==== //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_ctype.h#6 (text+ko) ==== @@ -1,156 +1,0 @@ -/* $NetBSD: citrus_ctype.h,v 1.2 2003/03/05 20:18:15 tshiozak Exp $ */ - -/*- - * Copyright (c)2002 Citrus Project, - * 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 _CITRUS_CTYPE_H_ -#define _CITRUS_CTYPE_H_ - -#include "citrus_ctype_local.h" - -typedef struct _citrus_ctype_rec *_citrus_ctype_t; - -__BEGIN_DECLS -int _citrus_ctype_open(_citrus_ctype_t * __restrict, - char const * __restrict, void * __restrict, - size_t, size_t); -void _citrus_ctype_close(_citrus_ctype_t); -__END_DECLS - -static __inline unsigned -_citrus_ctype_get_mb_cur_max(_citrus_ctype_t cc) -{ - - return (*cc->cc_ops->co_get_mb_cur_max)(cc->cc_closure); -} - -static __inline int -_citrus_ctype_mblen(_citrus_ctype_t cc, const char *s, size_t n, int *nresult) -{ - - return (*cc->cc_ops->co_mblen)(cc->cc_closure, s, n, nresult); -} - -static __inline int -_citrus_ctype_mbrlen(_citrus_ctype_t cc, const char *s, size_t n, - void *pspriv, size_t *nresult) -{ - - return (*cc->cc_ops->co_mbrlen)(cc->cc_closure, s, n, pspriv, nresult); -} - -static __inline int -_citrus_ctype_mbrtowc(_citrus_ctype_t cc, wchar_t *pwc, const char *s, - size_t n, void *pspriv, size_t *nresult) -{ - - return (*cc->cc_ops->co_mbrtowc)(cc->cc_closure, pwc, s, n, pspriv, - nresult); -} - -static __inline int -_citrus_ctype_mbsinit(_citrus_ctype_t cc, void const *pspriv, int *nresult) -{ - - return (*cc->cc_ops->co_mbsinit)(cc->cc_closure, pspriv, nresult); -} - -static __inline int -_citrus_ctype_mbsrtowcs(_citrus_ctype_t cc, wchar_t *pwcs, const char **s, - size_t n, void *pspriv, size_t *nresult) -{ - - return (*cc->cc_ops->co_mbsrtowcs)(cc->cc_closure, pwcs, s, n, pspriv, - nresult); -} - -static __inline int -_citrus_ctype_mbstowcs(_citrus_ctype_t cc, wchar_t *pwcs, const char *s, - size_t n, size_t *nresult) -{ - - return (*cc->cc_ops->co_mbstowcs)(cc->cc_closure, pwcs, s, n, nresult); -} - -static __inline int -_citrus_ctype_mbtowc(_citrus_ctype_t cc, wchar_t *pw, const char *s, size_t n, - int *nresult) -{ - - return (*cc->cc_ops->co_mbtowc)(cc->cc_closure, pw, s, n, nresult); -} - -static __inline int -_citrus_ctype_wcrtomb(_citrus_ctype_t cc, char *s, wchar_t wc, - void *pspriv, size_t *nresult) -{ - - return (*cc->cc_ops->co_wcrtomb)(cc->cc_closure, s, wc, pspriv, - nresult); -} - -static __inline int -_citrus_ctype_wcsrtombs(_citrus_ctype_t cc, char *s, const wchar_t **ppwcs, - size_t n, void *pspriv, size_t *nresult) -{ - - return (*cc->cc_ops->co_wcsrtombs)(cc->cc_closure, s, ppwcs, n, - pspriv, nresult); -} - -static __inline int -_citrus_ctype_wcstombs(_citrus_ctype_t cc, char *s, const wchar_t *wcs, - size_t n, size_t *nresult) -{ - - return (*cc->cc_ops->co_wcstombs)(cc->cc_closure, s, wcs, n, nresult); -} - -static __inline int -_citrus_ctype_wctomb(_citrus_ctype_t cc, char *s, wchar_t wc, int *nresult) -{ - - return (*cc->cc_ops->co_wctomb)(cc->cc_closure, s, wc, nresult); -} - -static __inline int -_citrus_ctype_btowc(_citrus_ctype_t cc, int c, wint_t *wcresult) -{ - - return (*cc->cc_ops->co_btowc)(cc, c, wcresult); -} - -static __inline int -_citrus_ctype_wctob(_citrus_ctype_t cc, wint_t c, int *cresult) -{ - - return (*cc->cc_ops->co_wctob)(cc, c, cresult); -} - -extern _citrus_ctype_rec_t _citrus_ctype_default; - -#endif ==== //depot/projects/soc2009/gabor_iconv/extracted/lib/libiconv/citrus_ctype_fallback.c#6 (text+ko) ==== @@ -1,101 +1,0 @@ -/* $NetBSD: citrus_ctype_fallback.c,v 1.2 2003/06/27 14:52:25 yamt Exp $ */ - -/*- - * Copyright (c)2003 Citrus Project, - * 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. >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001132215.o0DMFp29033716>