Sync Citrus iconv support with NetBSD.
authorHasso Tepper <hasso@dragonflybsd.org>
Thu, 10 Apr 2008 10:21:13 +0000 (10:21 +0000)
committerHasso Tepper <hasso@dragonflybsd.org>
Thu, 10 Apr 2008 10:21:13 +0000 (10:21 +0000)
Obtained-from: NetBSD

704 files changed:
etc/mtree/BSD.usr.dist
lib/i18n_module/BIG5/Makefile
lib/i18n_module/DECHanyu/Makefile [new file with mode: 0644]
lib/i18n_module/HZ/Makefile [new file with mode: 0644]
lib/i18n_module/JOHAB/Makefile [new file with mode: 0644]
lib/i18n_module/Makefile
lib/i18n_module/Makefile.inc
lib/i18n_module/UES/Makefile [new file with mode: 0644]
lib/i18n_module/VIQR/Makefile [new file with mode: 0644]
lib/i18n_module/ZW/Makefile [new file with mode: 0644]
lib/libc/citrus/citrus_bcs.c
lib/libc/citrus/citrus_bcs.h
lib/libc/citrus/citrus_csmapper.c
lib/libc/citrus/citrus_csmapper.h
lib/libc/citrus/citrus_ctype.c
lib/libc/citrus/citrus_ctype.h
lib/libc/citrus/citrus_ctype_fallback.c
lib/libc/citrus/citrus_ctype_fallback.h
lib/libc/citrus/citrus_ctype_local.h
lib/libc/citrus/citrus_ctype_template.h
lib/libc/citrus/citrus_db.c
lib/libc/citrus/citrus_db.h
lib/libc/citrus/citrus_db_factory.c
lib/libc/citrus/citrus_db_factory.h
lib/libc/citrus/citrus_db_file.h
lib/libc/citrus/citrus_db_hash.c
lib/libc/citrus/citrus_db_hash.h
lib/libc/citrus/citrus_esdb.c
lib/libc/citrus/citrus_esdb.h
lib/libc/citrus/citrus_esdb_file.h
lib/libc/citrus/citrus_hash.c
lib/libc/citrus/citrus_hash.h
lib/libc/citrus/citrus_iconv.c
lib/libc/citrus/citrus_iconv.h
lib/libc/citrus/citrus_iconv_local.h
lib/libc/citrus/citrus_lookup.c
lib/libc/citrus/citrus_lookup.h
lib/libc/citrus/citrus_lookup_factory.c
lib/libc/citrus/citrus_lookup_factory.h
lib/libc/citrus/citrus_lookup_file.h
lib/libc/citrus/citrus_mapper.c
lib/libc/citrus/citrus_mapper.h
lib/libc/citrus/citrus_mapper_local.h
lib/libc/citrus/citrus_memstream.c
lib/libc/citrus/citrus_memstream.h
lib/libc/citrus/citrus_mmap.c
lib/libc/citrus/citrus_mmap.h
lib/libc/citrus/citrus_module.c
lib/libc/citrus/citrus_module.h
lib/libc/citrus/citrus_namespace.h
lib/libc/citrus/citrus_none.c
lib/libc/citrus/citrus_none.h
lib/libc/citrus/citrus_pivot_factory.c
lib/libc/citrus/citrus_pivot_factory.h
lib/libc/citrus/citrus_pivot_file.h
lib/libc/citrus/citrus_prop.c [new file with mode: 0644]
lib/libc/citrus/citrus_prop.h [new file with mode: 0644]
lib/libc/citrus/citrus_region.h
lib/libc/citrus/citrus_stdenc.c
lib/libc/citrus/citrus_stdenc.h
lib/libc/citrus/citrus_stdenc_local.h
lib/libc/citrus/citrus_stdenc_template.h
lib/libc/citrus/citrus_types.h
lib/libc/citrus/modules/citrus_big5.c
lib/libc/citrus/modules/citrus_big5.h
lib/libc/citrus/modules/citrus_dechanyu.c [new file with mode: 0644]
lib/libc/citrus/modules/citrus_dechanyu.h [copied from lib/libc/citrus/citrus_db_hash.h with 79% similarity]
lib/libc/citrus/modules/citrus_euc.c
lib/libc/citrus/modules/citrus_euc.h
lib/libc/citrus/modules/citrus_euctw.c
lib/libc/citrus/modules/citrus_euctw.h
lib/libc/citrus/modules/citrus_gbk2k.c
lib/libc/citrus/modules/citrus_hz.c [new file with mode: 0644]
lib/libc/citrus/modules/citrus_hz.h [copied from lib/libc/citrus/modules/citrus_utf1632.h with 80% similarity]
lib/libc/citrus/modules/citrus_iconv_none.c
lib/libc/citrus/modules/citrus_iconv_none.h
lib/libc/citrus/modules/citrus_iconv_std.c
lib/libc/citrus/modules/citrus_iconv_std.h
lib/libc/citrus/modules/citrus_iconv_std_local.h
lib/libc/citrus/modules/citrus_iso2022.c
lib/libc/citrus/modules/citrus_iso2022.h
lib/libc/citrus/modules/citrus_johab.c [new file with mode: 0644]
lib/libc/citrus/modules/citrus_johab.h [copied from lib/libc/citrus/modules/citrus_utf1632.h with 80% similarity]
lib/libc/citrus/modules/citrus_mapper_646.c
lib/libc/citrus/modules/citrus_mapper_646.h
lib/libc/citrus/modules/citrus_mapper_none.c
lib/libc/citrus/modules/citrus_mapper_none.h
lib/libc/citrus/modules/citrus_mapper_serial.c
lib/libc/citrus/modules/citrus_mapper_serial.h
lib/libc/citrus/modules/citrus_mapper_std.c
lib/libc/citrus/modules/citrus_mapper_std.h
lib/libc/citrus/modules/citrus_mapper_std_file.h
lib/libc/citrus/modules/citrus_mapper_std_local.h
lib/libc/citrus/modules/citrus_mapper_zone.c
lib/libc/citrus/modules/citrus_mapper_zone.h
lib/libc/citrus/modules/citrus_mskanji.c
lib/libc/citrus/modules/citrus_mskanji.h
lib/libc/citrus/modules/citrus_ues.c [new file with mode: 0644]
lib/libc/citrus/modules/citrus_ues.h [copied from lib/libc/citrus/modules/citrus_utf1632.h with 80% similarity]
lib/libc/citrus/modules/citrus_utf1632.c
lib/libc/citrus/modules/citrus_utf1632.h
lib/libc/citrus/modules/citrus_utf7.c
lib/libc/citrus/modules/citrus_utf7.h
lib/libc/citrus/modules/citrus_utf8.c
lib/libc/citrus/modules/citrus_utf8.h
lib/libc/citrus/modules/citrus_viqr.c [new file with mode: 0644]
lib/libc/citrus/modules/citrus_viqr.h [copied from lib/libc/citrus/modules/citrus_utf1632.h with 80% similarity]
lib/libc/citrus/modules/citrus_zw.c [new file with mode: 0644]
lib/libc/citrus/modules/citrus_zw.h [copied from lib/libc/citrus/modules/citrus_utf1632.h with 80% similarity]
share/i18n/csmapper/APPLE/CELTIC%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/CENTEURO%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/CROATIAN%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/CYRILLIC%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/DINGBATS%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/GAELIC%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/GREEK%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/ICELAND%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/INUIT%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/MAC.part [new file with mode: 0644]
share/i18n/csmapper/APPLE/Makefile.inc [new file with mode: 0644]
share/i18n/csmapper/APPLE/ROMAN%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/ROMANIAN%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/THAI%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/TURKISH%UCS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%CELTIC.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%CENTEURO.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%CROATIAN.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%CYRILLIC.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%DINGBATS.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%GAELIC.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%GREEK.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%ICELAND.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%INUIT.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%ROMAN.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%ROMANIAN.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%THAI.src [new file with mode: 0644]
share/i18n/csmapper/APPLE/UCS%TURKISH.src [new file with mode: 0644]
share/i18n/csmapper/AST/ARMSCII-7%UCS.src [new file with mode: 0644]
share/i18n/csmapper/AST/ARMSCII-8%UCS.src [new file with mode: 0644]
share/i18n/csmapper/AST/ARMSCII-8A%UCS.src [new file with mode: 0644]
share/i18n/csmapper/AST/ARMSCII.part [new file with mode: 0644]
share/i18n/csmapper/AST/Makefile.inc [new file with mode: 0644]
share/i18n/csmapper/AST/UCS%ARMSCII-7.src [new file with mode: 0644]
share/i18n/csmapper/AST/UCS%ARMSCII-8.src [new file with mode: 0644]
share/i18n/csmapper/AST/UCS%ARMSCII-8A.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/Big5@1984%UCS.src [moved from share/i18n/csmapper/MISC/Big5%UCS.src with 97% similarity]
share/i18n/csmapper/BIG5/Big5EXT@2003%UCS.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/Big5EXT@E%UCS.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/Big5EXT@IBM%UCS.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/Big5EXT@Plus%UCS.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/Big5UDA%UCS.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/ETen%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/ETen%UCS@SIP.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/HKSCS%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/HKSCS%UCS@SIP.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/Makefile.inc [new file with mode: 0644]
share/i18n/csmapper/BIG5/UCS%Big5@1984.src [moved from share/i18n/csmapper/MISC/UCS%Big5.src with 98% similarity]
share/i18n/csmapper/BIG5/UCS%Big5EXT@2003.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/UCS%Big5EXT@E.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/UCS%Big5EXT@IBM.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/UCS%Big5EXT@Plus.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/UCS%Big5UDA.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/UCS@BMP%ETen.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/UCS@BMP%HKSCS.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/UCS@SIP%ETen.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/UCS@SIP%HKSCS.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/charset.pivot.BIG5.src [new file with mode: 0644]
share/i18n/csmapper/BIG5/mapper.dir.BIG5.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-1%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-2%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-3%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-3%UCS@SIP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-4%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-4%UCS@SIP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-5%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-5%UCS@SIP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-6%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-6%UCS@SIP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-7%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/CNS11643-7%UCS@SIP.src [new file with mode: 0644]
share/i18n/csmapper/CNS/Makefile.inc [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS%CNS11643-1.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS%CNS11643-2.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@BMP%CNS11643-3.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@BMP%CNS11643-4.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@BMP%CNS11643-5.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@BMP%CNS11643-6.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@BMP%CNS11643-7.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@SIP%CNS11643-3.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@SIP%CNS11643-4.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@SIP%CNS11643-5.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@SIP%CNS11643-6.src [new file with mode: 0644]
share/i18n/csmapper/CNS/UCS@SIP%CNS11643-7.src [new file with mode: 0644]
share/i18n/csmapper/CNS/charset.pivot.CNS.src [new file with mode: 0644]
share/i18n/csmapper/CNS/mapper.dir.CNS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP.part
share/i18n/csmapper/CP/CP037%UCS.src
share/i18n/csmapper/CP/CP038%UCS.src
share/i18n/csmapper/CP/CP10000%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP10006%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP10007%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP10029%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1006%UCS.src
share/i18n/csmapper/CP/CP10079%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP10081%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1026%UCS.src
share/i18n/csmapper/CP/CP1046%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1124%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1125%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1129%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1131%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1133%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1161%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1162%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1163%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP1250%UCS.src
share/i18n/csmapper/CP/CP1251%UCS.src
share/i18n/csmapper/CP/CP1252%UCS.src
share/i18n/csmapper/CP/CP1253%UCS.src
share/i18n/csmapper/CP/CP1254%UCS.src
share/i18n/csmapper/CP/CP1255%UCS.src
share/i18n/csmapper/CP/CP1256%UCS.src
share/i18n/csmapper/CP/CP1257%UCS.src
share/i18n/csmapper/CP/CP1258%UCS.src
share/i18n/csmapper/CP/CP273%UCS.src
share/i18n/csmapper/CP/CP274%UCS.src
share/i18n/csmapper/CP/CP275%UCS.src
share/i18n/csmapper/CP/CP277%UCS.src
share/i18n/csmapper/CP/CP278%UCS.src
share/i18n/csmapper/CP/CP280%UCS.src
share/i18n/csmapper/CP/CP281%UCS.src
share/i18n/csmapper/CP/CP284%UCS.src
share/i18n/csmapper/CP/CP285%UCS.src
share/i18n/csmapper/CP/CP290%UCS.src
share/i18n/csmapper/CP/CP297%UCS.src
share/i18n/csmapper/CP/CP420%UCS.src
share/i18n/csmapper/CP/CP423%UCS.src
share/i18n/csmapper/CP/CP424%UCS.src
share/i18n/csmapper/CP/CP437%UCS.src
share/i18n/csmapper/CP/CP500%UCS.src
share/i18n/csmapper/CP/CP737%UCS.src
share/i18n/csmapper/CP/CP775%UCS.src
share/i18n/csmapper/CP/CP850%UCS.src
share/i18n/csmapper/CP/CP851%UCS.src
share/i18n/csmapper/CP/CP852%UCS.src
share/i18n/csmapper/CP/CP853%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP855%UCS.src
share/i18n/csmapper/CP/CP856%UCS.src
share/i18n/csmapper/CP/CP857%UCS.src
share/i18n/csmapper/CP/CP858%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP860%UCS.src
share/i18n/csmapper/CP/CP861%UCS.src
share/i18n/csmapper/CP/CP862%UCS.src
share/i18n/csmapper/CP/CP863%UCS.src
share/i18n/csmapper/CP/CP864%UCS.src
share/i18n/csmapper/CP/CP865%UCS.src
share/i18n/csmapper/CP/CP866%UCS.src
share/i18n/csmapper/CP/CP868%UCS.src
share/i18n/csmapper/CP/CP869%UCS.src
share/i18n/csmapper/CP/CP870%UCS.src
share/i18n/csmapper/CP/CP871%UCS.src
share/i18n/csmapper/CP/CP874%UCS.src
share/i18n/csmapper/CP/CP875%UCS.src
share/i18n/csmapper/CP/CP880%UCS.src
share/i18n/csmapper/CP/CP891%UCS.src
share/i18n/csmapper/CP/CP903%UCS.src
share/i18n/csmapper/CP/CP904%UCS.src
share/i18n/csmapper/CP/CP905%UCS.src
share/i18n/csmapper/CP/CP918%UCS.src
share/i18n/csmapper/CP/CP922%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP932UDA%UCS.src [new file with mode: 0644]
share/i18n/csmapper/CP/CP932VDC@IBM%UCS.src [copied from share/i18n/csmapper/CP/CP932EXT%UCS.src with 52% similarity]
share/i18n/csmapper/CP/CP932VDC@NEC_IBM%UCS.src [moved from share/i18n/csmapper/CP/CP932EXT%UCS.src with 50% similarity]
share/i18n/csmapper/CP/CP936EXT%UCS.src
share/i18n/csmapper/CP/CP942EXT%UCS.src [copied from share/i18n/csmapper/JIS/JISX0208@1990%UCS.src with 93% similarity]
share/i18n/csmapper/CP/CP949EXT%UCS.src
share/i18n/csmapper/CP/CP950%UCS.src
share/i18n/csmapper/CP/Makefile.inc
share/i18n/csmapper/CP/UCS%CP037.src
share/i18n/csmapper/CP/UCS%CP038.src
share/i18n/csmapper/CP/UCS%CP10000.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP10006.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP10007.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP10029.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1006.src
share/i18n/csmapper/CP/UCS%CP10079.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP10081.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1026.src
share/i18n/csmapper/CP/UCS%CP1046.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1124.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1125.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1129.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1131.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1133.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1161.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1162.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1163.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP1250.src
share/i18n/csmapper/CP/UCS%CP1251.src
share/i18n/csmapper/CP/UCS%CP1252.src
share/i18n/csmapper/CP/UCS%CP1253.src
share/i18n/csmapper/CP/UCS%CP1254.src
share/i18n/csmapper/CP/UCS%CP1255.src
share/i18n/csmapper/CP/UCS%CP1256.src
share/i18n/csmapper/CP/UCS%CP1257.src
share/i18n/csmapper/CP/UCS%CP1258.src
share/i18n/csmapper/CP/UCS%CP273.src
share/i18n/csmapper/CP/UCS%CP274.src
share/i18n/csmapper/CP/UCS%CP275.src
share/i18n/csmapper/CP/UCS%CP277.src
share/i18n/csmapper/CP/UCS%CP278.src
share/i18n/csmapper/CP/UCS%CP280.src
share/i18n/csmapper/CP/UCS%CP281.src
share/i18n/csmapper/CP/UCS%CP284.src
share/i18n/csmapper/CP/UCS%CP285.src
share/i18n/csmapper/CP/UCS%CP290.src
share/i18n/csmapper/CP/UCS%CP297.src
share/i18n/csmapper/CP/UCS%CP420.src
share/i18n/csmapper/CP/UCS%CP423.src
share/i18n/csmapper/CP/UCS%CP424.src
share/i18n/csmapper/CP/UCS%CP437.src
share/i18n/csmapper/CP/UCS%CP500.src
share/i18n/csmapper/CP/UCS%CP737.src
share/i18n/csmapper/CP/UCS%CP775.src
share/i18n/csmapper/CP/UCS%CP850.src
share/i18n/csmapper/CP/UCS%CP851.src
share/i18n/csmapper/CP/UCS%CP852.src
share/i18n/csmapper/CP/UCS%CP853.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP855.src
share/i18n/csmapper/CP/UCS%CP856.src
share/i18n/csmapper/CP/UCS%CP857.src
share/i18n/csmapper/CP/UCS%CP858.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP860.src
share/i18n/csmapper/CP/UCS%CP861.src
share/i18n/csmapper/CP/UCS%CP862.src
share/i18n/csmapper/CP/UCS%CP863.src
share/i18n/csmapper/CP/UCS%CP864.src
share/i18n/csmapper/CP/UCS%CP865.src
share/i18n/csmapper/CP/UCS%CP866.src
share/i18n/csmapper/CP/UCS%CP868.src
share/i18n/csmapper/CP/UCS%CP869.src
share/i18n/csmapper/CP/UCS%CP870.src
share/i18n/csmapper/CP/UCS%CP871.src
share/i18n/csmapper/CP/UCS%CP874.src
share/i18n/csmapper/CP/UCS%CP875.src
share/i18n/csmapper/CP/UCS%CP880.src
share/i18n/csmapper/CP/UCS%CP891.src
share/i18n/csmapper/CP/UCS%CP903.src
share/i18n/csmapper/CP/UCS%CP904.src
share/i18n/csmapper/CP/UCS%CP905.src
share/i18n/csmapper/CP/UCS%CP918.src
share/i18n/csmapper/CP/UCS%CP922.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP932UDA.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP932VDC@IBM.src [moved from share/i18n/csmapper/CP/UCS%CP932EXT.src with 78% similarity]
share/i18n/csmapper/CP/UCS%CP932VDC@NEC_IBM.src [new file with mode: 0644]
share/i18n/csmapper/CP/UCS%CP936EXT.src
share/i18n/csmapper/CP/UCS%CP942EXT.src [copied from share/i18n/csmapper/JIS/UCS%JISX0208@1990.src with 93% similarity]
share/i18n/csmapper/CP/UCS%CP949EXT.src
share/i18n/csmapper/CP/UCS%CP950.src
share/i18n/csmapper/CP/charset.pivot.CP.src
share/i18n/csmapper/CP/mapper.dir.CP.src
share/i18n/csmapper/EBCDIC/EBCDIC-AT-DE%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-AT-DE-A%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-CA-FR%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-DK-NO%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-DK-NO-A%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-ES%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-ES-A%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-ES-S%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-FI-SE%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-FI-SE-A%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-FR%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-IT%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-PT%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC-UK%UCS.src
share/i18n/csmapper/EBCDIC/EBCDIC.part
share/i18n/csmapper/EBCDIC/Makefile.inc
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-AT-DE-A.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-AT-DE.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-CA-FR.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-DK-NO-A.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-DK-NO.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-ES-A.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-ES-S.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-ES.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-FI-SE-A.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-FI-SE.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-FR.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-IT.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-PT.src
share/i18n/csmapper/EBCDIC/UCS%EBCDIC-UK.src
share/i18n/csmapper/GB/GB12345%UCS.src [copied from share/i18n/csmapper/GB/GB2312%UCS.src with 70% similarity]
share/i18n/csmapper/GB/GB18030%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/GB/GB2312%UCS.src
share/i18n/csmapper/GB/GB2312EXT%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GB/GB2312UDA1%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GB/GB2312UDA2%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GB/GBKEXT%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GB/GBKUDA%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GB/ISO-IR-165EXT%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GB/Makefile.inc
share/i18n/csmapper/GB/UCS%GB12345.src [copied from share/i18n/csmapper/GB/UCS%GB2312.src with 70% similarity]
share/i18n/csmapper/GB/UCS%GB2312.src
share/i18n/csmapper/GB/UCS%GB2312EXT.src [new file with mode: 0644]
share/i18n/csmapper/GB/UCS%GB2312UDA1.src [new file with mode: 0644]
share/i18n/csmapper/GB/UCS%GB2312UDA2.src [new file with mode: 0644]
share/i18n/csmapper/GB/UCS%GBKEXT.src [new file with mode: 0644]
share/i18n/csmapper/GB/UCS%GBKUDA.src [new file with mode: 0644]
share/i18n/csmapper/GB/UCS%ISO-IR-165EXT.src [new file with mode: 0644]
share/i18n/csmapper/GB/UCS@BMP%GB18030.src [new file with mode: 0644]
share/i18n/csmapper/GB/charset.pivot.GB.src
share/i18n/csmapper/GB/mapper.dir.GB.src
share/i18n/csmapper/GEORGIAN/GEORGIAN-ACADEMY%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GEORGIAN/GEORGIAN-ACADEMY@OldCapital%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GEORGIAN/GEORGIAN-PS%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GEORGIAN/GEORGIAN-PS@OldCapital%UCS.src [new file with mode: 0644]
share/i18n/csmapper/GEORGIAN/GEORGIAN.part [new file with mode: 0644]
share/i18n/csmapper/GEORGIAN/Makefile.inc [new file with mode: 0644]
share/i18n/csmapper/GEORGIAN/UCS%GEORGIAN-ACADEMY.src [new file with mode: 0644]
share/i18n/csmapper/GEORGIAN/UCS%GEORGIAN-ACADEMY@OldCapital.src [new file with mode: 0644]
share/i18n/csmapper/GEORGIAN/UCS%GEORGIAN-PS.src [new file with mode: 0644]
share/i18n/csmapper/GEORGIAN/UCS%GEORGIAN-PS@OldCapital.src [new file with mode: 0644]
share/i18n/csmapper/ISO-8859/ISO-8859-10%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-11%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-13%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-14%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-15%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-16%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-2%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-3%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-4%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-5%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-6%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-7%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-8%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859-9%UCS.src
share/i18n/csmapper/ISO-8859/ISO-8859.part
share/i18n/csmapper/ISO-8859/Makefile.inc
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-10.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-11.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-13.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-14.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-15.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-16.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-2.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-3.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-4.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-5.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-6.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-7.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-8.src
share/i18n/csmapper/ISO-8859/UCS%ISO-8859-9.src
share/i18n/csmapper/ISO646/ISO646-BASIC@1983%UCS.646
share/i18n/csmapper/ISO646/ISO646-CA%UCS.646
share/i18n/csmapper/ISO646/ISO646-CA2%UCS.646
share/i18n/csmapper/ISO646/ISO646-CN%UCS.646
share/i18n/csmapper/ISO646/ISO646-CU%UCS.646
share/i18n/csmapper/ISO646/ISO646-DE%UCS.646
share/i18n/csmapper/ISO646/ISO646-DK%UCS.646
share/i18n/csmapper/ISO646/ISO646-ES%UCS.646
share/i18n/csmapper/ISO646/ISO646-ES2%UCS.646
share/i18n/csmapper/ISO646/ISO646-FI%UCS.646
share/i18n/csmapper/ISO646/ISO646-FR%UCS.646
share/i18n/csmapper/ISO646/ISO646-FR1%UCS.646
share/i18n/csmapper/ISO646/ISO646-GB%UCS.646
share/i18n/csmapper/ISO646/ISO646-HU%UCS.646
share/i18n/csmapper/ISO646/ISO646-IRV@1983%UCS.646
share/i18n/csmapper/ISO646/ISO646-IT%UCS.646
share/i18n/csmapper/ISO646/ISO646-JP%UCS.646
share/i18n/csmapper/ISO646/ISO646-JP-OCR-B%UCS.646
share/i18n/csmapper/ISO646/ISO646-KR%UCS.646
share/i18n/csmapper/ISO646/ISO646-NO%UCS.646
share/i18n/csmapper/ISO646/ISO646-NO2%UCS.646
share/i18n/csmapper/ISO646/ISO646-PT%UCS.646
share/i18n/csmapper/ISO646/ISO646-PT2%UCS.646
share/i18n/csmapper/ISO646/ISO646-SE%UCS.646
share/i18n/csmapper/ISO646/ISO646-SE2%UCS.646
share/i18n/csmapper/ISO646/ISO646-US%UCS.646
share/i18n/csmapper/ISO646/ISO646-YU%UCS.646
share/i18n/csmapper/ISO646/ISO646.part
share/i18n/csmapper/ISO646/Makefile.inc
share/i18n/csmapper/JIS/JISX0201-KANA%UCS.src
share/i18n/csmapper/JIS/JISX0208@1978%UCS.src [copied from share/i18n/csmapper/JIS/JISX0208@MS%UCS.src with 97% similarity]
share/i18n/csmapper/JIS/JISX0208@1990%UCS.src
share/i18n/csmapper/JIS/JISX0208@MS%UCS.src
share/i18n/csmapper/JIS/JISX0208UDC%UCS.src
share/i18n/csmapper/JIS/JISX0208VDC@NEC%UCS.src
share/i18n/csmapper/JIS/JISX0212%UCS.src
share/i18n/csmapper/JIS/JISX0212@MS%UCS.src
share/i18n/csmapper/JIS/JISX0212UDC%UCS.src
share/i18n/csmapper/JIS/JISX0212VDC@IBM%UCS.src
share/i18n/csmapper/JIS/JISX0213-1%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/JIS/JISX0213-1%UCS@SIP.src [new file with mode: 0644]
share/i18n/csmapper/JIS/JISX0213-2%UCS@BMP.src [new file with mode: 0644]
share/i18n/csmapper/JIS/JISX0213-2%UCS@SIP.src [new file with mode: 0644]
share/i18n/csmapper/JIS/Makefile.inc
share/i18n/csmapper/JIS/UCS%JISX0201-KANA.src
share/i18n/csmapper/JIS/UCS%JISX0208@1978.src [copied from share/i18n/csmapper/JIS/UCS%JISX0208@MS.src with 97% similarity]
share/i18n/csmapper/JIS/UCS%JISX0208@1990.src
share/i18n/csmapper/JIS/UCS%JISX0208@MS.src
share/i18n/csmapper/JIS/UCS%JISX0208UDC.src
share/i18n/csmapper/JIS/UCS%JISX0208VDC@NEC.src
share/i18n/csmapper/JIS/UCS%JISX0212.src
share/i18n/csmapper/JIS/UCS%JISX0212@MS.src
share/i18n/csmapper/JIS/UCS%JISX0212UDC.src
share/i18n/csmapper/JIS/UCS%JISX0212VDC@IBM.src
share/i18n/csmapper/JIS/UCS@BMP%JISX0213-1.src [new file with mode: 0644]
share/i18n/csmapper/JIS/UCS@BMP%JISX0213-2.src [new file with mode: 0644]
share/i18n/csmapper/JIS/UCS@SIP%JISX0213-1.src [new file with mode: 0644]
share/i18n/csmapper/JIS/UCS@SIP%JISX0213-2.src [new file with mode: 0644]
share/i18n/csmapper/JIS/charset.pivot.JIS.src
share/i18n/csmapper/JIS/mapper.dir.JIS.src
share/i18n/csmapper/KAZAKH/KZ1048%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KAZAKH/Makefile.inc [new file with mode: 0644]
share/i18n/csmapper/KAZAKH/PTCP154%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KAZAKH/UCS%KZ1048.src [new file with mode: 0644]
share/i18n/csmapper/KAZAKH/UCS%PTCP154.src [new file with mode: 0644]
share/i18n/csmapper/KAZAKH/charset.pivot.KAZAKH.src [new file with mode: 0644]
share/i18n/csmapper/KAZAKH/mapper.dir.KAZAKH.src [new file with mode: 0644]
share/i18n/csmapper/KOI/GOST19768-74%UCS.src [copied from share/i18n/csmapper/MISC/KOI8-R%UCS.src with 70% similarity]
share/i18n/csmapper/KOI/ISO-5427%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KOI/KOI7%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KOI/KOI8%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KOI/KOI8-C%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KOI/KOI8-CyrillicOld%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KOI/KOI8-E%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KOI/KOI8-R%UCS.src [moved from share/i18n/csmapper/MISC/KOI8-R%UCS.src with 72% similarity]
share/i18n/csmapper/KOI/KOI8-RU%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KOI/KOI8-T%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KOI/KOI8-U%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KOI/KOI8.part [new file with mode: 0644]
share/i18n/csmapper/KOI/Makefile.inc [new file with mode: 0644]
share/i18n/csmapper/KOI/UCS%GOST19768-74.src [copied from share/i18n/csmapper/MISC/UCS%KOI8-R.src with 70% similarity]
share/i18n/csmapper/KOI/UCS%ISO-5427.src [new file with mode: 0644]
share/i18n/csmapper/KOI/UCS%KOI7.src [new file with mode: 0644]
share/i18n/csmapper/KOI/UCS%KOI8-C.src [new file with mode: 0644]
share/i18n/csmapper/KOI/UCS%KOI8-CyrillicOld.src [new file with mode: 0644]
share/i18n/csmapper/KOI/UCS%KOI8-E.src [new file with mode: 0644]
share/i18n/csmapper/KOI/UCS%KOI8-R.src [moved from share/i18n/csmapper/MISC/UCS%KOI8-R.src with 72% similarity]
share/i18n/csmapper/KOI/UCS%KOI8-RU.src [moved from share/i18n/csmapper/MISC/UCS%KOI8-U.src with 74% similarity]
share/i18n/csmapper/KOI/UCS%KOI8-T.src [new file with mode: 0644]
share/i18n/csmapper/KOI/UCS%KOI8-U.src [new file with mode: 0644]
share/i18n/csmapper/KOI/UCS%KOI8.src [new file with mode: 0644]
share/i18n/csmapper/KOI/charset.pivot.KOI.src [new file with mode: 0644]
share/i18n/csmapper/KOI/mapper.dir.KOI.src [new file with mode: 0644]
share/i18n/csmapper/KS/JOHAB%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KS/KSC5601HANGUL%UCS.src [new file with mode: 0644]
share/i18n/csmapper/KS/KSC5601HANJA%UCS.src [moved from share/i18n/csmapper/KS/KSC5601%UCS.src with 71% similarity]
share/i18n/csmapper/KS/Makefile.inc
share/i18n/csmapper/KS/UCS%JOHAB.src [new file with mode: 0644]
share/i18n/csmapper/KS/UCS%KSC5601HANGUL.src [new file with mode: 0644]
share/i18n/csmapper/KS/UCS%KSC5601HANJA.src [moved from share/i18n/csmapper/KS/UCS%KSC5601.src with 71% similarity]
share/i18n/csmapper/KS/charset.pivot.KS.src
share/i18n/csmapper/KS/mapper.dir.KS.src
share/i18n/csmapper/MISC/ATARIST%UCS.src [new file with mode: 0644]
share/i18n/csmapper/MISC/DECMCS%UCS.src [new file with mode: 0644]
share/i18n/csmapper/MISC/HP-ROMAN8%UCS.src [new file with mode: 0644]
share/i18n/csmapper/MISC/KOI8-U%UCS.src [deleted file]
share/i18n/csmapper/MISC/MULELAO-1%UCS.src [new file with mode: 0644]
share/i18n/csmapper/MISC/Makefile.inc
share/i18n/csmapper/MISC/NEXTSTEP%UCS.src [new file with mode: 0644]
share/i18n/csmapper/MISC/RISCOS-LATIN1%UCS.src [new file with mode: 0644]
share/i18n/csmapper/MISC/TDS565%UCS.src [new file with mode: 0644]
share/i18n/csmapper/MISC/UCS%ATARIST.src [new file with mode: 0644]
share/i18n/csmapper/MISC/UCS%DECMCS.src [new file with mode: 0644]
share/i18n/csmapper/MISC/UCS%HP-ROMAN8.src [new file with mode: 0644]
share/i18n/csmapper/MISC/UCS%MULELAO-1.src [new file with mode: 0644]
share/i18n/csmapper/MISC/UCS%NEXTSTEP.src [new file with mode: 0644]
share/i18n/csmapper/MISC/UCS%RISCOS-LATIN1.src [new file with mode: 0644]
share/i18n/csmapper/MISC/UCS%TDS565.src [new file with mode: 0644]
share/i18n/csmapper/MISC/charset.pivot.MISC.src
share/i18n/csmapper/MISC/mapper.dir.MISC.src
share/i18n/csmapper/Makefile
share/i18n/csmapper/TCVN/Makefile.inc [new file with mode: 0644]
share/i18n/csmapper/TCVN/TCVN5712-1%UCS.src [new file with mode: 0644]
share/i18n/csmapper/TCVN/UCS%TCVN5712-1.src [new file with mode: 0644]
share/i18n/csmapper/TCVN/UCS%VISCII.src [new file with mode: 0644]
share/i18n/csmapper/TCVN/VISCII%UCS.src [new file with mode: 0644]
share/i18n/csmapper/TCVN/charset.pivot.TCVN.src [new file with mode: 0644]
share/i18n/csmapper/TCVN/mapper.dir.TCVN.src [new file with mode: 0644]
share/i18n/csmapper/mapper.dir.src
share/i18n/esdb/APPLE/MAC.alias [new file with mode: 0644]
share/i18n/esdb/APPLE/MAC.part [new file with mode: 0644]
share/i18n/esdb/APPLE/MAC.src [new file with mode: 0644]
share/i18n/esdb/APPLE/Makefile.inc [new file with mode: 0644]
share/i18n/esdb/AST/ARMSCII-7.src [new file with mode: 0644]
share/i18n/esdb/AST/ARMSCII.alias [new file with mode: 0644]
share/i18n/esdb/AST/ARMSCII.part [new file with mode: 0644]
share/i18n/esdb/AST/ARMSCII.src [new file with mode: 0644]
share/i18n/esdb/AST/Makefile.inc [new file with mode: 0644]
share/i18n/esdb/BIG5/Big5.alias [new file with mode: 0644]
share/i18n/esdb/BIG5/Big5.part [new file with mode: 0644]
share/i18n/esdb/BIG5/Big5.src [new file with mode: 0644]
share/i18n/esdb/BIG5/Big5.variable [new file with mode: 0644]
share/i18n/esdb/BIG5/Makefile.inc [new file with mode: 0644]
share/i18n/esdb/CP/CP.alias
share/i18n/esdb/CP/CP.part
share/i18n/esdb/CP/CP.src
share/i18n/esdb/CP/CP50220.src [new file with mode: 0644]
share/i18n/esdb/CP/CP50221.src [new file with mode: 0644]
share/i18n/esdb/CP/CP50222.src [new file with mode: 0644]
share/i18n/esdb/CP/CP51932.src [new file with mode: 0644]
share/i18n/esdb/CP/CP932.src
share/i18n/esdb/CP/CP936.src
share/i18n/esdb/CP/CP942.src [new file with mode: 0644]
share/i18n/esdb/CP/CP942C.src [new file with mode: 0644]
share/i18n/esdb/CP/CP943.src [new file with mode: 0644]
share/i18n/esdb/CP/CP943C.src [new file with mode: 0644]
share/i18n/esdb/CP/CP949.src
share/i18n/esdb/CP/CP950.src
share/i18n/esdb/CP/Makefile.inc
share/i18n/esdb/DEC/DEC.alias [new file with mode: 0644]
share/i18n/esdb/DEC/DEC.part [new file with mode: 0644]
share/i18n/esdb/DEC/DEC.src [new file with mode: 0644]
share/i18n/esdb/DEC/DECHanyu.src [new file with mode: 0644]
share/i18n/esdb/DEC/Makefile.inc [new file with mode: 0644]
share/i18n/esdb/EBCDIC/EBCDIC.alias
share/i18n/esdb/EBCDIC/EBCDIC.part
share/i18n/esdb/EBCDIC/EBCDIC.src
share/i18n/esdb/EBCDIC/Makefile.inc
share/i18n/esdb/EUC/EUC-CN.src
share/i18n/esdb/EUC/EUC-JIS-2004.src [new file with mode: 0644]
share/i18n/esdb/EUC/EUC-JP-MS.src
share/i18n/esdb/EUC/EUC-JP.src
share/i18n/esdb/EUC/EUC-KR.src
share/i18n/esdb/EUC/EUC-TW.src
share/i18n/esdb/EUC/EUC.alias
share/i18n/esdb/EUC/EUC.part
share/i18n/esdb/EUC/Makefile.inc
share/i18n/esdb/GB/GB.alias [new file with mode: 0644]
share/i18n/esdb/GB/GB.part [new file with mode: 0644]
share/i18n/esdb/GB/GB12345.src [new file with mode: 0644]
share/i18n/esdb/GB/GB18030.src [new file with mode: 0644]
share/i18n/esdb/GB/GBK.src [new file with mode: 0644]
share/i18n/esdb/GB/Makefile.inc [new file with mode: 0644]
share/i18n/esdb/GEORGIAN/GEORGIAN.alias [new file with mode: 0644]
share/i18n/esdb/GEORGIAN/GEORGIAN.part [new file with mode: 0644]
share/i18n/esdb/GEORGIAN/GEORGIAN.src [new file with mode: 0644]
share/i18n/esdb/GEORGIAN/Makefile.inc [new file with mode: 0644]
share/i18n/esdb/ISO-2022/ISO-2022-CN-EXT.src [new file with mode: 0644]
share/i18n/esdb/ISO-2022/ISO-2022-CN.src [new file with mode: 0644]
share/i18n/esdb/ISO-2022/ISO-2022-JP-1.src [new file with mode: 0644]
share/i18n/esdb/ISO-2022/ISO-2022-JP-2.src
share/i18n/esdb/ISO-2022/ISO-2022-JP-2004.src [new file with mode: 0644]
share/i18n/esdb/ISO-2022/ISO-2022-JP.src
share/i18n/esdb/ISO-2022/ISO-2022-KR.src
share/i18n/esdb/ISO-2022/ISO-2022.alias
share/i18n/esdb/ISO-2022/ISO-2022.part
share/i18n/esdb/ISO-2022/Makefile.inc
share/i18n/esdb/ISO-8859/ISO-8859.alias
share/i18n/esdb/ISO-8859/ISO-8859.part
share/i18n/esdb/ISO-8859/ISO-8859.src
share/i18n/esdb/ISO-8859/Makefile.inc
share/i18n/esdb/ISO646/ISO646.alias
share/i18n/esdb/ISO646/ISO646.part
share/i18n/esdb/ISO646/ISO646.src
share/i18n/esdb/ISO646/Makefile.inc
share/i18n/esdb/KAZAKH/KZ1048.src [new file with mode: 0644]
share/i18n/esdb/KAZAKH/Makefile.inc [new file with mode: 0644]
share/i18n/esdb/KAZAKH/PTCP154.src [new file with mode: 0644]
share/i18n/esdb/KAZAKH/esdb.alias.KAZAKH.src [new file with mode: 0644]
share/i18n/esdb/KAZAKH/esdb.dir.KAZAKH.src [new file with mode: 0644]
share/i18n/esdb/KOI/KOI.alias [new file with mode: 0644]
share/i18n/esdb/KOI/KOI.part [new file with mode: 0644]
share/i18n/esdb/KOI/KOI.src [new file with mode: 0644]
share/i18n/esdb/KOI/KOI7-switched.src [new file with mode: 0644]
share/i18n/esdb/KOI/KOI7.src [new file with mode: 0644]
share/i18n/esdb/KOI/Makefile.inc [new file with mode: 0644]
share/i18n/esdb/MISC/ATARIST.src [new file with mode: 0644]
share/i18n/esdb/MISC/Big5.src [deleted file]
share/i18n/esdb/MISC/C99.src [new file with mode: 0644]
share/i18n/esdb/MISC/CTEXT.src
share/i18n/esdb/MISC/GB18030.src [deleted file]
share/i18n/esdb/MISC/HP-ROMAN8.src [new file with mode: 0644]
share/i18n/esdb/MISC/HZ.src [new file with mode: 0644]
share/i18n/esdb/MISC/HZ8.src [new file with mode: 0644]
share/i18n/esdb/MISC/JAVA.src [new file with mode: 0644]
share/i18n/esdb/MISC/JOHAB.src [new file with mode: 0644]
share/i18n/esdb/MISC/KOI8-R.src [deleted file]
share/i18n/esdb/MISC/KOI8-U.src [deleted file]
share/i18n/esdb/MISC/MULELAO-1.src [new file with mode: 0644]
share/i18n/esdb/MISC/Makefile.inc
share/i18n/esdb/MISC/NEXTSTEP.src [new file with mode: 0644]
share/i18n/esdb/MISC/RISCOS-LATIN1.src [new file with mode: 0644]
share/i18n/esdb/MISC/Shift_JIS-2004.src [new file with mode: 0644]
share/i18n/esdb/MISC/Shift_JIS.src
share/i18n/esdb/MISC/TDS565.src [new file with mode: 0644]
share/i18n/esdb/MISC/ZW.src [new file with mode: 0644]
share/i18n/esdb/MISC/esdb.alias.MISC.src
share/i18n/esdb/MISC/esdb.dir.MISC.src
share/i18n/esdb/Makefile
share/i18n/esdb/TCVN/Makefile.inc [new file with mode: 0644]
share/i18n/esdb/TCVN/TCVN5712-1.src [new file with mode: 0644]
share/i18n/esdb/TCVN/VIQR.src [new file with mode: 0644]
share/i18n/esdb/TCVN/VISCII.src [new file with mode: 0644]
share/i18n/esdb/TCVN/esdb.alias.TCVN.src [new file with mode: 0644]
share/i18n/esdb/TCVN/esdb.dir.TCVN.src [new file with mode: 0644]
share/i18n/esdb/UTF/Makefile.inc
share/i18n/esdb/UTF/UTF.alias
share/i18n/esdb/UTF/UTF.part
share/i18n/esdb/UTF/UTF.src
usr.bin/mkcsmapper/ldef.h
usr.bin/mkcsmapper/lex.l
usr.bin/mkcsmapper/yacc.y

index 0c864a1..0c947b9 100644 (file)
@@ -1,5 +1,5 @@
 # $FreeBSD: src/etc/mtree/BSD.usr.dist,v 1.188.2.40 2003/02/14 22:38:14 nectar Exp $
-# $DragonFly: src/etc/mtree/BSD.usr.dist,v 1.52 2008/01/17 07:39:00 swildner Exp $
+# $DragonFly: src/etc/mtree/BSD.usr.dist,v 1.53 2008/04/10 10:21:00 hasso Exp $
 #
 # Please see the file src/etc/mtree/README before making changes to this file.
 #
         ..
         i18n
             csmapper
+                APPLE
+                ..
+                AST
+                ..
+                BIG5
+                ..
+                CNS
+                ..
                 CP
                 ..
                 EBCDIC
                 ..
                 GB
                 ..
+                GEORGIAN
+                ..
                 ISO-8859
                 ..
                 ISO646
                 ..
                 JIS
                 ..
+                KAZAKH
+                ..
+                KOI
+                ..
                 KS
                 ..
                 MISC
                 ..
+                TCVN
+                ..
             ..
             esdb
+                APPLE
+                ..
+                AST
+                ..
+                BIG5
+                ..
                 CP
                 ..
+                DEC
+                ..
                 EBCDIC
                 ..
                 EUC
                 ..
+                GB
+                ..
+                GEORGIAN
+                ..
                 ISO-2022
                 ..
                 ISO-8859
                 ..
                 ISO646
                 ..
+                KAZAKH
+                ..
+                KOI
+                ..
                 MISC
                 ..
+                TCVN
+                ..
                 UTF
                 ..
             ..
index 2bd5a2d..9935cc2 100644 (file)
@@ -1,4 +1,6 @@
-# $DragonFly: src/lib/i18n_module/BIG5/Makefile,v 1.1 2005/03/11 20:47:05 joerg Exp $
+# $DragonFly: src/lib/i18n_module/BIG5/Makefile,v 1.2 2008/04/10 10:21:00 hasso Exp $
+
+SRCPRE=        citrus_
+SRCS+= citrus_big5.c citrus_prop.c
 
-SRCPRE=citrus_
 .include <bsd.lib.mk>
diff --git a/lib/i18n_module/DECHanyu/Makefile b/lib/i18n_module/DECHanyu/Makefile
new file mode 100644 (file)
index 0000000..e3f44d6
--- /dev/null
@@ -0,0 +1,4 @@
+# $DragonFly: src/lib/i18n_module/DECHanyu/Makefile,v 1.1 2008/04/10 10:21:00 hasso Exp $
+
+SRCPRE=citrus_
+.include <bsd.lib.mk>
diff --git a/lib/i18n_module/HZ/Makefile b/lib/i18n_module/HZ/Makefile
new file mode 100644 (file)
index 0000000..5b3c1d3
--- /dev/null
@@ -0,0 +1,6 @@
+# $DragonFly: src/lib/i18n_module/HZ/Makefile,v 1.1 2008/04/10 10:21:00 hasso Exp $
+
+SRCPRE=citrus_
+SRCS+=  citrus_hz.c citrus_prop.c
+
+.include <bsd.lib.mk>
diff --git a/lib/i18n_module/JOHAB/Makefile b/lib/i18n_module/JOHAB/Makefile
new file mode 100644 (file)
index 0000000..78e049f
--- /dev/null
@@ -0,0 +1,4 @@
+# $DragonFly: src/lib/i18n_module/JOHAB/Makefile,v 1.1 2008/04/10 10:21:00 hasso Exp $
+
+SRCPRE=citrus_
+.include <bsd.lib.mk>
index f6dd166..62f31dc 100644 (file)
@@ -1,6 +1,7 @@
-# $DragonFly: src/lib/i18n_module/Makefile,v 1.2 2005/03/11 21:50:39 joerg Exp $
+# $DragonFly: src/lib/i18n_module/Makefile,v 1.3 2008/04/10 10:21:00 hasso Exp $
 
-SUBDIR=        BIG5 EUC EUCTW GBK2K ISO2022 MSKanji UTF1632 UTF7 UTF8
+SUBDIR=        BIG5 DECHanyu EUC EUCTW GBK2K HZ ISO2022 JOHAB MSKanji UES UTF1632
+SUBDIR+=UTF7 UTF8 VIQR ZW
 SUBDIR+=iconv_none iconv_std
 SUBDIR+=mapper_646 mapper_none mapper_serial mapper_parallel mapper_std
 SUBDIR+=mapper_zone
index dc7b58c..02b2a13 100644 (file)
@@ -1,4 +1,4 @@
-# $DragonFly: src/lib/i18n_module/Makefile.inc,v 1.2 2005/07/28 19:43:55 joerg Exp $
+# $DragonFly: src/lib/i18n_module/Makefile.inc,v 1.3 2008/04/10 10:21:00 hasso Exp $
 
 NOPROFILE=     1
 .include "../Makefile.shlib"
@@ -17,4 +17,4 @@ CITRUSDIR=    ${.CURDIR}/../../libc/citrus
 CFLAGS+=       -I${CITRUSDIR}
 CFLAGS+=       -DLOCALEMOD_MAJOR=${MODULE_SHLIB_MAJOR}
 
-.PATH: ${CITRUSDIR}/modules
+.PATH: ${CITRUSDIR} ${CITRUSDIR}/modules 
diff --git a/lib/i18n_module/UES/Makefile b/lib/i18n_module/UES/Makefile
new file mode 100644 (file)
index 0000000..8d84399
--- /dev/null
@@ -0,0 +1,4 @@
+# $DragonFly: src/lib/i18n_module/UES/Makefile,v 1.1 2008/04/10 10:21:01 hasso Exp $
+
+SRCPRE=citrus_
+.include <bsd.lib.mk>
diff --git a/lib/i18n_module/VIQR/Makefile b/lib/i18n_module/VIQR/Makefile
new file mode 100644 (file)
index 0000000..7ddd00e
--- /dev/null
@@ -0,0 +1,4 @@
+# $DragonFly: src/lib/i18n_module/VIQR/Makefile,v 1.1 2008/04/10 10:21:01 hasso Exp $
+
+SRCPRE=citrus_
+.include <bsd.lib.mk>
diff --git a/lib/i18n_module/ZW/Makefile b/lib/i18n_module/ZW/Makefile
new file mode 100644 (file)
index 0000000..702f755
--- /dev/null
@@ -0,0 +1,4 @@
+# $DragonFly: src/lib/i18n_module/ZW/Makefile,v 1.1 2008/04/10 10:21:01 hasso Exp $
+
+SRCPRE=citrus_
+.include <bsd.lib.mk>
index e2570a6..fdf9cab 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: citrus_bcs.c,v 1.5 2005/05/14 17:55:42 tshiozak Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/citrus_bcs.c,v 1.2 2005/07/04 10:02:24 joerg Exp $ */
+/* $NetBSD: citrus_bcs.c,v 1.5 2005/05/14 17:55:42 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_bcs.c,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 7798de6..f881683 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: citrus_bcs.h,v 1.3 2005/05/14 17:55:42 tshiozak Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/citrus_bcs.h,v 1.2 2005/07/04 10:04:52 joerg Exp $ */
+/* $NetBSD: citrus_bcs.h,v 1.4 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_bcs.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 960f695..570ce8d 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_csmapper.c,v 1.5 2004/12/30 05:01:50 christos Exp $ */
-/*     $DragonFly: src/lib/libc/citrus/citrus_csmapper.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_csmapper.c,v 1.8 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_csmapper.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -139,8 +139,7 @@ find_best_pivot_pvdb(const char *src, const char *dst, char *pivot,
                ret = open_subdb(&db3, db1, buf);
                if (ret)
                        goto quit3;
-               ret = _db_lookup_by_s(db3, dst, &r2, NULL);
-               if (ret)
+               if (_db_lookup_by_s(db3, dst, &r2, NULL) != 0)
                        goto quit4;
                /* r2: norm among pivot and dst */
                ret = get32(&r2, &val32);
@@ -350,6 +349,8 @@ _citrus_csmapper_open(struct _citrus_csmapper * __restrict * __restrict rcsm,
        const char *realsrc, *realdst;
        unsigned long norm;
 
+       norm = 0;       /* XXX gcc */
+
        ret = _citrus_mapper_create_area(&maparea, _PATH_CSMAPPER);
        if (ret)
                return ret;
index dd6c941..9c6ecb2 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_csmapper.h,v 1.1 2003/06/25 09:51:27 tshiozak Exp $ */
-/*     $DragonFly: src/lib/libc/citrus/citrus_csmapper.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_csmapper.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_csmapper.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 3c0b037..5f60787 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_ctype.c,v 1.4 2003/03/05 20:18:15 tshiozak Exp $    */
-/*     $DragonFly: src/lib/libc/citrus/citrus_ctype.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_ctype.c,v 1.4 2003/03/05 20:18:15 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_ctype.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)1999, 2000, 2001, 2002 Citrus Project,
index e5be692..b4d668d 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_ctype.h,v 1.2 2003/03/05 20:18:15 tshiozak Exp $    */
-/*     $DragonFly: src/lib/libc/citrus/citrus_ctype.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_ctype.h,v 1.2 2003/03/05 20:18:15 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_ctype.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
index dbbe9d5..efb71af 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_ctype_fallback.c,v 1.2 2003/06/27 14:52:25 yamt Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/citrus_ctype_fallback.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_ctype_fallback.c,v 1.2 2003/06/27 14:52:25 yamt Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_ctype_fallback.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index fcdaa64..3353524 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_ctype_fallback.h,v 1.1 2003/03/05 20:18:15 tshiozak Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_ctype_fallback.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_ctype_fallback.h,v 1.1 2003/03/05 20:18:15 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_ctype_fallback.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 332174b..64f4e1d 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_ctype_local.h,v 1.2 2003/03/05 20:18:15 tshiozak Exp $      */
-/*     $DragonFly: src/lib/libc/citrus/citrus_ctype_local.h,v 1.2 2005/07/04 08:02:43 joerg Exp $ */
+/* $NetBSD: citrus_ctype_local.h,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_ctype_local.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index 6ae064c..9231958 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_ctype_template.h,v 1.32 2005/03/05 17:31:03 tnozaki Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_ctype_template.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_ctype_template.h,v 1.35 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_ctype_template.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
@@ -204,20 +204,20 @@ _FUNCNAME(mbtowc_priv)(_ENCODING_INFO * __restrict ei,
        _DIAGASSERT(psenc != NULL);
 
        if (s == NULL) {
+               _FUNCNAME(init_state)(ei, psenc);
                *nresult = _ENCODING_IS_STATE_DEPENDENT;
                return (0);
        }
 
        state = *psenc;
        err = _FUNCNAME(mbrtowc_priv)(ei, pwc, (const char **)&s, n, psenc, &nr);
+       if (nr == (size_t)-2)
+               err = EILSEQ;
        if (err) {
-               *nresult = -1;
-               return (err);
-       }
-       if (nr == (size_t)-2) {
+               /* In error case, we should restore the state. */
                *psenc = state;
                *nresult = -1;
-               return (EILSEQ);
+               return (err);
        }
 
        *nresult = (int)nr;
index 8a43db1..137d272 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_db.c,v 1.3 2004/01/02 21:49:35 itojun Exp $ */
-/*     $DragonFly: src/lib/libc/citrus/citrus_db.c,v 1.2 2005/03/16 06:13:24 joerg Exp $ */
+/* $NetBSD: citrus_db.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_db.c,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index c2c9b26..08f99f2 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_db.h,v 1.1 2003/06/25 09:51:29 tshiozak Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/citrus_db.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_db.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_db.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index 21400aa..164b491 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_db_factory.c,v 1.8 2004/01/02 21:49:35 itojun Exp $ */
-/*     $DragonFly: src/lib/libc/citrus/citrus_db_factory.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_db_factory.c,v 1.9 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_db_factory.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 7af5507..f96323c 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_db_factory.h,v 1.1 2003/06/25 09:51:30 tshiozak Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/citrus_db_factory.h,v 1.2 2006/08/03 16:40:46 swildner Exp $ */
+/* $NetBSD: citrus_db_factory.h,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_db_factory.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index 017f241..e799585 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_db_file.h,v 1.2 2003/06/30 17:54:13 christos Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/citrus_db_file.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_db_file.h,v 1.4 2008/02/10 05:58:22 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_db_file.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index b50236b..8e053f3 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_db_hash.c,v 1.4 2004/01/02 21:49:35 itojun Exp $    */
-/*     $DragonFly: src/lib/libc/citrus/citrus_db_hash.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_db_hash.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_db_hash.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index 6f4c6c4..172aea5 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_db_hash.h,v 1.1 2003/06/25 09:51:31 tshiozak Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/citrus_db_hash.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_db_hash.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_db_hash.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index 76eaf53..4b2545d 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_esdb.c,v 1.4 2004/07/21 14:16:34 tshiozak Exp $     */
-/*     $DragonFly: src/lib/libc/citrus/citrus_esdb.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_esdb.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_esdb.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index bf28038..117f9c6 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_esdb.h,v 1.1 2003/06/25 09:51:32 tshiozak Exp $     */
-/*     $DragonFly: src/lib/libc/citrus/citrus_esdb.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_esdb.h,v 1.1 2003/06/25 09:51:32 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_esdb.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index e1593c5..8126023 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_esdb_file.h,v 1.1 2003/06/25 09:51:32 tshiozak Exp $        */
-/*     $DragonFly: src/lib/libc/citrus/citrus_esdb_file.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_esdb_file.h,v 1.1 2003/06/25 09:51:32 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_esdb_file.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index 9738aff..2af6523 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_hash.c,v 1.1 2003/06/25 09:51:32 tshiozak Exp $     */
-/*     $DragonFly: src/lib/libc/citrus/citrus_hash.c,v 1.2 2005/03/16 06:13:24 joerg Exp $ */
+/* $NetBSD: citrus_hash.c,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_hash.c,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index 8a131f0..a555caa 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_hash.h,v 1.3 2004/01/02 21:49:35 itojun Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/citrus_hash.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_hash.h,v 1.3 2004/01/02 21:49:35 itojun Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_hash.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index 48b27ce..d8b319d 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_iconv.c,v 1.6 2004/12/30 05:03:48 christos Exp $    */
-/*     $DragonFly: src/lib/libc/citrus/citrus_iconv.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_iconv.c,v 1.6 2004/12/30 05:03:48 christos Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_iconv.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 
 /*-
index 0d2739a..afbf1ae 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_iconv.h,v 1.3 2003/07/10 08:50:43 tshiozak Exp $    */
-/*     $DragonFly: src/lib/libc/citrus/citrus_iconv.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_iconv.h,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_iconv.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -60,7 +60,8 @@ _citrus_iconv_convert(struct _citrus_iconv * __restrict cv,
 {
 
        _DIAGASSERT(cv && cv->cv_shared && cv->cv_shared->ci_ops &&
-                   cv->cv_shared->ci_ops->io_convert && (out || !outbytes));
+                   cv->cv_shared->ci_ops->io_convert && out);
+       _DIAGASSERT(out || outbytes == 0);
 
        return (*cv->cv_shared->ci_ops->io_convert)(cv, in, inbytes, out,
                                                    outbytes, flags, nresults);
index 39dedbb..9323467 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_iconv_local.h,v 1.2 2003/07/01 09:42:16 tshiozak Exp $      */
-/*     $DragonFly: src/lib/libc/citrus/citrus_iconv_local.h,v 1.2 2005/07/04 08:02:43 joerg Exp $ */
+/* $NetBSD: citrus_iconv_local.h,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_iconv_local.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index aa1b3a0..305f6e0 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_lookup.c,v 1.3 2004/07/21 14:16:34 tshiozak Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_lookup.c,v 1.2 2005/03/16 06:13:24 joerg Exp $ */
+/* $NetBSD: citrus_lookup.c,v 1.5 2006/03/27 01:09:11 christos Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_lookup.c,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -321,6 +321,7 @@ _citrus_lookup_seq_close(struct _citrus_lookup *cl)
 {
        free(cl->cl_key);
        (*cl->cl_close)(cl);
+       free(cl);
 }
 
 char *
index 16562e8..0df64cf 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_lookup.h,v 1.2 2004/07/21 14:16:34 tshiozak Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_lookup.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_lookup.h,v 1.2 2004/07/21 14:16:34 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_lookup.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 8b9b460..e63c90b 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_lookup_factory.c,v 1.4 2003/10/27 00:12:42 lukem Exp $      */
-/*     $DragonFly: src/lib/libc/citrus/citrus_lookup_factory.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_lookup_factory.c,v 1.4 2003/10/27 00:12:42 lukem Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_lookup_factory.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index fa20d4d..515ddad 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_lookup_factory.h,v 1.1 2003/06/25 09:51:35 tshiozak Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_lookup_factory.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_lookup_factory.h,v 1.1 2003/06/25 09:51:35 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_lookup_factory.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 728822c..345c1f4 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_lookup_factory.h,v 1.1 2003/06/25 09:51:35 tshiozak Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_lookup_file.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_lookup_factory.h,v 1.1 2003/06/25 09:51:35 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_lookup_file.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 0392ca6..c15ddd4 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_mapper.c,v 1.6 2004/12/30 05:05:01 christos Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_mapper.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_mapper.c,v 1.6 2004/12/30 05:05:01 christos Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_mapper.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index c466b56..2fe4f67 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_mapper.h,v 1.3 2003/07/12 15:39:19 tshiozak Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_mapper.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_mapper.h,v 1.3 2003/07/12 15:39:19 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_mapper.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 208007c..adffd73 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_mapper_local.h,v 1.1 2003/06/25 09:51:36 tshiozak Exp $     */
-/*     $DragonFly: src/lib/libc/citrus/citrus_mapper_local.h,v 1.2 2005/07/04 08:02:43 joerg Exp $ */
+/* $NetBSD: citrus_mapper_local.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_mapper_local.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 6970aa6..6e7425e 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_memstream.c,v 1.2 2004/01/02 21:49:35 itojun Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/citrus_memstream.c,v 1.2 2005/03/16 06:13:24 joerg Exp $ */
+/* $NetBSD: citrus_memstream.c,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_memstream.c,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 22a8f68..80010d5 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: citrus_memstream.h,v 1.3 2005/05/14 17:55:42 tshiozak Exp $    */
-/*     $DragonFly: src/lib/libc/citrus/citrus_memstream.h,v 1.2 2005/07/04 10:11:57 joerg Exp $ */
+/* $NetBSD: citrus_memstream.h,v 1.3 2005/05/14 17:55:42 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_memstream.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 84cf218..ede0b19 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_mmap.c,v 1.3 2005/01/19 00:52:37 mycroft Exp $      */
-/*     $DragonFly: src/lib/libc/citrus/citrus_mmap.c,v 1.2 2005/11/12 22:21:13 swildner Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_mmap.c,v 1.3 2005/01/19 00:52:37 mycroft Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_mmap.c,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 071d34d..03d995f 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_mmap.h,v 1.1 2003/06/25 09:51:38 tshiozak Exp $     */
-/*     $DragonFly: src/lib/libc/citrus/citrus_mmap.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_mmap.h,v 1.1 2003/06/25 09:51:38 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_mmap.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 96f5014..5ae6994 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_module.c,v 1.4 2004/12/21 09:00:01 yamt Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/citrus_module.c,v 1.4 2005/11/12 22:21:13 swildner Exp $ */
+/* $NetBSD: citrus_module.c,v 1.5 2005/11/29 03:11:58 christos Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_module.c,v 1.5 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)1999, 2000, 2001, 2002 Citrus Project,
index 62771ce..89a77d4 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_module.h,v 1.1 2002/03/17 22:14:20 tshiozak Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_module.h,v 1.2 2005/07/04 08:02:43 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_module.h,v 1.1 2002/03/17 22:14:20 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_module.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
index 6137f5f..878e950 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: citrus_namespace.h,v 1.5 2005/05/14 17:55:42 tshiozak Exp $    */
-/*     $DragonFly: src/lib/libc/citrus/citrus_namespace.h,v 1.2 2005/07/04 10:11:57 joerg Exp $ */
+/* $NetBSD: citrus_namespace.h,v 1.6 2005/10/29 18:02:04 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_namespace.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
 #define _stdenc                        _citrus_stdenc
 #define _stdenc_ops            _citrus_stdenc_ops
 #define _stdenc_traits         _citrus_stdenc_traits
+#define _stdenc_state_desc     _citrus_stdenc_state_desc
 #define _stdenc_open           _citrus_stdenc_open
 #define _stdenc_close          _citrus_stdenc_close
 #define _stdenc_init_state     _citrus_stdenc_init_state
 #define _stdenc_put_state_reset        _citrus_stdenc_put_state_reset
 #define _stdenc_get_state_size _citrus_stdenc_get_state_size
 #define _stdenc_get_mb_cur_max _citrus_stdenc_get_mb_cur_max
+#define _stdenc_get_state_desc _citrus_stdenc_get_state_desc
+#define _STDENC_SDID_GENERIC   _CITRUS_STDENC_SDID_GENERIC
+#define _STDENC_SDGEN_UNKNOWN  _CITRUS_STDENC_SDGEN_UNKNOWN
+#define _STDENC_SDGEN_INITIAL  _CITRUS_STDENC_SDGEN_INITIAL
+#define _STDENC_SDGEN_STABLE   _CITRUS_STDENC_SDGEN_STABLE
+#define _STDENC_SDGEN_INCOMPLETE_CHAR _CITRUS_STDENC_SDGEN_INCOMPLETE_CHAR
+#define _STDENC_SDGEN_INCOMPLETE_SHIFT _CITRUS_STDENC_SDGEN_INCOMPLETE_SHIFT
 #endif /* _CITRUS_STDENC_NO_NAMESPACE */
 
 /* citrus_types.h */
index 3298ffd..bb3b30a 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_none.c,v 1.12 2004/01/18 03:57:30 yamt Exp $        */
-/*     $DragonFly: src/lib/libc/citrus/citrus_none.c,v 1.4 2005/07/04 08:02:43 joerg Exp $ */
+/* $NetBSD: citrus_none.c,v 1.17 2005/12/02 11:14:20 yamt Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_none.c,v 1.5 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -247,7 +247,7 @@ _citrus_NONE_ctype_mbtowc(void * __restrict cl __unused,
                return (0);
        }
 
-       *pwc = (wchar_t)*s;
+       *pwc = (wchar_t)(unsigned char)*s;
        *nresult = *s == '\0' ? 0 : 1;
 
        return (0);
@@ -514,3 +514,23 @@ _citrus_NONE_stdenc_put_state_reset(struct _citrus_stdenc * __restrict ce __unus
 
        return (0);
 }
+
+static int
+/*ARGSUSED*/
+_citrus_NONE_stdenc_get_state_desc(struct _stdenc * __restrict ce,
+                                  void * __restrict ps,
+                                  int id,
+                                  struct _stdenc_state_desc * __restrict d)
+{
+       int ret = 0;
+
+       switch (id) {
+       case _STDENC_SDID_GENERIC:
+               d->u.generic.state = _STDENC_SDGEN_INITIAL;
+               break;
+       default:
+               ret = EOPNOTSUPP;
+       }
+
+       return ret;
+}
index e111a39..ac83542 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_none.h,v 1.3 2003/06/25 09:51:38 tshiozak Exp $     */
-/*     $DragonFly: src/lib/libc/citrus/citrus_none.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_none.h,v 1.3 2003/06/25 09:51:38 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_none.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
index 963abbe..5f09b12 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_pivot_factory.c,v 1.4 2004/01/02 21:49:35 itojun Exp $      */
-/*     $DragonFly: src/lib/libc/citrus/citrus_pivot_factory.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_pivot_factory.c,v 1.6 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_pivot_factory.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -109,6 +109,8 @@ convert_line(struct src_head *sh, const char *line, size_t len)
        char key1[LINE_MAX], key2[LINE_MAX], data[LINE_MAX];
        uint32_t val;
 
+       se = NULL; /* XXX gcc */
+
        /* cut off trailing comment */
        p = memchr(line, T_COMM, len);
        if (p)
index 913a038..ba93d71 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_pivot_factory.h,v 1.1 2003/06/25 09:51:39 tshiozak Exp $    */
-/*     $DragonFly: src/lib/libc/citrus/citrus_pivot_factory.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_pivot_factory.h,v 1.1 2003/06/25 09:51:39 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_pivot_factory.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 2a1fabb..401cf0c 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_pivot_file.h,v 1.1 2003/06/25 09:51:39 tshiozak Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/citrus_pivot_file.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_pivot_file.h,v 1.1 2003/06/25 09:51:39 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_pivot_file.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
diff --git a/lib/libc/citrus/citrus_prop.c b/lib/libc/citrus/citrus_prop.c
new file mode 100644 (file)
index 0000000..64c7506
--- /dev/null
@@ -0,0 +1,448 @@
+/* $NetBSD: citrus_prop.c,v 1.3 2006/11/22 23:47:21 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_prop.c,v 1.1 2008/04/10 10:21:01 hasso Exp $ */
+
+/*-
+ * Copyright (c)2006 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 <assert.h>
+#include <limits.h>
+#include <errno.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "citrus_namespace.h"
+#include "citrus_bcs.h"
+#include "citrus_region.h"
+#include "citrus_memstream.h"
+#include "citrus_prop.h"
+
+typedef struct {
+       _citrus_prop_type_t type;
+       union {
+               const char *str;
+               int bool, chr;
+               uint64_t num;
+       } u;
+} _citrus_prop_object_t;
+
+static __inline void
+_citrus_prop_object_init(_citrus_prop_object_t *obj, _citrus_prop_type_t type)
+{
+       _DIAGASSERT(obj != NULL);
+
+       obj->type = type;
+       memset(&obj->u, 0, sizeof(obj->u));
+}
+
+static __inline void
+_citrus_prop_object_uninit(_citrus_prop_object_t *obj)
+{
+       _DIAGASSERT(obj != NULL);
+
+       if (obj->type == _CITRUS_PROP_STR)
+               free(__DECONST(void *, obj->u.str));
+}
+
+static const char *xdigit = "0123456789ABCDEF";
+
+#define _CITRUS_PROP_READ_UINT_COMMON(_func_, _type_, _max_)           \
+static int                                                             \
+_citrus_prop_read_##_func_##_common(struct _memstream * __restrict ms, \
+       _type_ * __restrict result, int base)                           \
+{                                                                      \
+       _type_ acc, cutoff;                                             \
+       int n, ch, cutlim;                                              \
+       char *p;                                                        \
+                                                                       \
+       _DIAGASSERT(ms != NULL);                                        \
+       _DIAGASSERT(result != NULL);                                    \
+                                                                       \
+       acc = (_type_)0;                                                \
+       cutoff = _max_ / base;                                          \
+       cutlim = _max_ % base;                                          \
+       for (;;) {                                                      \
+               ch = _memstream_getc(ms);                               \
+               p = strchr(xdigit, _bcs_toupper(ch));                   \
+               if (p == NULL || (n = (p - xdigit)) >= base)            \
+                       break;                                          \
+               if (acc > cutoff || (acc == cutoff && n > cutlim))      \
+                       break;                                          \
+               acc *= base;                                            \
+               acc += n;                                               \
+       }                                                               \
+       _memstream_ungetc(ms, ch);                                      \
+       *result = acc;                                                  \
+       return 0;                                                       \
+}
+_CITRUS_PROP_READ_UINT_COMMON(chr, int, UCHAR_MAX)
+_CITRUS_PROP_READ_UINT_COMMON(num, uint64_t, UINT64_MAX)
+#undef _CITRUS_PROP_READ_UINT_COMMON
+
+#define _CITRUS_PROP_READ_INT(_func_, _type_)                  \
+static int                                                     \
+_citrus_prop_read_##_func_(struct _memstream * __restrict ms,  \
+       _citrus_prop_object_t * __restrict obj)                 \
+{                                                              \
+       int ch, neg, base;                                      \
+                                                               \
+       _DIAGASSERT(ms != NULL);                                \
+       _DIAGASSERT(obj != NULL);                               \
+                                                               \
+       _memstream_skip_ws(ms);                                 \
+       ch = _memstream_getc(ms);                               \
+       neg = 0;                                                \
+       switch (ch) {                                           \
+       case '-':                                               \
+               neg = 1;                                        \
+       case '+':                                               \
+               ch = _memstream_getc(ms);                       \
+       }                                                       \
+       base = 10;                                              \
+       if (ch == '0') {                                        \
+               base -= 2;                                      \
+               ch = _memstream_getc(ms);                       \
+               if (ch == 'x' || ch == 'X') {                   \
+                       ch = _memstream_getc(ms);               \
+                       if (_bcs_isxdigit(ch) == 0) {           \
+                               _memstream_ungetc(ms, ch);      \
+                               obj->u._func_ = 0;              \
+                               return 0;                       \
+                       }                                       \
+                       base += 8;                              \
+               }                                               \
+       } else if (_bcs_isdigit(ch) == 0)                       \
+               return EINVAL;                                  \
+       _memstream_ungetc(ms, ch);                              \
+       return _citrus_prop_read_##_func_##_common              \
+           (ms, &obj->u._func_, base);                         \
+}
+_CITRUS_PROP_READ_INT(chr, int)
+_CITRUS_PROP_READ_INT(num, uint64_t)
+#undef _CITRUS_PROP_READ_INT
+
+static int
+_citrus_prop_read_character_common(struct _memstream * __restrict ms,
+       int * __restrict result)
+{
+       int ch, base;
+
+       _DIAGASSERT(ms != NULL);
+       _DIAGASSERT(result != NULL);
+
+       ch = _memstream_getc(ms);
+       if (ch != '\\') {
+               *result = ch;
+       } else {
+               ch = _memstream_getc(ms);
+               base = 16;
+               switch (ch) {
+               case 'a': *result = '\a'; break;
+               case 'b': *result = '\b'; break;
+               case 'f': *result = '\f'; break;
+               case 'n': *result = '\n'; break;
+               case 'r': *result = '\r'; break;
+               case 't': *result = '\t'; break;
+               case 'v': *result = '\v'; break;
+               /*FALLTHROUGH*/
+               case '0': case '1': case '2': case '3':
+               case '4': case '5': case '6': case '7':
+                       _memstream_ungetc(ms, ch);
+                       base -= 8;
+               case 'x':
+                       return _citrus_prop_read_chr_common(ms, result, base);
+                       
+               default:
+                       /* unknown escape */
+                       *result = ch;
+               }
+       }
+       return 0;
+}
+
+static int
+_citrus_prop_read_character(struct _memstream * __restrict ms,
+       _citrus_prop_object_t * __restrict obj)
+{
+       int ch, errnum;
+
+       _DIAGASSERT(ms != NULL);
+       _DIAGASSERT(obj != NULL);
+
+       _memstream_skip_ws(ms);
+       ch = _memstream_getc(ms);
+       if (ch != '\'') {
+               _memstream_ungetc(ms, ch);
+               return _citrus_prop_read_chr(ms, obj);
+       }
+       errnum = _citrus_prop_read_character_common(ms, &ch);
+       if (errnum != 0)
+               return errnum;
+       obj->u.chr = ch;
+       ch = _memstream_getc(ms);
+       if (ch != '\'')
+               return EINVAL;
+       return 0;
+}
+
+static int
+_citrus_prop_read_bool(struct _memstream * __restrict ms,
+       _citrus_prop_object_t * __restrict obj)
+{
+       _DIAGASSERT(ms != NULL);
+       _DIAGASSERT(obj != NULL);
+
+       _memstream_skip_ws(ms);
+       switch (_bcs_tolower(_memstream_getc(ms))) {
+       case 't':
+               if (_bcs_tolower(_memstream_getc(ms)) == 'r' &&
+                   _bcs_tolower(_memstream_getc(ms)) == 'u' &&
+                   _bcs_tolower(_memstream_getc(ms)) == 'e') {
+                       obj->u.bool = 1;
+                       return 0;
+               }
+               break;
+       case 'f':
+               if (_bcs_tolower(_memstream_getc(ms)) == 'a' &&
+                   _bcs_tolower(_memstream_getc(ms)) == 'l' &&
+                   _bcs_tolower(_memstream_getc(ms)) == 's' &&
+                   _bcs_tolower(_memstream_getc(ms)) == 'e') {
+                       obj->u.bool = 0;
+                       return 0;
+               }
+       }
+       return EINVAL;
+}
+
+static int
+_citrus_prop_read_str(struct _memstream * __restrict ms,
+       _citrus_prop_object_t * __restrict obj)
+{
+       int errnum, quot, ch;
+       char *s, *t;
+#define _CITRUS_PROP_STR_BUFSIZ        512
+       size_t n, m;
+
+       _DIAGASSERT(ms != NULL);
+       _DIAGASSERT(obj != NULL);
+
+       m = _CITRUS_PROP_STR_BUFSIZ;
+       s = malloc(m);
+       if (s == NULL)
+               return ENOMEM;
+       n = 0;
+       _memstream_skip_ws(ms);
+       quot = _memstream_getc(ms);
+       switch (quot) {
+       case EOF:
+               goto done;
+       case '\\':
+               _memstream_ungetc(ms, quot);
+               quot = EOF;
+       /*FALLTHROUGH*/
+       case '\"': case '\'':
+               break;
+       default:
+               s[n] = quot;
+               ++n, --m;
+               quot = EOF;
+       }
+       for (;;) {
+               if (m < 1) {
+                       m = _CITRUS_PROP_STR_BUFSIZ;
+                       t = realloc(s, n + m);
+                       if (t == NULL) {
+                               free(s);
+                               return ENOMEM;
+                       }
+                       s = t;
+               }
+               ch = _memstream_getc(ms);
+               if (quot == ch || (quot == EOF &&
+                   (ch == ';' || _bcs_isspace(ch)))) {
+done:
+                       s[n] = '\0';
+                       obj->u.str = (const char *)s;
+                       return 0;
+               }
+               _memstream_ungetc(ms, ch);
+               errnum = _citrus_prop_read_character_common(ms, &ch);
+               if (errnum != 0)
+                       return errnum;
+               s[n] = ch;
+               ++n, --m;
+       }
+       free(s);
+       return EINVAL;
+#undef _CITRUS_PROP_STR_BUFSIZ
+}
+
+typedef int (*_citrus_prop_read_type_t)(struct _memstream * __restrict,
+       _citrus_prop_object_t * __restrict);
+
+static const _citrus_prop_read_type_t readers[] = {
+       _citrus_prop_read_bool,
+       _citrus_prop_read_str,
+       _citrus_prop_read_character,
+       _citrus_prop_read_num,
+};
+
+static __inline int
+_citrus_prop_read_symbol(struct _memstream * __restrict ms,
+       char * __restrict s, size_t n)
+{
+       int ch;
+       size_t m;
+
+       _DIAGASSERT(ms != NULL);
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(n > 0);
+
+       for (m = 0; m < n; ++m) {
+               ch = _memstream_getc(ms);
+               if (ch != '_' && _bcs_isalnum(ch) == 0)
+                       goto name_found;
+               s[m] = ch;
+       }
+       ch = _memstream_getc(ms);
+       if (ch == '_' || _bcs_isalnum(ch) != 0)
+               return EINVAL;
+
+name_found:
+       _memstream_ungetc(ms, ch);
+       s[m] = '\0';
+
+       return 0;
+}
+
+static int
+_citrus_prop_parse_element(struct _memstream * __restrict ms,
+       const _citrus_prop_hint_t * __restrict hints,
+       void ** __restrict context)
+{
+       int ch, errnum;
+#define _CITRUS_PROP_HINT_NAME_LEN_MAX 255
+       char name[_CITRUS_PROP_HINT_NAME_LEN_MAX + 1];
+       const _citrus_prop_hint_t *hint;
+       _citrus_prop_object_t ostart, oend;
+
+       _DIAGASSERT(ms != NULL);
+       _DIAGASSERT(hints != NULL);
+
+       errnum = _citrus_prop_read_symbol(ms, name, sizeof(name));
+       if (errnum != 0)
+               return errnum;
+       for (hint = hints; hint->name != NULL; ++hint) {
+               if (_citrus_bcs_strcasecmp(name, hint->name) == 0)
+                       goto hint_found;
+       }
+       return EINVAL;
+
+hint_found:
+       _memstream_skip_ws(ms);
+       ch = _memstream_getc(ms);
+       if (ch != '=' && ch != ':')
+               _memstream_ungetc(ms, ch);
+       do {
+               _citrus_prop_object_init(&ostart, hint->type);
+               _citrus_prop_object_init(&oend, hint->type);
+               errnum = (*readers[hint->type])(ms, &ostart);
+               if (errnum != 0)
+                       return errnum;
+               _memstream_skip_ws(ms);
+               ch = _memstream_getc(ms);
+               switch (hint->type) {
+               case _CITRUS_PROP_BOOL:
+               case _CITRUS_PROP_STR:
+                       break;
+               default:
+                       if (ch != '-')
+                               break;
+                       errnum = (*readers[hint->type])(ms, &oend);
+                       if (errnum != 0)
+                               return errnum;
+                       _memstream_skip_ws(ms);
+                       ch = _memstream_getc(ms);
+               }
+#define CALL0(_func_)                                  \
+do {                                                   \
+       _DIAGASSERT(hint->cb._func_.func != NULL);      \
+       errnum = (*hint->cb._func_.func)(context,       \
+           hint->name, ostart.u._func_);               \
+} while (/*CONSTCOND*/0)
+#define CALL1(_func_)                                  \
+do {                                                   \
+       _DIAGASSERT(hint->cb._func_.func != NULL);      \
+       errnum = (*hint->cb._func_.func)(context,       \
+           hint->name, ostart.u._func_, oend.u._func_);\
+} while (/*CONSTCOND*/0)
+               switch (hint->type) {
+               case _CITRUS_PROP_BOOL: CALL0(bool); break;
+               case _CITRUS_PROP_STR : CALL0( str); break;
+               case _CITRUS_PROP_CHR : CALL1( chr); break;
+               case _CITRUS_PROP_NUM : CALL1( num); break;
+               default:
+                       abort();
+                       /*NOTREACHED*/
+               }
+#undef CALL0
+#undef CALL1
+               _citrus_prop_object_uninit(&ostart);
+               _citrus_prop_object_uninit(&oend);
+               if (errnum != 0)
+                       return errnum;
+       } while (ch == ',');
+       if (ch != ';')
+               _memstream_ungetc(ms, ch);
+       return 0;
+}
+
+int
+_citrus_prop_parse_variable(const _citrus_prop_hint_t * __restrict hints,
+       void * __restrict context, const void *var, size_t lenvar)
+{
+       struct _memstream ms;
+       int errnum, ch;
+
+       _DIAGASSERT(hints != NULL);
+
+       _memstream_bind_ptr(&ms, __DECONST(void *, var), lenvar);
+       for (;;) {
+               _memstream_skip_ws(&ms);
+               ch = _memstream_getc(&ms);
+               if (ch == EOF || ch == '\0')
+                       break;
+               _memstream_ungetc(&ms, ch);
+               errnum = _citrus_prop_parse_element(
+                   &ms, hints, (void **)&context);
+               if (errnum != 0)
+                       return errnum;
+       }
+       return 0;
+}
diff --git a/lib/libc/citrus/citrus_prop.h b/lib/libc/citrus/citrus_prop.h
new file mode 100644 (file)
index 0000000..c1f5c13
--- /dev/null
@@ -0,0 +1,92 @@
+/* $NetBSD: citrus_prop.h,v 1.3 2006/11/23 13:59:03 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_prop.h,v 1.1 2008/04/10 10:21:01 hasso Exp $ */
+
+/*-
+ * Copyright (c)2006 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_PROP_H_
+#define _CITRUS_PROP_H_
+
+typedef enum {
+       _CITRUS_PROP_BOOL = 0,
+       _CITRUS_PROP_STR  = 1,
+       _CITRUS_PROP_CHR  = 2,
+       _CITRUS_PROP_NUM  = 3,
+} _citrus_prop_type_t;
+
+typedef struct _citrus_prop_hint_t _citrus_prop_hint_t;
+
+#define _CITRUS_PROP_CB0_T(_func_, _type_) \
+typedef int (*_citrus_prop_##_func_##_cb_func_t) \
+       (void ** __restrict, const char *, _type_); \
+typedef struct { \
+       _citrus_prop_##_func_##_cb_func_t func; \
+} _citrus_prop_##_func_##_cb_t;
+_CITRUS_PROP_CB0_T(bool, int)
+_CITRUS_PROP_CB0_T(str, const char *)
+#undef _CITRUS_PROP_CB0_T
+
+#define _CITRUS_PROP_CB1_T(_func_, _type_) \
+typedef int (*_citrus_prop_##_func_##_cb_func_t) \
+       (void ** __restrict, const char *, _type_, _type_); \
+typedef struct { \
+       _citrus_prop_##_func_##_cb_func_t func; \
+} _citrus_prop_##_func_##_cb_t;
+_CITRUS_PROP_CB1_T(chr, int)
+_CITRUS_PROP_CB1_T(num, uint64_t)
+#undef _CITRUS_PROP_CB1_T
+
+struct _citrus_prop_hint_t {
+       const char *name;
+       _citrus_prop_type_t type;
+#define _CITRUS_PROP_CB_T_OPS(_name_) \
+       _citrus_prop_##_name_##_cb_t _name_
+       union {
+               _CITRUS_PROP_CB_T_OPS(bool);
+               _CITRUS_PROP_CB_T_OPS(str);
+               _CITRUS_PROP_CB_T_OPS(chr);
+               _CITRUS_PROP_CB_T_OPS(num);
+       } cb;
+};
+
+#define _CITRUS_PROP_HINT_BOOL(name, cb) \
+       { name, _CITRUS_PROP_BOOL, { .bool = { cb } } }
+#define _CITRUS_PROP_HINT_STR(name, cb) \
+       { name, _CITRUS_PROP_STR, { .str = { cb } } }
+#define _CITRUS_PROP_HINT_CHR(name, cb) \
+       { name, _CITRUS_PROP_CHR, { .chr = { cb } } }
+#define _CITRUS_PROP_HINT_NUM(name, cb) \
+       { name, _CITRUS_PROP_NUM, { .num = { cb } } }
+#define _CITRUS_PROP_HINT_END \
+       { NULL }
+
+__BEGIN_DECLS
+int _citrus_prop_parse_variable(const _citrus_prop_hint_t * __restrict,
+       void * __restrict, const void *, size_t);
+__END_DECLS
+
+#endif /* !_CITRUS_PROP_H_ */
index bdcafdc..b312ab0 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: citrus_region.h,v 1.6 2005/05/14 17:55:42 tshiozak Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/citrus_region.h,v 1.2 2005/07/04 10:11:57 joerg Exp $ */
+/* $NetBSD: citrus_region.h,v 1.7 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_region.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 701851f..06266c9 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_stdenc.c,v 1.2 2003/07/10 08:50:44 tshiozak Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_stdenc.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_stdenc.c,v 1.3 2005/10/29 18:02:04 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_stdenc.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -48,6 +48,16 @@ struct _citrus_stdenc _citrus_stdenc_default = {
 
 #ifdef _I18N_DYNAMIC
 
+static int
+/*ARGSUSED*/
+get_state_desc_default(struct _citrus_stdenc * __restrict ce,
+                      void * __restrict ps,
+                      int id,
+                      struct _citrus_stdenc_state_desc * __restrict d)
+{
+       return EOPNOTSUPP;
+}
+
 int
 _citrus_stdenc_open(struct _citrus_stdenc * __restrict * __restrict rce,
                    char const * __restrict encname,
@@ -102,6 +112,9 @@ _citrus_stdenc_open(struct _citrus_stdenc * __restrict * __restrict rce,
                goto bad;
 
        /* If return ABI version is not expected, should fixup it */
+       if (ce->ce_ops->eo_abi_version < 0x00000002) {
+               ce->ce_ops->eo_get_state_desc = &get_state_desc_default;
+       }
 
        /* validation check */
        if (ce->ce_ops->eo_init == NULL ||
@@ -110,7 +123,8 @@ _citrus_stdenc_open(struct _citrus_stdenc * __restrict * __restrict rce,
            ce->ce_ops->eo_mbtocs == NULL ||
            ce->ce_ops->eo_cstomb == NULL ||
            ce->ce_ops->eo_mbtowc == NULL ||
-           ce->ce_ops->eo_wctomb == NULL)
+           ce->ce_ops->eo_wctomb == NULL ||
+           ce->ce_ops->eo_get_state_desc == NULL)
                goto bad;
 
        /* allocate traits */
index a0a046f..ac614c6 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_stdenc.h,v 1.3 2003/07/10 08:50:44 tshiozak Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/citrus_stdenc.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_stdenc.h,v 1.4 2005/10/29 18:02:04 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_stdenc.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -35,6 +35,21 @@ struct _citrus_stdenc;
 struct _citrus_stdenc_ops;
 struct _citrus_stdenc_traits;
 
+#define _CITRUS_STDENC_SDID_GENERIC            0
+struct _citrus_stdenc_state_desc
+{
+       union {
+               struct {
+                       int     state;
+#define _CITRUS_STDENC_SDGEN_UNKNOWN           0
+#define _CITRUS_STDENC_SDGEN_INITIAL           1
+#define _CITRUS_STDENC_SDGEN_STABLE            2
+#define _CITRUS_STDENC_SDGEN_INCOMPLETE_CHAR   3
+#define _CITRUS_STDENC_SDGEN_INCOMPLETE_SHIFT  4
+               } generic;
+       } u;
+};
+
 #include "citrus_stdenc_local.h"
 
 __BEGIN_DECLS
@@ -116,4 +131,16 @@ _citrus_stdenc_get_mb_cur_max(struct _citrus_stdenc *ce)
        return ce->ce_traits->et_mb_cur_max;
 }
 
+static __inline int
+_citrus_stdenc_get_state_desc(struct _citrus_stdenc * __restrict ce,
+                             void * __restrict ps,
+                             int id,
+                             struct _citrus_stdenc_state_desc * __restrict d)
+{
+
+       _DIAGASSERT(ce && ce->ce_ops && ce->ce_ops->eo_get_state_desc);
+
+       return (*ce->ce_ops->eo_get_state_desc)(ce, ps, id, d);
+}
+
 #endif
index 4e1c20f..2923edb 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_stdenc_local.h,v 1.2 2003/06/26 12:09:57 tshiozak Exp $     */
-/*     $DragonFly: src/lib/libc/citrus/citrus_stdenc_local.h,v 1.2 2005/07/04 08:02:43 joerg Exp $ */
+/* $NetBSD: citrus_stdenc_local.h,v 1.4 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_stdenc_local.h,v 1.3 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -67,6 +67,9 @@ static int    _citrus_##_e_##_stdenc_wctomb                           \
 static int     _citrus_##_e_##_stdenc_put_state_reset                  \
        (struct _citrus_stdenc * __restrict, char * __restrict, size_t, \
         void * __restrict, size_t * __restrict);                       \
+static int     _citrus_##_e_##_stdenc_get_state_desc                   \
+       (struct _citrus_stdenc * __restrict, void * __restrict, int,    \
+       struct _citrus_stdenc_state_desc * __restrict);                 \
 CITRUS_MODULE(_e_, stdenc, _citrus_##_e_##_stdenc_getops)
 
 #define _CITRUS_STDENC_DEF_OPS(_e_)                                    \
@@ -79,7 +82,8 @@ struct _citrus_stdenc_ops _citrus_##_e_##_stdenc_ops = {              \
        /* eo_cstomb */         &_citrus_##_e_##_stdenc_cstomb,         \
        /* eo_mbtowc */         &_citrus_##_e_##_stdenc_mbtowc,         \
        /* eo_wctomb */         &_citrus_##_e_##_stdenc_wctomb,         \
-       /* eo_put_state_reset */&_citrus_##_e_##_stdenc_put_state_reset \
+       /* eo_put_state_reset */&_citrus_##_e_##_stdenc_put_state_reset,\
+       /* eo_get_state_desc */ &_citrus_##_e_##_stdenc_get_state_desc  \
 }
 
 typedef int    (*_citrus_stdenc_init_t)
@@ -108,13 +112,15 @@ typedef int       (*_citrus_stdenc_wctomb_t)
 typedef int    (*_citrus_stdenc_put_state_reset_t)
        (struct _citrus_stdenc *__restrict, char * __restrict, size_t,
         void * __restrict, size_t * __restrict);
-
+typedef int    (*_citrus_stdenc_get_state_desc_t)
+       (struct _citrus_stdenc * __restrict, void * __restrict, int,
+        struct _citrus_stdenc_state_desc * __restrict);
 /*
  * ABI version change log
  *   0x00000001
  *     initial version
  */
-#define _CITRUS_STDENC_ABI_VERSION     0x00000001
+#define _CITRUS_STDENC_ABI_VERSION     0x00000002
 struct _citrus_stdenc_ops {
        uint32_t                        eo_abi_version;
        /* version 0x00000001 */
@@ -126,6 +132,8 @@ struct _citrus_stdenc_ops {
        _citrus_stdenc_mbtowc_t         eo_mbtowc;
        _citrus_stdenc_wctomb_t         eo_wctomb;
        _citrus_stdenc_put_state_reset_t eo_put_state_reset;
+       /* version 0x00000002 */
+       _citrus_stdenc_get_state_desc_t eo_get_state_desc;
 };
 
 struct _citrus_stdenc_traits {
index e65afbb..c26046e 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_stdenc_template.h,v 1.2 2003/06/26 12:09:57 tshiozak Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/citrus_stdenc_template.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_stdenc_template.h,v 1.4 2008/02/09 14:56:20 junyoung Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_stdenc_template.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -185,3 +185,23 @@ _FUNCNAME(stdenc_put_state_reset)(struct _citrus_stdenc * __restrict ce,
        return 0;
 #endif
 }
+
+static int
+_FUNCNAME(stdenc_get_state_desc)(struct _citrus_stdenc * __restrict ce,
+                                void * __restrict ps,
+                                int id,
+                                struct _citrus_stdenc_state_desc * __restrict d)
+{
+       int ret;
+
+       switch (id) {
+       case _STDENC_SDID_GENERIC:
+               ret = _FUNCNAME(stdenc_get_state_desc_generic)(
+                       _CE_TO_EI(ce), _TO_STATE(ps), &d->u.generic.state);
+               break;
+       default:
+               ret = EOPNOTSUPP;
+       }
+
+       return ret;
+}
index 87c517b..e0d4a9b 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_types.h,v 1.3 2003/10/27 00:12:42 lukem Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/citrus_types.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/citrus_types.h,v 1.3 2003/10/27 00:12:42 lukem Exp $ */
+/* $DragonFly: src/lib/libc/citrus/citrus_types.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 85569a2..ab7718c 100644 (file)
@@ -1,8 +1,8 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_big5.c,v 1.8 2003/08/07 16:42:38 agc Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_big5.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_big5.c,v 1.11 2006/11/22 23:38:27 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_big5.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
- * Copyright (c)2002 Citrus Project,
+ * Copyright (c)2002, 2006 Citrus Project,
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * SUCH DAMAGE.
  */
 
+#include <sys/queue.h>
 #include <sys/types.h>
 #include <assert.h>
 #include <errno.h>
 #include <limits.h>
 #include <locale.h>
 #include <stddef.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "citrus_namespace.h"
 #include "citrus_types.h"
+#include "citrus_bcs.h"
 #include "citrus_module.h"
 #include "citrus_ctype.h"
 #include "citrus_stdenc.h"
 #include "citrus_big5.h"
 
+#include "citrus_prop.h"
+
 /* ----------------------------------------------------------------------
  * private stuffs used by templates
  */
@@ -86,8 +91,16 @@ typedef struct {
        int chlen;
 } _BIG5State;
 
+typedef struct _BIG5Exclude {
+       TAILQ_ENTRY(_BIG5Exclude) entry;
+       wint_t start, end;
+} _BIG5Exclude;
+
+typedef TAILQ_HEAD(_BIG5ExcludeList, _BIG5Exclude) _BIG5ExcludeList;
+
 typedef struct {
-       int dummy;
+       int cell[0x100];
+       _BIG5ExcludeList excludes;
 } _BIG5EncodingInfo;
 
 typedef struct {
@@ -144,38 +157,135 @@ _citrus_BIG5_unpack_state(_BIG5EncodingInfo * __restrict ei,
 }
 
 static __inline int
-_citrus_BIG5_check(u_int c)
+_citrus_BIG5_check(_BIG5EncodingInfo *ei, u_int c)
 {
-       c &= 0xff;
-       return ((c >= 0xa1 && c <= 0xfe) ? 2 : 1);
+       _DIAGASSERT(ei != NULL);
+
+       return (ei->cell[c & 0xFF] & 0x1) ? 2 : 1;
 }
 
 static __inline int
-_citrus_BIG5_check2(u_int c)
+_citrus_BIG5_check2(_BIG5EncodingInfo *ei, u_int c)
 {
-       c &= 0xff;
-       if ((c >= 0x40 && c <= 0x7f) || (c >= 0xa1 && c <= 0xfe))
-               return 1;
-       else
-               return 0;
+       _DIAGASSERT(ei != NULL);
+
+       return (ei->cell[c & 0xFF] & 0x2) ? 1 : 0;
 }
 
-static int
-/*ARGSUSED*/
-_citrus_BIG5_encoding_module_init(_BIG5EncodingInfo * __restrict ei,
-                                 const void * __restrict var, size_t lenvar)
+static __inline int
+_citrus_BIG5_check_excludes(_BIG5EncodingInfo *ei, wint_t c)
 {
+       _BIG5Exclude *exclude;
+
        _DIAGASSERT(ei != NULL);
 
-       memset((void *)ei, 0, sizeof(*ei));
+       TAILQ_FOREACH(exclude, &ei->excludes, entry) {
+               if (c >= exclude->start && c <= exclude->end)
+                       return EILSEQ;
+       }
+       return 0;
+}
 
-       return (0);
+static int
+_citrus_BIG5_fill_rowcol(void ** __restrict ctx, const char * __restrict s,
+       uint64_t start, uint64_t end)
+{
+       _BIG5EncodingInfo *ei;
+       int i;
+       uint64_t n;
+
+       _DIAGASSERT(ctx != NULL && *ctx != NULL);
+
+       if (start > 0xFF || end > 0xFF)
+               return EINVAL;
+       ei = (_BIG5EncodingInfo *)*ctx;
+       i = strcmp("row", s) ? 1 : 0;
+       i = 1 << i;
+       for (n = start; n <= end; ++n)
+               ei->cell[n & 0xFF] |= i;
+       return 0;
 }
 
+static int
+/*ARGSUSED*/
+_citrus_BIG5_fill_excludes(void ** __restrict ctx, const char * __restrict s,
+       uint64_t start, uint64_t end)
+{
+       _BIG5EncodingInfo *ei;
+       _BIG5Exclude *exclude;
+
+       _DIAGASSERT(ctx != NULL && *ctx != NULL);
+
+       if (start > 0xFFFF || end > 0xFFFF)
+               return EINVAL;
+       ei = (_BIG5EncodingInfo *)*ctx;
+       exclude = TAILQ_LAST(&ei->excludes, _BIG5ExcludeList);
+       if (exclude != NULL && (wint_t)start <= exclude->end)
+               return EINVAL;
+       exclude = (void *)malloc(sizeof(*exclude));
+       if (exclude == NULL)
+               return ENOMEM;
+       exclude->start = (wint_t)start;
+       exclude->end = (wint_t)end;
+       TAILQ_INSERT_TAIL(&ei->excludes, exclude, entry);
+
+       return 0;
+}
+
+static const _citrus_prop_hint_t root_hints[] = {
+    _CITRUS_PROP_HINT_NUM("row", &_citrus_BIG5_fill_rowcol),
+    _CITRUS_PROP_HINT_NUM("col", &_citrus_BIG5_fill_rowcol),
+    _CITRUS_PROP_HINT_NUM("excludes", &_citrus_BIG5_fill_excludes),
+    _CITRUS_PROP_HINT_END
+};
+
 static void
 /*ARGSUSED*/
 _citrus_BIG5_encoding_module_uninit(_BIG5EncodingInfo *ei)
 {
+       _BIG5Exclude *exclude;
+
+       _DIAGASSERT(ei != NULL);
+
+       while ((exclude = TAILQ_FIRST(&ei->excludes)) != NULL) {
+               TAILQ_REMOVE(&ei->excludes, exclude, entry);
+               free(exclude);
+       }
+}
+
+static int
+/*ARGSUSED*/
+_citrus_BIG5_encoding_module_init(_BIG5EncodingInfo * __restrict ei,
+                                 const void * __restrict var, size_t lenvar)
+{
+       int err;
+       const char *s;
+
+       _DIAGASSERT(ei != NULL);
+
+       memset((void *)ei, 0, sizeof(*ei));
+       TAILQ_INIT(&ei->excludes);
+
+       if (lenvar > 0 && var != NULL) {
+               s = _bcs_skip_ws_len((const char *)var, &lenvar);
+               if (lenvar > 0 && *s != '\0') {
+                       err = _citrus_prop_parse_variable(
+                           root_hints, (void *)ei, s, lenvar);
+                       if (err == 0)
+                               return 0;
+
+                       _citrus_BIG5_encoding_module_uninit(ei);
+                       memset((void *)ei, 0, sizeof(*ei));
+                       TAILQ_INIT(&ei->excludes);
+               }
+       }
+
+       /* fallback Big5-1984, for backward compatibility. */
+       _citrus_BIG5_fill_rowcol((void **)&ei, "row", 0xA1, 0xFE);
+       _citrus_BIG5_fill_rowcol((void **)&ei, "col", 0x40, 0x7E);
+       _citrus_BIG5_fill_rowcol((void **)&ei, "col", 0xA1, 0xFE);
+
+       return 0;
 }
 
 static int
@@ -222,7 +332,7 @@ _citrus_BIG5_mbrtowc_priv(_BIG5EncodingInfo * __restrict ei,
                goto ilseq;
        }
 
-       c = _citrus_BIG5_check(psenc->ch[0] & 0xff);
+       c = _citrus_BIG5_check(ei, psenc->ch[0] & 0xff);
        if (c == 0)
                goto ilseq;
        while (psenc->chlen < c) {
@@ -239,7 +349,7 @@ _citrus_BIG5_mbrtowc_priv(_BIG5EncodingInfo * __restrict ei,
                wchar = psenc->ch[0] & 0xff;
                break;
        case 2:
-               if (!_citrus_BIG5_check2(psenc->ch[1] & 0xff))
+               if (!_citrus_BIG5_check2(ei, psenc->ch[1] & 0xff))
                        goto ilseq;
                wchar = ((psenc->ch[0] & 0xff) << 8) | (psenc->ch[1] & 0xff);
                break;
@@ -248,6 +358,9 @@ _citrus_BIG5_mbrtowc_priv(_BIG5EncodingInfo * __restrict ei,
                goto ilseq;
        }
 
+       if (_citrus_BIG5_check_excludes(ei, (wint_t)wchar) != 0)
+               goto ilseq;
+
        *s = s0;
        psenc->chlen = 0;
        if (pwc)
@@ -284,20 +397,21 @@ _citrus_BIG5_wcrtomb_priv(_BIG5EncodingInfo * __restrict ei,
        _DIAGASSERT(s != NULL);
 
        /* check invalid sequence */
-       if (wc & ~0xffff) {
+       if (wc & ~0xffff ||
+           _citrus_BIG5_check_excludes(ei, (wint_t)wc) != 0) {
                ret = EILSEQ;
                goto err;
        }
 
        if (wc & 0x8000) {
-               if (_citrus_BIG5_check((wc >> 8) & 0xff) != 2 ||
-                   !_citrus_BIG5_check2(wc & 0xff)) {
+               if (_citrus_BIG5_check(ei, (wc >> 8) & 0xff) != 2 ||
+                   !_citrus_BIG5_check2(ei, wc & 0xff)) {
                        ret = EILSEQ;
                        goto err;
                }
                l = 2;
        } else {
-               if (wc & ~0xff || !_citrus_BIG5_check(wc & 0xff)) {
+               if (wc & ~0xff || !_citrus_BIG5_check(ei, wc & 0xff)) {
                        ret = EILSEQ;
                        goto err;
                }
@@ -334,12 +448,9 @@ _citrus_BIG5_stdenc_wctocs(_BIG5EncodingInfo * __restrict ei,
 
        _DIAGASSERT(csid != NULL && idx != NULL);
 
-       if (wc<0x100)
-               *csid = 0;
-       else
-               *csid = 1;
+       *csid = (wc < 0x100) ? 0 : 1;
        *idx = (_index_t)wc;
-               
+
        return 0;
 }
 
@@ -349,23 +460,11 @@ _citrus_BIG5_stdenc_cstowc(_BIG5EncodingInfo * __restrict ei,
                           wchar_t * __restrict wc,
                           _csid_t csid, _index_t idx)
 {
-       u_int8_t h, l;
-
        _DIAGASSERT(wc != NULL);
 
        switch (csid) {
        case 0:
-               if (idx>=0x80U)
-                       return EILSEQ;
-               *wc = (wchar_t)idx;
-               break;
        case 1:
-               if (idx>=0x10000U)
-                       return EILSEQ;
-               h = idx >> 8;
-               l = idx;
-               if (h<0xA1 || h>0xF9 || l<0x40 || l>0xFE)
-                       return EILSEQ;
                *wc = (wchar_t)idx;
                break;
        default:
@@ -375,6 +474,21 @@ _citrus_BIG5_stdenc_cstowc(_BIG5EncodingInfo * __restrict ei,
        return 0;
 }
 
+static __inline int
+/*ARGSUSED*/
+_citrus_BIG5_stdenc_get_state_desc_generic(_BIG5EncodingInfo * __restrict ei,
+                                          _BIG5State * __restrict psenc,
+                                          int * __restrict rstate)
+{
+
+       if (psenc->chlen == 0)
+               *rstate = _STDENC_SDGEN_INITIAL;
+       else
+               *rstate = _STDENC_SDGEN_INCOMPLETE_CHAR;
+
+       return 0;
+}
+
 /* ----------------------------------------------------------------------
  * public interface for ctype
  */
index e9813a3..b962715 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_big5.h,v 1.2 2003/06/25 09:51:41 tshiozak Exp $     */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_big5.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/modules/citrus_big5.h,v 1.2 2003/06/25 09:51:41 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_big5.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
diff --git a/lib/libc/citrus/modules/citrus_dechanyu.c b/lib/libc/citrus/modules/citrus_dechanyu.c
new file mode 100644 (file)
index 0000000..20e4c62
--- /dev/null
@@ -0,0 +1,439 @@
+/* $NetBSD: citrus_dechanyu.c,v 1.2 2007/04/24 15:42:08 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_dechanyu.c,v 1.1 2008/04/10 10:21:01 hasso Exp $ */
+
+/*-
+ * Copyright (c)2007 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/types.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <locale.h>
+#include <wchar.h>
+#include <limits.h>
+
+#include "citrus_namespace.h"
+#include "citrus_types.h"
+#include "citrus_bcs.h"
+#include "citrus_module.h"
+#include "citrus_ctype.h"
+#include "citrus_stdenc.h"
+#include "citrus_dechanyu.h"
+
+/* ----------------------------------------------------------------------
+ * private stuffs used by templates
+ */
+
+typedef struct {
+       int chlen;
+       char ch[4];
+} _DECHanyuState;
+
+typedef struct {
+       int dummy;
+} _DECHanyuEncodingInfo;
+
+typedef struct {
+       _DECHanyuEncodingInfo   ei;
+       struct {
+               /* for future multi-locale facility */
+               _DECHanyuState  s_mblen;
+               _DECHanyuState  s_mbrlen;
+               _DECHanyuState  s_mbrtowc;
+               _DECHanyuState  s_mbtowc;
+               _DECHanyuState  s_mbsrtowcs;
+               _DECHanyuState  s_wcrtomb;
+               _DECHanyuState  s_wcsrtombs;
+               _DECHanyuState  s_wctomb;
+       } states;
+} _DECHanyuCTypeInfo;
+
+#define _CEI_TO_EI(_cei_)              (&(_cei_)->ei)
+#define _CEI_TO_STATE(_cei_, _func_)   (_cei_)->states.__CONCAT(s_,_func_)
+
+#define _FUNCNAME(m)                   __CONCAT(_citrus_DECHanyu_,m)
+#define _ENCODING_INFO                 _DECHanyuEncodingInfo
+#define _CTYPE_INFO                    _DECHanyuCTypeInfo
+#define _ENCODING_STATE                        _DECHanyuState
+#define _ENCODING_MB_CUR_MAX(_ei_)             4
+#define _ENCODING_IS_STATE_DEPENDENT           0
+#define _STATE_NEEDS_EXPLICIT_INIT(_ps_)       0
+
+static __inline void
+/*ARGSUSED*/
+_citrus_DECHanyu_init_state(_DECHanyuEncodingInfo * __restrict ei,
+       _DECHanyuState * __restrict psenc)
+{
+       /* ei may be null */
+       _DIAGASSERT(psenc != NULL);
+
+       psenc->chlen = 0;
+}
+
+static __inline void
+/*ARGSUSED*/
+_citrus_DECHanyu_pack_state(_DECHanyuEncodingInfo * __restrict ei,
+       void * __restrict pspriv,
+       const _DECHanyuState * __restrict psenc)
+{
+       /* ei may be null */
+       _DIAGASSERT(pspriv != NULL);
+       _DIAGASSERT(psenc != NULL);
+
+       memcpy(pspriv, (const void *)psenc, sizeof(*psenc));
+}
+
+static __inline void
+/*ARGSUSED*/
+_citrus_DECHanyu_unpack_state(_DECHanyuEncodingInfo * __restrict ei,
+       _DECHanyuState * __restrict psenc,
+       const void * __restrict pspriv)
+{
+       /* ei may be null */
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(pspriv != NULL);
+
+       memcpy((void *)psenc, pspriv, sizeof(*psenc));
+}
+
+static void
+/*ARGSUSED*/
+_citrus_DECHanyu_encoding_module_uninit(_DECHanyuEncodingInfo *ei)
+{
+       /* ei may be null */
+}
+
+static int
+/*ARGSUSED*/
+_citrus_DECHanyu_encoding_module_init(_DECHanyuEncodingInfo * __restrict ei,
+       const void * __restrict var, size_t lenvar)
+{
+       /* ei may be null */
+       return 0;
+}
+
+static __inline int
+is_singlebyte(int c)
+{
+       return c <= 0x7F;
+}
+
+static __inline int
+is_leadbyte(int c)
+{
+       return c >= 0xA1 && c <= 0xFE;
+}
+
+static __inline int
+is_trailbyte(int c)
+{
+       c &= ~0x80;
+       return c >= 0x21 && c <= 0x7E;
+}
+
+static __inline int
+is_hanyu1(int c)
+{
+       return c == 0xC2;
+}
+
+static __inline int
+is_hanyu2(int c)
+{
+       return c == 0xCB;
+}
+
+#define HANYUBIT       0xC2CB0000
+
+static __inline int
+is_94charset(int c)
+{
+       return c >= 0x21 && c <= 0x7E;
+}
+
+static int
+/*ARGSUSED*/
+_citrus_DECHanyu_mbrtowc_priv(_DECHanyuEncodingInfo * __restrict ei,
+       wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
+       _DECHanyuState * __restrict psenc, size_t * __restrict nresult)
+{
+       const char *s0;
+       int ch, i;
+       wchar_t wc;
+
+       /* ei may be unused */
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(nresult != NULL);
+
+       if (*s == NULL) {
+               _citrus_DECHanyu_init_state(ei, psenc);
+               *nresult = _ENCODING_IS_STATE_DEPENDENT;
+               return 0;
+       } 
+       s0 = *s;
+
+       wc = (wchar_t)0;
+       switch (psenc->chlen) {
+       case 0:
+               if (n-- < 1)
+                       goto restart;
+               ch = *s0++ & 0xFF;
+               if (is_singlebyte(ch) != 0) {
+                       if (pwc != NULL)
+                               *pwc = (wchar_t)ch;
+                       *nresult = (size_t)((ch == 0) ? 0 : 1);
+                       *s = s0;
+                       return 0;
+               }
+               if (is_leadbyte(ch) == 0)
+                       goto ilseq;
+               psenc->ch[psenc->chlen++] = ch;
+               break;
+       case 1:
+               ch = psenc->ch[0] & 0xFF;
+               if (is_leadbyte(ch) == 0)
+                       return EINVAL;
+               break;
+       case 2: case 3:
+               ch = psenc->ch[0] & 0xFF;
+               if (is_hanyu1(ch) != 0) {
+                       ch = psenc->ch[1] & 0xFF;
+                       if (is_hanyu2(ch) != 0) {
+                               wc |= (wchar_t)HANYUBIT;
+                               break;
+                       }
+               }
+       /*FALLTHROUGH*/
+       default:
+               return EINVAL;
+       }
+
+       switch (psenc->chlen) {
+       case 1:
+               if (is_hanyu1(ch) != 0) {
+                       if (n-- < 1)
+                               goto restart;
+                       ch = *s0++ & 0xFF;
+                       if (is_hanyu2(ch) == 0)
+                               goto ilseq;
+                       psenc->ch[psenc->chlen++] = ch;
+                       wc |= (wchar_t)HANYUBIT;
+                       if (n-- < 1)
+                               goto restart;
+                       ch = *s0++ & 0xFF;
+                       if (is_leadbyte(ch) == 0)
+                               goto ilseq;
+                       psenc->ch[psenc->chlen++] = ch;
+               }
+               break;
+       case 2:
+               if (n-- < 1)
+                       goto restart;
+               ch = *s0++ & 0xFF;
+               if (is_leadbyte(ch) == 0)
+                       goto ilseq;
+               psenc->ch[psenc->chlen++] = ch;
+               break;
+       case 3:
+               ch = psenc->ch[2] & 0xFF;
+               if (is_leadbyte(ch) == 0)
+                       return EINVAL;
+       }
+       if (n-- < 1)
+               goto restart;
+       wc |= (wchar_t)(ch << 8);
+       ch = *s0++ & 0xFF;
+       if (is_trailbyte(ch) == 0)
+               goto ilseq;
+       wc |= (wchar_t)ch;
+       if (pwc != NULL)
+               *pwc = wc;
+       *nresult = (size_t)(s0 - *s);
+       *s = s0;
+       psenc->chlen = 0;
+
+       return 0;
+
+restart:
+       *nresult = (size_t)-2;
+       *s = s0;
+       return 0;
+
+ilseq:
+       *nresult = (size_t)-1;
+       return EILSEQ;
+}
+
+static int
+/*ARGSUSED*/
+_citrus_DECHanyu_wcrtomb_priv(_DECHanyuEncodingInfo * __restrict ei,
+       char * __restrict s, size_t n, wchar_t wc,
+       _DECHanyuState * __restrict psenc, size_t * __restrict nresult)
+{
+       int ch;
+
+       /* ei may be unused */
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(nresult != NULL);
+
+       if (psenc->chlen != 0)
+               return EINVAL;
+
+       /* XXX: assume wchar_t as int */
+       if ((uint32_t)wc <= 0x7F) {
+               ch = wc & 0xFF;
+       } else {
+               if ((uint32_t)wc > 0xFFFF) {
+                       if ((wc & ~0xFFFF) != HANYUBIT)
+                               goto ilseq;
+                       psenc->ch[psenc->chlen++] = (wc >> 24) & 0xFF;
+                       psenc->ch[psenc->chlen++] = (wc >> 16) & 0xFF;
+                       wc &= 0xFFFF;
+               }
+               ch = (wc >> 8) & 0xFF;
+               if (!is_leadbyte(ch))
+                       goto ilseq;
+               psenc->ch[psenc->chlen++] = ch;
+               ch = wc & 0xFF;
+               if (is_trailbyte(ch) == 0)
+                       goto ilseq;
+       }
+       psenc->ch[psenc->chlen++] = ch;
+       if (n < psenc->chlen) {
+               *nresult = (size_t)-1;
+               return E2BIG;
+       }
+       memcpy(s, psenc->ch, psenc->chlen);
+       *nresult = psenc->chlen;
+       psenc->chlen = 0;
+
+       return 0;
+
+ilseq:
+       *nresult = (size_t)-1;
+       return EILSEQ;
+}
+
+static __inline int
+/*ARGSUSED*/
+_citrus_DECHanyu_stdenc_wctocs(_DECHanyuEncodingInfo * __restrict ei,
+       _csid_t * __restrict csid, _index_t * __restrict idx, wchar_t wc)
+{
+       int plane;
+       wchar_t mask;
+
+       /* ei may be unused */
+       _DIAGASSERT(csid != NULL);
+       _DIAGASSERT(idx != NULL);
+
+       plane = 0;
+       mask = 0x7F;
+       /* XXX: assume wchar_t as int */
+       if ((uint32_t)wc > 0x7F) {
+               if ((uint32_t)wc > 0xFFFF) {
+                       if ((wc & ~0xFFFF) != HANYUBIT)
+                               return EILSEQ;
+                       plane += 2;
+               }
+               if (is_leadbyte((wc >> 8) & 0xFF) == 0 ||
+                   is_trailbyte(wc & 0xFF) == 0)
+                       return EILSEQ;
+               plane += (wc & 0x80) ? 1 : 2;
+               mask |= 0x7F00;
+       }
+       *csid = plane;
+       *idx = (_index_t)(wc & mask);
+
+       return 0;
+}
+
+static __inline int
+/*ARGSUSED*/
+_citrus_DECHanyu_stdenc_cstowc(_DECHanyuEncodingInfo * __restrict ei,
+       wchar_t * __restrict wc, _csid_t csid, _index_t idx)
+{
+       /* ei may be unused */
+       _DIAGASSERT(wc != NULL);
+
+       if (csid == 0) {
+               if (idx > 0x7F)
+                       return EILSEQ;
+       } else if (csid <= 4) {
+               if (is_94charset(idx >> 8) == 0)
+                       return EILSEQ;
+               if (is_94charset(idx & 0xFF) == 0)
+                       return EILSEQ;
+               if (csid % 2)
+                       idx |= 0x80;
+               idx |= 0x8000;
+               if (csid > 2)
+                       idx |= HANYUBIT;
+       } else
+               return EILSEQ;
+       *wc = (wchar_t)idx;
+       return 0;
+}
+
+static __inline int
+/*ARGSUSED*/
+_citrus_DECHanyu_stdenc_get_state_desc_generic(
+       _DECHanyuEncodingInfo * __restrict ei,
+       _DECHanyuState * __restrict psenc, int * __restrict rstate)
+{
+       /* ei may be unused */
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(rstate != NULL);
+
+       *rstate = (psenc->chlen == 0)
+           ? _STDENC_SDGEN_INITIAL
+           : _STDENC_SDGEN_INCOMPLETE_CHAR;
+       return 0;
+}
+
+/* ----------------------------------------------------------------------
+ * public interface for ctype
+ */
+
+_CITRUS_CTYPE_DECLS(DECHanyu);
+_CITRUS_CTYPE_DEF_OPS(DECHanyu);
+
+#include "citrus_ctype_template.h"
+
+
+/* ----------------------------------------------------------------------
+ * public interface for stdenc
+ */
+
+_CITRUS_STDENC_DECLS(DECHanyu);
+_CITRUS_STDENC_DEF_OPS(DECHanyu);
+
+#include "citrus_stdenc_template.h"
similarity index 79%
copy from lib/libc/citrus/citrus_db_hash.h
copy to lib/libc/citrus/modules/citrus_dechanyu.h
index 6f4c6c4..156ff17 100644 (file)
@@ -1,9 +1,8 @@
-/*     $NetBSD: src/lib/libc/citrus/citrus_db_hash.h,v 1.1 2003/06/25 09:51:31 tshiozak Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/citrus_db_hash.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
-
+/* $NetBSD: citrus_dechanyu.h,v 1.1 2007/04/01 18:52:32 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_dechanyu.h,v 1.1 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
- * Copyright (c)2003 Citrus Project,
+ * Copyright (c)2006 Citrus Project,
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * SUCH DAMAGE.
  */
 
-#ifndef _CITRUS_DB_HASH_H_
-#define _CITRUS_DB_HASH_H_
+#ifndef _CITRUS_DECHANYU_H_
+#define _CITRUS_DECHANYU_H_
 
 __BEGIN_DECLS
-uint32_t       _citrus_db_hash_std(void *, struct _citrus_region *);
+_CITRUS_CTYPE_GETOPS_FUNC(DECHanyu);
+_CITRUS_STDENC_GETOPS_FUNC(DECHanyu);
 __END_DECLS
 
 #endif
index 0de54a5..3a424c4 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_euc.c,v 1.8 2003/08/07 16:42:38 agc Exp $   */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_euc.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_euc.c,v 1.11 2006/03/19 01:25:44 christos Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_euc.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -261,6 +261,8 @@ _citrus_EUC_mbrtowc_priv(_EUCEncodingInfo *ei, wchar_t *pwc, const char **s,
                len = c;
                s1 = &psenc->ch[0];
                break;
+       default:
+               goto encoding_error;
        }
        wchar = 0;
        while (len-- > 0)
@@ -319,7 +321,7 @@ _citrus_EUC_wcrtomb_priv(_EUCEncodingInfo *ei, char *s, size_t n, wchar_t wc,
                ret = E2BIG;
                goto err;
        }
-       m = (cs % 2) ? 0x80 : 0x00;
+       m = (cs) ? 0x80 : 0x00;
        switch (cs) {
        case 2:
                *s++ = _SS2;
@@ -378,6 +380,21 @@ _citrus_EUC_stdenc_cstowc(_EUCEncodingInfo * __restrict ei,
        return (0);
 }
 
+static __inline int
+/*ARGSUSED*/
+_citrus_EUC_stdenc_get_state_desc_generic(_EUCEncodingInfo * __restrict ei,
+                                         _EUCState * __restrict psenc,
+                                         int * __restrict rstate)
+{
+
+       if (psenc->chlen == 0)
+               *rstate = _STDENC_SDGEN_INITIAL;
+       else
+               *rstate = _STDENC_SDGEN_INCOMPLETE_CHAR;
+
+       return 0;
+}
+
 static int
 /*ARGSUSED*/
 _citrus_EUC_encoding_module_init(_EUCEncodingInfo * __restrict ei,
index 922dd6e..2476f42 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_euc.h,v 1.2 2003/06/25 09:51:42 tshiozak Exp $      */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_euc.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/modules/citrus_euc.h,v 1.2 2003/06/25 09:51:42 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_euc.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
index 24148c1..f2fa702 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_euctw.c,v 1.8 2003/10/14 12:50:03 yamt Exp $        */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_euctw.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_euctw.c,v 1.10 2005/10/29 18:02:04 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_euctw.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -378,15 +378,12 @@ _citrus_EUCTW_stdenc_cstowc(_EUCTWEncodingInfo * __restrict ei,
 
        _DIAGASSERT(ei != NULL && wc != NULL);
 
-       if (csid > 7 || (idx & ~0x7F7F) != 0)
-               return (EINVAL);
-
        if (csid==0) {
                if ((idx & ~0x7F) != 0)
                        return (EINVAL);
                *wc = (wchar_t)idx;
        } else {
-               if ((idx & ~0x7F7F) != 0)
+               if (csid < 'G' || csid > 'M' || (idx & ~0x7F7F) != 0)
                        return (EINVAL);
                *wc = (wchar_t)idx | ((wchar_t)csid<<24);
        }
@@ -394,6 +391,21 @@ _citrus_EUCTW_stdenc_cstowc(_EUCTWEncodingInfo * __restrict ei,
        return (0);
 }
 
+static __inline int
+/*ARGSUSED*/
+_citrus_EUCTW_stdenc_get_state_desc_generic(_EUCTWEncodingInfo * __restrict ei,
+                                           _EUCTWState * __restrict psenc,
+                                           int * __restrict rstate)
+{
+
+       if (psenc->chlen == 0)
+               *rstate = _STDENC_SDGEN_INITIAL;
+       else
+               *rstate = _STDENC_SDGEN_INCOMPLETE_CHAR;
+
+       return 0;
+}
+
 /* ----------------------------------------------------------------------
  * public interface for ctype
  */
index 34b6b36..0772c9e 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_euctw.h,v 1.2 2003/06/25 09:51:42 tshiozak Exp $    */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_euctw.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/modules/citrus_euctw.h,v 1.2 2003/06/25 09:51:42 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_euctw.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
index 3d7af82..db9f827 100644 (file)
@@ -1,5 +1,5 @@
-/* $NetBSD: src/lib/libc/citrus/modules/citrus_gbk2k.c,v 1.4 2003/06/26 12:09:57 tshiozak Exp $ */
-/* $DragonFly: src/lib/libc/citrus/modules/citrus_gbk2k.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_gbk2k.c,v 1.6 2006/02/15 19:50:27 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_gbk2k.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -57,9 +57,8 @@ typedef struct _GBK2KState {
 } _GBK2KState;
 
 typedef struct {
-       int ei_mode;
+       int mb_cur_max;
 } _GBK2KEncodingInfo;
-#define _MODE_2BYTE    0x0001
 
 typedef struct {
        _GBK2KEncodingInfo      ei;
@@ -83,7 +82,7 @@ typedef struct {
 #define _ENCODING_INFO                 _GBK2KEncodingInfo
 #define _CTYPE_INFO                    _GBK2KCTypeInfo
 #define _ENCODING_STATE                        _GBK2KState
-#define _ENCODING_MB_CUR_MAX(_ei_)     4
+#define _ENCODING_MB_CUR_MAX(_ei_)     (_ei_)->mb_cur_max
 #define _ENCODING_IS_STATE_DEPENDENT   0
 #define _STATE_NEEDS_EXPLICIT_INIT(_ps_)       0
 
@@ -219,7 +218,7 @@ _citrus_GBK2K_mbrtowc_priv(_GBK2KEncodingInfo * __restrict ei,
                case 2:
                        if (_mb_trailbyte (_PSENC))
                                goto convert;
-                       if ((ei->ei_mode & _MODE_2BYTE) == 0 &&
+                       if (ei->mb_cur_max == 4 &&
                            _mb_surrogate (_PSENC))
                                continue;
                        goto ilseq;
@@ -302,7 +301,7 @@ _citrus_GBK2K_wcrtomb_priv(_GBK2KEncodingInfo * __restrict ei,
                }
                break;
        case 4:
-               if ((ei->ei_mode & _MODE_2BYTE) != 0 ||
+               if (ei->mb_cur_max != 4 ||
                    !_mb_leadbyte  (_PUSH_PSENC(wc >> 24)) ||
                    !_mb_surrogate (_PUSH_PSENC(wc >> 16)) ||
                    !_mb_leadbyte  (_PUSH_PSENC(wc >>  8)) ||
@@ -386,7 +385,7 @@ _citrus_GBK2K_stdenc_cstowc(_GBK2KEncodingInfo * __restrict ei,
                break;
        case 3:
                /* GBKUCS : XXX */
-               if ((ei->ei_mode & _MODE_2BYTE) != 0)
+               if (ei->mb_cur_max != 4)
                        return EINVAL;
                *wc = (wchar_t)idx;
                break;
@@ -397,6 +396,21 @@ _citrus_GBK2K_stdenc_cstowc(_GBK2KEncodingInfo * __restrict ei,
        return 0;
 }
 
+static __inline int
+/*ARGSUSED*/
+_citrus_GBK2K_stdenc_get_state_desc_generic(_GBK2KEncodingInfo * __restrict ei,
+                                           _GBK2KState * __restrict psenc,
+                                           int * __restrict rstate)
+{
+
+       if (psenc->chlen == 0)
+               *rstate = _STDENC_SDGEN_INITIAL;
+       else
+               *rstate = _STDENC_SDGEN_INCOMPLETE_CHAR;
+
+       return 0;
+}
+
 static int
 /*ARGSUSED*/
 _citrus_GBK2K_encoding_module_init(_GBK2KEncodingInfo * __restrict ei,
@@ -416,17 +430,18 @@ do {                                                            \
                 p += sizeof(#x)-1;                              \
         }                                                       \
 } while (/*CONSTCOND*/0)
+       memset((void *)ei, 0, sizeof(*ei));
+       ei->mb_cur_max = 4;
        while (lenvar>0) {
                switch (_bcs_tolower(*p)) {
                case '2':
-                       MATCH("2byte", ei->ei_mode |= _MODE_2BYTE);
+                       MATCH("2byte", ei->mb_cur_max = 2);
                        break;
                }
                p++;
                lenvar--;
        }
 
-       memset((void *)ei, 0, sizeof(*ei));
        return (0);
 }
 
diff --git a/lib/libc/citrus/modules/citrus_hz.c b/lib/libc/citrus/modules/citrus_hz.c
new file mode 100644 (file)
index 0000000..8230c91
--- /dev/null
@@ -0,0 +1,723 @@
+/* $NetBSD: citrus_hz.c,v 1.1 2006/11/22 23:38:27 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_hz.c,v 1.1 2008/04/10 10:21:01 hasso Exp $ */
+
+/*-
+ * Copyright (c)2004, 2006 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/queue.h>
+#include <sys/types.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <locale.h>
+#include <limits.h>
+#include <wchar.h>
+
+#include "citrus_namespace.h"
+#include "citrus_types.h"
+#include "citrus_bcs.h"
+#include "citrus_module.h"
+#include "citrus_ctype.h"
+#include "citrus_stdenc.h"
+
+#include "citrus_hz.h"
+#include "citrus_prop.h"
+
+/*
+ * wchar_t mapping:
+ *
+ * CTRL/ASCII  00000000 00000000 00000000 gxxxxxxx
+ * GB2312      00000000 00000000 0xxxxxxx gxxxxxxx
+ * 94/96*n (~M)        0mmmmmmm 0xxxxxxx 0xxxxxxx gxxxxxxx
+ */
+
+#define ESCAPE_CHAR    '~'
+
+typedef enum {
+       CTRL = 0, ASCII = 1, GB2312 = 2, CS94 = 3, CS96 = 4
+} charset_t;
+
+typedef struct {
+       int start, end, width;
+} range_t;
+
+static const range_t ranges[] = {
+#define RANGE(start, end) { start, end, (end - start) + 1 }
+/* CTRL   */ RANGE(0x00, 0x1F),
+/* ASCII  */ RANGE(0x20, 0x7F),
+/* GB2312 */ RANGE(0x21, 0x7E),
+/* CS94   */ RANGE(0x21, 0x7E),
+/* CS96   */ RANGE(0x20, 0x7F),
+#undef RANGE
+};
+
+typedef struct escape_t escape_t;
+typedef struct {
+       charset_t charset;
+       size_t length;
+#define ROWCOL_MAX     3
+       escape_t *escape;
+} graphic_t;
+
+typedef TAILQ_HEAD(escape_list, escape_t) escape_list;
+struct escape_t {
+       TAILQ_ENTRY(escape_t) entry;
+       int ch;
+       graphic_t *left, *right;
+       escape_list *set;
+};
+
+#define GL(escape)     ((escape)->left)
+#define GR(escape)     ((escape)->right)
+#define SET(escape)    ((escape)->set)
+#define ESC(escape)    ((escape)->ch)
+#define INIT(escape)   (TAILQ_FIRST(SET(escape)))
+
+static __inline escape_t *
+find_escape(escape_list *set, int ch)
+{
+       escape_t *escape;
+
+       _DIAGASSERT(set != NULL);
+
+       TAILQ_FOREACH(escape, set, entry) {
+               if (ESC(escape) == ch)
+                       break;
+       }
+
+       return escape;
+}
+
+typedef struct {
+       escape_list e0, e1;
+       graphic_t *ascii, *gb2312;
+} _HZEncodingInfo;
+
+#define E0SET(ei)      (&(ei)->e0)
+#define E1SET(ei)      (&(ei)->e1)
+#define INIT0(ei)      (TAILQ_FIRST(E0SET(ei)))
+#define INIT1(ei)      (TAILQ_FIRST(E1SET(ei)))
+
+typedef struct {
+       int chlen;
+       char ch[ROWCOL_MAX];
+       escape_t *inuse;
+} _HZState;
+
+typedef struct {
+       _HZEncodingInfo         ei;
+       struct {
+               /* for future multi-locale facility */
+               _HZState        s_mblen;
+               _HZState        s_mbrlen;
+               _HZState        s_mbrtowc;
+               _HZState        s_mbtowc;
+               _HZState        s_mbsrtowcs;
+               _HZState        s_wcrtomb;
+               _HZState        s_wcsrtombs;
+               _HZState        s_wctomb;
+       } states;
+} _HZCTypeInfo;
+
+#define _CEI_TO_EI(_cei_)              (&(_cei_)->ei)
+#define _CEI_TO_STATE(_cei_, _func_)   (_cei_)->states.s_##_func_
+
+#define _FUNCNAME(m)                   _citrus_HZ_##m
+#define _ENCODING_INFO                 _HZEncodingInfo
+#define _CTYPE_INFO                    _HZCTypeInfo
+#define _ENCODING_STATE                        _HZState
+#define _ENCODING_MB_CUR_MAX(_ei_)     MB_LEN_MAX
+#define _ENCODING_IS_STATE_DEPENDENT           1
+#define _STATE_NEEDS_EXPLICIT_INIT(_ps_)       ((_ps_)->inuse == NULL)
+
+static __inline void
+_citrus_HZ_init_state(_HZEncodingInfo * __restrict ei,
+       _HZState * __restrict psenc)
+{
+       _DIAGASSERT(ei != NULL);
+       _DIAGASSERT(psenc != NULL);
+
+       psenc->chlen = 0;
+       psenc->inuse = INIT0(ei);
+}
+
+static __inline void
+/*ARGSUSED*/
+_citrus_HZ_pack_state(_HZEncodingInfo * __restrict ei,
+       void *__restrict pspriv, const _HZState * __restrict psenc)
+{
+       /* ei may be unused */
+       _DIAGASSERT(pspriv != NULL);
+       _DIAGASSERT(psenc != NULL);
+
+       memcpy(pspriv, (const void *)psenc, sizeof(*psenc));
+}
+
+static __inline void
+/*ARGSUSED*/
+_citrus_HZ_unpack_state(_HZEncodingInfo * __restrict ei,
+       _HZState * __restrict psenc, const void * __restrict pspriv)
+{
+       /* ei may be unused */
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(pspriv != NULL);
+
+       memcpy((void *)psenc, pspriv, sizeof(*psenc));
+}
+
+static int
+_citrus_HZ_mbrtowc_priv(_HZEncodingInfo * __restrict ei,
+       wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
+       _HZState * __restrict psenc, size_t * __restrict nresult)
+{
+       const char *s0;
+       wchar_t wc;
+       int bit, head, tail, len, ch;
+       graphic_t *graphic;
+       escape_t *candidate, *init;
+       const range_t *range;
+
+       _DIAGASSERT(ei != NULL);
+       /* pwc may be null */
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(nresult != NULL);
+
+       if (*s == NULL) {
+               _citrus_HZ_init_state(ei, psenc);
+               *nresult = 1;
+               return 0;
+       }
+       s0 = *s;
+       if (psenc->chlen < 0 || psenc->inuse == NULL)
+               return EINVAL;
+
+       wc = (wchar_t)0;
+       bit = head = tail = 0;
+       graphic = NULL;
+       for (len = 0; len <= MB_LEN_MAX; /**/) {
+               if (psenc->chlen == tail) {
+                       if (n-- < 1) {
+                               *s = s0;
+                               *nresult = (size_t)-2;
+                               return 0;
+                       }
+                       psenc->ch[psenc->chlen++] = *s0++;
+                       ++len;
+               }
+               ch = (unsigned char)psenc->ch[tail++];
+               if (tail == 1) {
+                       if ((ch & ~0x80) <= 0x1F) {
+                               if (psenc->inuse != INIT0(ei))
+                                       break;
+                               wc = (wchar_t)ch;
+                               goto done;
+                       }
+                       if (ch & 0x80) {
+                               graphic = GR(psenc->inuse);
+                               bit = 0x80;
+                               ch &= ~0x80;
+                       } else {
+                               graphic = GL(psenc->inuse);
+                               if (ch == ESCAPE_CHAR)
+                                       continue;
+                               bit = 0x0;
+                       }
+                       if (graphic == NULL)
+                               break;
+               } else if (tail == 2 && psenc->ch[0] == ESCAPE_CHAR) {
+                       if (tail < psenc->chlen)
+                               return EINVAL;
+                       if (ch == ESCAPE_CHAR) {
+                               ++head;
+                       } else if (ch == '\n') {
+                               if (psenc->inuse != INIT0(ei))
+                                       break;
+                               tail = psenc->chlen = 0;
+                               continue;
+                       } else {
+                               candidate = NULL;
+                               init = INIT0(ei);
+                               _DIAGASSERT(init != NULL);
+                               if (psenc->inuse == init) {
+                                       init = INIT1(ei);
+                               } else if (INIT(psenc->inuse) == init) {
+                                       if (ESC(init) != ch)
+                                               break;
+                                       candidate = init;
+                               }
+                               if (candidate == NULL) {
+                                       candidate = find_escape(
+                                           SET(psenc->inuse), ch);
+                                       if (candidate == NULL) {
+                                               if (init == NULL ||
+                                                   ESC(init) != ch)
+                                                       break;
+                                               candidate = init;
+                                       }
+                               }
+                               psenc->inuse = candidate;
+                               tail = psenc->chlen = 0;
+                               continue;
+                       }
+               } else if (ch & 0x80) {
+                       if (graphic != GR(psenc->inuse))
+                               break;
+                       ch &= ~0x80;
+               } else {
+                       if (graphic != GL(psenc->inuse))
+                               break;
+               }
+               _DIAGASSERT(graphic != NULL);
+               range = &ranges[(size_t)graphic->charset];
+               if (range->start > ch || range->end < ch)
+                       break;
+               wc <<= 8;
+               wc |= ch;
+               if (graphic->length == (tail - head)) {
+                       if (graphic->charset > GB2312)
+                               bit |= ESC(psenc->inuse) << 24;
+                       wc |= bit;
+                       goto done;
+               }
+       }
+       *nresult = (size_t)-1;
+       return EILSEQ;
+done:
+       if (tail < psenc->chlen)
+               return EINVAL;
+       *s = s0;
+       if (pwc != NULL)
+               *pwc = wc;
+       psenc->chlen = 0;
+       *nresult = (wc == 0) ? 0 : len;
+
+       return 0;
+}
+
+static int
+_citrus_HZ_wcrtomb_priv(_HZEncodingInfo * __restrict ei,
+       char * __restrict s, size_t n, wchar_t wc,
+       _HZState * __restrict psenc, size_t * __restrict nresult)
+{
+       int bit, ch;
+       escape_t *candidate, *init;
+       graphic_t *graphic;
+       size_t len;
+       const range_t *range;
+
+       _DIAGASSERT(ei != NULL);
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(nresult != NULL);
+
+       if (psenc->chlen != 0 || psenc->inuse == NULL)
+               return EINVAL;
+       if (wc & 0x80) {
+               bit = 0x80;
+               wc &= ~0x80;
+       } else {
+               bit = 0x0;
+       }
+       if ((uint32_t)wc <= 0x1F) {
+               candidate = INIT0(ei);
+               graphic = (bit == 0)
+                   ? candidate->left : candidate->right;
+               if (graphic == NULL)
+                       goto ilseq;
+               range = &ranges[(size_t)CTRL];
+               len = 1;
+       } else if ((uint32_t)wc <= 0x7F) {
+               graphic = ei->ascii;
+               if (graphic == NULL)
+                       goto ilseq;
+               candidate = graphic->escape;
+               range = &ranges[(size_t)graphic->charset];
+               len = graphic->length;
+       } else if ((uint32_t)wc <= 0x7F7F) {
+               graphic = ei->gb2312;
+               if (graphic == NULL)
+                       goto ilseq;
+               candidate = graphic->escape;
+               range = &ranges[(size_t)graphic->charset];
+               len = graphic->length;
+       } else {
+               ch = (wc >> 24) & 0xFF;
+               candidate = find_escape(E0SET(ei), ch);
+               if (candidate == NULL) {
+                       candidate = find_escape(E1SET(ei), ch);
+                       if (candidate == NULL)
+                               goto ilseq;
+               }
+               wc &= ~0xFF000000;
+               graphic = (bit == 0)
+                   ? candidate->left : candidate->right;
+               if (graphic == NULL)
+                       goto ilseq;
+               range = &ranges[(size_t)graphic->charset];
+               len = graphic->length;
+       }
+       if (psenc->inuse != candidate) {
+               init = INIT0(ei);
+               if (SET(psenc->inuse) == SET(candidate)) {
+                       if (INIT(psenc->inuse) != init ||
+                           psenc->inuse == init || candidate == init)
+                               init = NULL;
+               } else if (candidate == (init = INIT(candidate))) {
+                       init = NULL;
+               }
+               if (init != NULL) {
+                       if (n < 2)
+                               return E2BIG;
+                       n -= 2;
+                       psenc->ch[psenc->chlen++] = ESCAPE_CHAR;
+                       psenc->ch[psenc->chlen++] = ESC(init);
+               }
+               if (n < 2)
+                       return E2BIG;
+               n -= 2;
+               psenc->ch[psenc->chlen++] = ESCAPE_CHAR;
+               psenc->ch[psenc->chlen++] = ESC(candidate);
+               psenc->inuse = candidate;
+       }
+       if (n < len)
+               return E2BIG;
+       while (len-- > 0) {
+               ch = (wc >> (len * 8)) & 0xFF;
+               if (range->start > ch || range->end < ch)
+                       goto ilseq;
+               psenc->ch[psenc->chlen++] = ch | bit;
+       }
+       memcpy(s, psenc->ch, psenc->chlen);
+       *nresult = psenc->chlen;
+       psenc->chlen = 0;
+
+       return 0;
+
+ilseq:
+       *nresult = (size_t)-1;
+       return EILSEQ;
+}
+
+static __inline int
+_citrus_HZ_put_state_reset(_HZEncodingInfo * __restrict ei,
+       char * __restrict s, size_t n, _HZState * __restrict psenc,
+       size_t * __restrict nresult)
+{
+       escape_t *candidate;
+
+       _DIAGASSERT(ei != NULL);
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(nresult != NULL);
+
+       if (psenc->chlen != 0 || psenc->inuse == NULL)
+               return EINVAL;
+       candidate = INIT0(ei);
+       if (psenc->inuse != candidate) {
+               if (n < 2)
+                       return E2BIG;
+               n -= 2;
+               psenc->ch[psenc->chlen++] = ESCAPE_CHAR;
+               psenc->ch[psenc->chlen++] = ESC(candidate);
+       }
+       if (n < 1)
+               return E2BIG;
+       if (psenc->chlen > 0)
+               memcpy(s, psenc->ch, psenc->chlen);
+       *nresult = psenc->chlen;
+       _citrus_HZ_init_state(ei, psenc);
+
+       return 0;
+}
+
+static __inline int
+_citrus_HZ_stdenc_get_state_desc_generic(_HZEncodingInfo * __restrict ei,
+       _HZState * __restrict psenc, int * __restrict rstate)
+{
+       _DIAGASSERT(ei != NULL);
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(rstate != NULL);
+
+       if (psenc->chlen < 0 || psenc->inuse == NULL)
+               return EINVAL;
+       *rstate = (psenc->chlen == 0)
+           ? ((psenc->inuse == INIT0(ei))
+               ? _STDENC_SDGEN_INITIAL
+               : _STDENC_SDGEN_STABLE)
+           : ((psenc->ch[0] == ESCAPE_CHAR)
+               ? _STDENC_SDGEN_INCOMPLETE_SHIFT
+               : _STDENC_SDGEN_INCOMPLETE_CHAR);
+
+       return 0;
+}
+
+static __inline int
+/*ARGSUSED*/
+_citrus_HZ_stdenc_wctocs(_HZEncodingInfo * __restrict ei,
+       _csid_t * __restrict csid, _index_t * __restrict idx, wchar_t wc)
+{
+       int bit;
+
+       _DIAGASSERT(csid != NULL);
+       _DIAGASSERT(idx != NULL);
+
+       if (wc & 0x80) {
+               bit = 0x80;
+               wc &= ~0x80;
+       } else {
+               bit = 0x0;
+       }
+       if ((uint32_t)wc <= 0x7F) {
+               *csid = (_csid_t)bit;
+               *idx = (_index_t)wc;
+       } else if ((uint32_t)wc <= 0x7F7F) {
+               *csid = (_csid_t)(bit | 0x8000);
+               *idx = (_index_t)wc;
+       } else {
+               *csid = (_index_t)(wc & ~0x00FFFF7F);
+               *idx = (_csid_t)(wc & 0x00FFFF7F);
+       }
+
+       return 0;
+}
+
+static __inline int
+/*ARGSUSED*/
+_citrus_HZ_stdenc_cstowc(_HZEncodingInfo * __restrict ei,
+       wchar_t * __restrict wc, _csid_t csid, _index_t idx)
+{
+       _DIAGASSERT(ei != NULL);
+       _DIAGASSERT(wc != NULL);
+
+       *wc = (wchar_t)idx;
+       switch (csid) {
+       case 0x80:
+       case 0x8080:
+               *wc |= (wchar_t)0x80;
+       /*FALLTHROUGH*/
+       case 0x0:
+       case 0x8000:
+               break;
+       default:
+               *wc |= (wchar_t)csid;
+       }
+
+       return 0;
+}
+
+static void
+_citrus_HZ_encoding_module_uninit(_HZEncodingInfo *ei)
+{
+       escape_t *escape;
+
+       _DIAGASSERT(ei != NULL);
+       while ((escape = TAILQ_FIRST(E0SET(ei))) != NULL) {
+               TAILQ_REMOVE(E0SET(ei), escape, entry);
+               free(GL(escape));
+               free(GR(escape));
+               free(escape);
+       }
+       while ((escape = TAILQ_FIRST(E1SET(ei))) != NULL) {
+               TAILQ_REMOVE(E1SET(ei), escape, entry);
+               free(GL(escape));
+               free(GR(escape));
+               free(escape);
+       }
+}
+
+static int
+_citrus_HZ_parse_char(void **context, const char *name, const char *s)
+{
+       void **p;
+       escape_t *escape;
+
+       _DIAGASSERT(context != NULL && *context != NULL);
+       _DIAGASSERT(name != NULL);
+       _DIAGASSERT(s != NULL);
+
+       p = (void **)*context;
+       escape = (escape_t *)p[0];
+       if (escape->ch != '\0')
+               return EINVAL;
+       escape->ch = *s++;
+       if (escape->ch == ESCAPE_CHAR || *s != '\0')
+               return EINVAL;
+
+       return 0;
+}
+
+static int
+_citrus_HZ_parse_graphic(void **context, const char *name, const char *s)
+{
+       void **p;
+       _HZEncodingInfo *ei;
+       escape_t *escape;
+       graphic_t *graphic;
+
+       _DIAGASSERT(context != NULL && *context != NULL);
+       _DIAGASSERT(name != NULL);
+       _DIAGASSERT(s != NULL);
+
+       p = (void **)*context;
+       escape = (escape_t *)p[0];
+       ei = (_HZEncodingInfo *)p[1];
+       graphic = malloc(sizeof(*graphic));
+       if (graphic == NULL)
+               return ENOMEM;
+       memset(graphic, 0, sizeof(*graphic));
+       if (strcmp("GL", name) == 0) {
+               if (GL(escape) != NULL)
+                       goto release;
+               GL(escape) = graphic;
+       } else if (strcmp("GR", name) == 0) {
+               if (GR(escape) != NULL)
+                       goto release;
+               GR(escape) = graphic;
+       } else {
+release:
+               free(graphic);
+               return EINVAL;
+       }
+       graphic->escape = escape;
+       if (_bcs_strncasecmp("ASCII", s, 5) == 0) {
+               if (s[5] != '\0')
+                       return EINVAL;
+               graphic->charset = ASCII;
+               graphic->length = 1;
+               ei->ascii = graphic;
+               return 0;
+       } else if (_bcs_strncasecmp("GB2312", s, 6) == 0) {
+               if (s[6] != '\0')
+                       return EINVAL;
+               graphic->charset = GB2312;
+               graphic->length = 2;
+               ei->gb2312 = graphic;
+               return 0;
+       } else if (strncmp("94*", s, 3) == 0) {
+               graphic->charset = CS94;
+       } else if (strncmp("96*", s, 3) == 0) {
+               graphic->charset = CS96;
+       } else {
+               return EINVAL;
+       }
+       s += 3;
+       switch(*s) {
+       case '1': case '2': case '3':
+               graphic->length = (size_t)(*s - '0');
+               if (*++s == '\0')
+                       break;
+       /*FALLTHROUGH*/
+       default:
+               return EINVAL;
+       }
+       return 0;
+}
+
+static const _citrus_prop_hint_t escape_hints[] = {
+_CITRUS_PROP_HINT_STR("CH", &_citrus_HZ_parse_char),
+_CITRUS_PROP_HINT_STR("GL", &_citrus_HZ_parse_graphic),
+_CITRUS_PROP_HINT_STR("GR", &_citrus_HZ_parse_graphic),
+_CITRUS_PROP_HINT_END
+};
+
+static int
+_citrus_HZ_parse_escape(void **context, const char *name, const char *s)
+{
+       _HZEncodingInfo *ei;
+       escape_t *escape;
+       void *p[2];
+
+       _DIAGASSERT(context != NULL);
+       _DIAGASSERT(name != NULL);
+       _DIAGASSERT(s != NULL);
+
+       ei = (_HZEncodingInfo *)*context;
+       escape = malloc(sizeof(*escape));
+       if (escape == NULL)
+               return EINVAL;
+       memset(escape, 0, sizeof(*escape));
+       if (strcmp("0", name) == 0) {
+               escape->set = E0SET(ei);
+               TAILQ_INSERT_TAIL(E0SET(ei), escape, entry);
+       } else if (strcmp("1", name) == 0) {
+               escape->set = E1SET(ei);
+               TAILQ_INSERT_TAIL(E1SET(ei), escape, entry);
+       } else {
+               free(escape);
+               return EINVAL;
+       }
+       p[0] = (void *)escape;
+       p[1] = (void *)ei;
+       return _citrus_prop_parse_variable(
+           escape_hints, (void *)&p[0], s, strlen(s));
+}
+
+static const _citrus_prop_hint_t root_hints[] = {
+_CITRUS_PROP_HINT_STR("0", &_citrus_HZ_parse_escape),
+_CITRUS_PROP_HINT_STR("1", &_citrus_HZ_parse_escape),
+_CITRUS_PROP_HINT_END
+};
+
+static int
+_citrus_HZ_encoding_module_init(_HZEncodingInfo * __restrict ei,
+       const void * __restrict var, size_t lenvar)
+{
+       int errnum;
+
+       _DIAGASSERT(ei != NULL);
+
+       memset(ei, 0, sizeof(*ei));
+       TAILQ_INIT(E0SET(ei));
+       TAILQ_INIT(E1SET(ei));
+       errnum = _citrus_prop_parse_variable(
+           root_hints, (void *)ei, var, lenvar);
+       if (errnum != 0)
+               _citrus_HZ_encoding_module_uninit(ei);
+       return errnum;
+}
+
+/* ----------------------------------------------------------------------
+ * public interface for ctype
+ */
+
+_CITRUS_CTYPE_DECLS(HZ);
+_CITRUS_CTYPE_DEF_OPS(HZ);
+
+#include "citrus_ctype_template.h"
+
+/* ----------------------------------------------------------------------
+ * public interface for stdenc
+ */
+
+_CITRUS_STDENC_DECLS(HZ);
+_CITRUS_STDENC_DEF_OPS(HZ);
+
+#include "citrus_stdenc_template.h"
similarity index 80%
copy from lib/libc/citrus/modules/citrus_utf1632.h
copy to lib/libc/citrus/modules/citrus_hz.h
index 3762ed1..7d85e46 100644 (file)
@@ -1,8 +1,8 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_utf1632.h,v 1.1 2003/06/25 09:51:49 tshiozak Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_utf1632.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_hz.h,v 1.1 2006/11/22 23:38:27 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_hz.h,v 1.1 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
- * Copyright (c)2003 Citrus Project,
+ * Copyright (c)2004, 2006 Citrus Project,
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * SUCH DAMAGE.
  */
 
-#ifndef _CITRUS_UTF1632_H_
-#define _CITRUS_UTF1632_H_
+#ifndef _CITRUS_HZ_H_
+#define _CITRUS_HZ_H_
 
 __BEGIN_DECLS
-_CITRUS_STDENC_GETOPS_FUNC(UTF1632);
+_CITRUS_CTYPE_GETOPS_FUNC(HZ);
+_CITRUS_STDENC_GETOPS_FUNC(HZ);
 __END_DECLS
 
 #endif
index f2e1550..2fbd783 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_iconv_none.c,v 1.2 2003/07/01 09:42:16 tshiozak Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_none.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/modules/citrus_iconv_none.c,v 1.2 2003/07/01 09:42:16 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_none.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 3483823..6d7ebf6 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_iconv_none.h,v 1.1 2003/06/25 09:51:43 tshiozak Exp $       */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_none.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/modules/citrus_iconv_none.h,v 1.1 2003/06/25 09:51:43 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_none.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index b540c2d..43e6c04 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_iconv_std.c,v 1.10 2005/02/11 06:21:21 simonb Exp $ */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_std.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_iconv_std.c,v 1.15 2006/11/13 19:08:19 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_std.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -131,6 +131,20 @@ put_state_resetx(struct _citrus_iconv_std_encoding *se,
        return _stdenc_put_state_reset(se->se_handle, s, n, se->se_ps, nresult);
 }
 
+static __inline int
+get_state_desc_gen(struct _citrus_iconv_std_encoding *se, int *rstate)
+{
+       int ret;
+       struct _stdenc_state_desc ssd;
+
+       ret = _stdenc_get_state_desc(se->se_handle, se->se_ps,
+                                    _STDENC_SDID_GENERIC, &ssd);
+       if (!ret)
+               *rstate = ssd.u.generic.state;
+
+       return ret;
+}
+
 /*
  * init encoding context
  */
@@ -138,7 +152,7 @@ static int
 init_encoding(struct _citrus_iconv_std_encoding *se, struct _stdenc *cs,
              void *ps1, void *ps2)
 {
-       int ret;
+       int ret = -1;
 
        se->se_handle = cs;
        se->se_ps = ps1;
@@ -451,7 +465,7 @@ _citrus_iconv_std_iconv_convert(struct _citrus_iconv * __restrict cv,
        struct _citrus_iconv_std_context *sc = cv->cv_closure;
        _index_t idx;
        _csid_t csid;
-       int ret;
+       int ret, state;
        size_t szrin, szrout;
        size_t inval;
        const char *tmpin;
@@ -488,8 +502,12 @@ _citrus_iconv_std_iconv_convert(struct _citrus_iconv * __restrict cv,
 
        /* normal case */
        for (;;) {
-               if (*inbytes==0)
-                       break;
+               if (*inbytes==0) {
+                       ret = get_state_desc_gen(&sc->sc_src_encoding, &state);
+                       if (state == _STDENC_SDGEN_INITIAL ||
+                           state == _STDENC_SDGEN_STABLE)
+                               break;
+               }
 
                /* save the encoding states for the error recovery */
                save_encoding_state(&sc->sc_src_encoding);
@@ -505,6 +523,17 @@ _citrus_iconv_std_iconv_convert(struct _citrus_iconv * __restrict cv,
 
                if (szrin == (size_t)-2) {
                        /* incompleted character */
+                       ret = get_state_desc_gen(&sc->sc_src_encoding, &state);
+                       if (ret) {
+                               ret = EINVAL;
+                               goto err;
+                       }
+                       switch (state) {
+                       case _STDENC_SDGEN_INITIAL:
+                       case _STDENC_SDGEN_STABLE:
+                               /* fetch shift sequences only. */
+                               goto next;
+                       }
                        ret = EINVAL;
                        goto err;
                }
index 7db4bd6..d0049af 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_iconv_std.h,v 1.1 2003/06/25 09:51:44 tshiozak Exp $        */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_std.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/modules/citrus_iconv_std.h,v 1.1 2003/06/25 09:51:44 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_std.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index e86ea9e..08af43b 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_iconv_std_local.h,v 1.2 2003/07/01 09:42:16 tshiozak Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_std_local.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/modules/citrus_iconv_std_local.h,v 1.2 2003/07/01 09:42:16 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_iconv_std_local.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2003 Citrus Project,
index 0bf2438..6416c8a 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_iso2022.c,v 1.13 2005/02/10 19:03:51 tnozaki Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_iso2022.c,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: citrus_iso2022.c,v 1.18 2007/11/21 14:19:32 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_iso2022.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)1999, 2002 Citrus Project,
@@ -83,6 +83,9 @@ typedef struct {
        u_char  vers;
 } _ISO2022Charset;
 
+static const _ISO2022Charset ascii    = { CS94, 'B', '\0', '\0' };
+static const _ISO2022Charset iso88591 = { CS96, 'A', '\0', '\0' };
+
 typedef struct {
        _ISO2022Charset g[4];
        /* need 3 bits to hold -1, 0, ..., 3 */
@@ -558,9 +561,9 @@ terminate:
 
 static wchar_t
 _ISO2022_sgetwchar(_ISO2022EncodingInfo * __restrict ei,
-                         const char * __restrict string, size_t n,
-                         const char ** __restrict result,
-                         _ISO2022State * __restrict psenc)
+               const char * __restrict string, size_t n,
+               const char ** __restrict result,
+               _ISO2022State * __restrict psenc)
 {
        wchar_t wchar = 0;
        int cur;
@@ -623,6 +626,8 @@ _ISO2022_sgetwchar(_ISO2022EncodingInfo * __restrict ei,
                                case CS96MULTI:
                                        i = string[sp->csoff] - ',';
                                        break;
+                               default:
+                                       return (_ISO2022INVALID);
                                }
                        }
                        psenc->g[i].type = sp->type;
@@ -849,6 +854,11 @@ _citrus_ISO2022_mbrtowc_priv(_ISO2022EncodingInfo * __restrict ei,
        _DIAGASSERT(psenc != NULL);
        _DIAGASSERT(s != NULL);
 
+       if (*s == NULL) {
+               _citrus_ISO2022_init_state(ei, psenc);
+               *nresult = _ENCODING_IS_STATE_DEPENDENT;
+               return 0;
+       }
        s0 = *s;
        c = 0;
        chlenbak = psenc->chlen;
@@ -875,8 +885,8 @@ _citrus_ISO2022_mbrtowc_priv(_ISO2022EncodingInfo * __restrict ei,
 
                wchar = _ISO2022_sgetwchar(ei, p, psenc->chlen - (p-psenc->ch),
                                           &result, psenc);
+               c += result - p;
                if (wchar != _ISO2022INVALID) {
-                       c += result - p;
                        if (psenc->chlen > c)
                                memmove(psenc->ch, result, psenc->chlen - c);
                        if (psenc->chlen < c)
@@ -886,11 +896,14 @@ _citrus_ISO2022_mbrtowc_priv(_ISO2022EncodingInfo * __restrict ei,
                        goto output;
                }
 
-               c += result - p;
-               p = result;
-
-               if (n == 0)
+               if (n == 0) {
+                       if ((result - p) == psenc->chlen)
+                               /* complete shift sequence. */
+                               psenc->chlen = 0;
                        goto restart;
+               }
+
+               p = result;
        }
 
        /* escape sequence too long? */
@@ -904,11 +917,14 @@ emptybuf:
                s0 = result;
                goto output;
        }
-       if (result > s0 && n > result - s0) {
+       if (result > s0) {
                c += (result - s0);
                n -= (result - s0);
                s0 = result;
-               goto emptybuf;
+               if (n>0)
+                       goto emptybuf;
+               /* complete shift sequence. */
+               goto restart;
        }
        n += c;
        if (n < sizeof(psenc->ch)) {
@@ -1004,9 +1020,11 @@ static int
 _ISO2022_sputwchar(_ISO2022EncodingInfo * __restrict ei, wchar_t wc,
                   char * __restrict string, size_t n,
                   char ** __restrict result,
-                  _ISO2022State * __restrict psenc)
+                  _ISO2022State * __restrict psenc,
+                  size_t * __restrict nresult)
 {
-       int i = 0, len;
+       int i = 0;
+       size_t len;
        _ISO2022Charset cs;
        char *p;
        char tmp[MB_LEN_MAX];
@@ -1017,24 +1035,22 @@ _ISO2022_sputwchar(_ISO2022EncodingInfo * __restrict ei, wchar_t wc,
        _DIAGASSERT(ei != NULL);
        _DIAGASSERT(string != NULL);
        /* result may be NULL */
-       /* state appears to be unused */
-
-       if (iscntl(wc & 0xff)) {
-               /* go back to ASCII on control chars */
-               cs.type = CS94;
-               cs.final = 'B';
-               cs.interm = '\0';
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(nresult != NULL);
+
+       if (isc0(wc & 0xff)) {
+               /* go back to INIT0 or ASCII on control chars */
+               cs = ei->initg[0].final ? ei->initg[0] : ascii;
+       } else if (isc1(wc & 0xff)) {
+               /* go back to INIT1 or ISO-8859-1 on control chars */
+               cs = ei->initg[1].final ? ei->initg[1] : iso88591;
        } else if (!(wc & ~0xff)) {
                if (wc & 0x80) {
                        /* special treatment for ISO-8859-1 */
-                       cs.type = CS96;
-                       cs.final = 'A';
-                       cs.interm = '\0';
+                       cs = iso88591;
                } else {
                        /* special treatment for ASCII */
-                       cs.type = CS94;
-                       cs.final = 'B';
-                       cs.interm = '\0';
+                       cs = ascii;
                }
        } else {
                cs.final = (wc >> 24) & 0x7f;
@@ -1126,7 +1142,7 @@ planeok:
                *p++ = 'O';
                psenc->singlegl = psenc->singlegr = 3;
        } else
-               abort();
+               goto ilseq;
 
 sideok:
        if (psenc->singlegl == target)
@@ -1138,7 +1154,7 @@ sideok:
        else if ((ei->flags & F_8BIT) && psenc->gr == target)
                mask = 0x80;
        else
-               abort();
+               goto ilseq;
 
        switch (cs.type) {
        case CS94:
@@ -1147,7 +1163,8 @@ sideok:
                break;
        case CS94MULTI:
        case CS96MULTI:
-               i = isthree(cs.final) ? 3 : 2;
+               i = !iscntl(wc & 0xff) ?
+                   (isthree(cs.final) ? 3 : 2) : 1;
                break;
        }
        while (i-- > 0)
@@ -1156,16 +1173,23 @@ sideok:
        /* reset single shift state */
        psenc->singlegl = psenc->singlegr = -1;
 
-       len = p - tmp;
+       len = (size_t)(p - tmp);
        if (n < len) {
                if (result)
                        *result = (char *)0;
-       } else {
-               if (result)
-                       *result = string + len;
-               memcpy(string, tmp, len);
+               *nresult = (size_t)-1;
+               return E2BIG;
        }
-       return len;
+       if (result)
+               *result = string + len;
+       memcpy(string, tmp, len);
+       *nresult = len;
+
+       return 0;
+
+ilseq:
+       *nresult = (size_t)-1;
+       return EILSEQ;
 }
 
 static int
@@ -1176,32 +1200,30 @@ _citrus_ISO2022_put_state_reset(_ISO2022EncodingInfo * __restrict ei,
 {
        char buf[MB_LEN_MAX];
        char *result;
-       int len, ret;
+       int ret;
+       size_t len;
 
        _DIAGASSERT(ei != NULL);
        _DIAGASSERT(nresult != 0);
        _DIAGASSERT(s != NULL);
 
        /* XXX state will be modified after this operation... */
-       len = _ISO2022_sputwchar(ei, L'\0', buf, sizeof(buf), &result, psenc);
-       if (len==0) {
-               ret = EINVAL;
-               goto err;
+       ret = _ISO2022_sputwchar(ei, L'\0', buf, sizeof(buf), &result, psenc,
+           &len);
+       if (ret) {
+               *nresult = len;
+               return ret;
        }
+
        if (sizeof(buf) < len || n < len-1) {
                /* XXX should recover state? */
-               ret = E2BIG;
-               goto err;
+               *nresult = (size_t)-1;
+               return E2BIG;
        }
 
        memcpy(s, buf, len-1);
-       *nresult = (size_t)(len-1);
+       *nresult = len-1;
        return (0);
-
-err:
-       /* bound check failure */
-       *nresult = (size_t)-1;
-       return ret;
 }
 
 static int
@@ -1212,28 +1234,31 @@ _citrus_ISO2022_wcrtomb_priv(_ISO2022EncodingInfo * __restrict ei,
 {
        char buf[MB_LEN_MAX];
        char *result;
-       int len, ret;
+       int ret;
+       size_t len;
 
        _DIAGASSERT(ei != NULL);
-       _DIAGASSERT(nresult != 0);
        _DIAGASSERT(s != NULL);
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(nresult != 0);
 
        /* XXX state will be modified after this operation... */
-       len = _ISO2022_sputwchar(ei, wc, buf, sizeof(buf), &result, psenc);
+       ret = _ISO2022_sputwchar(ei, wc, buf, sizeof(buf), &result, psenc,
+           &len);
+       if (ret) {
+               *nresult = len;
+               return ret;
+       }
+
        if (sizeof(buf) < len || n < len) {
                /* XXX should recover state? */
-               ret = E2BIG;
-               goto err;
+               *nresult = (size_t)-1;
+               return E2BIG;
        }
 
        memcpy(s, buf, len);
-       *nresult = (size_t)len;
+       *nresult = len;
        return (0);
-
-err:
-       /* bound check failure */
-       *nresult = (size_t)-1;
-       return ret;
 }
 
 static __inline int
@@ -1280,6 +1305,26 @@ _citrus_ISO2022_stdenc_cstowc(_ISO2022EncodingInfo * __restrict ei,
        return (0);
 }
 
+static __inline int
+/*ARGSUSED*/
+_citrus_ISO2022_stdenc_get_state_desc_generic(_ISO2022EncodingInfo * __restrict ei,
+                                             _ISO2022State * __restrict psenc,
+                                             int * __restrict rstate)
+{
+
+       if (psenc->chlen == 0) {
+               /* XXX: it should distinguish initial and stable. */
+               *rstate = _STDENC_SDGEN_STABLE;
+       } else {
+               if (psenc->ch[0] == '\033')
+                       *rstate = _STDENC_SDGEN_INCOMPLETE_SHIFT;
+               else
+                       *rstate = _STDENC_SDGEN_INCOMPLETE_CHAR;
+       }
+
+       return 0;
+}
+
 /* ----------------------------------------------------------------------
  * public interface for ctype
  */
index 172333a..92a2a92 100644 (file)
@@ -1,5 +1,5 @@
-/*     $NetBSD: src/lib/libc/citrus/modules/citrus_iso2022.h,v 1.2 2003/06/25 09:51:44 tshiozak Exp $  */
-/*     $DragonFly: src/lib/libc/citrus/modules/citrus_iso2022.h,v 1.1 2005/03/11 23:33:53 joerg Exp $ */
+/* $NetBSD: src/lib/libc/citrus/modules/citrus_iso2022.h,v 1.2 2003/06/25 09:51:44 tshiozak Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_iso2022.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */
 
 /*-
  * Copyright (c)2002 Citrus Project,
diff --git a/lib/libc/citrus/modules/citrus_johab.c b/lib/libc/citrus/modules/citrus_johab.c
new file mode 100644 (file)
index 0000000..ddb66f3
--- /dev/null
@@ -0,0 +1,390 @@
+/* $NetBSD: citrus_johab.c,v 1.3 2007/10/23 15:28:25 tnozaki Exp $ */
+/* $DragonFly: src/lib/libc/citrus/modules/citrus_johab.c,v 1.1 2008/04/10 10:21:01 hasso Exp $ */
+
+/*-
+ * Copyright (c)2006 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/types.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <locale.h>
+#include <wchar.h>
+#include <limits.h>
+
+#include "citrus_namespace.h"
+#include "citrus_types.h"
+#include "citrus_bcs.h"
+#include "citrus_module.h"
+#include "citrus_ctype.h"
+#include "citrus_stdenc.h"
+#include "citrus_johab.h"
+
+/* ----------------------------------------------------------------------
+ * private stuffs used by templates
+ */
+
+typedef struct {
+       int chlen;
+       char ch[2];
+} _JOHABState;
+
+typedef struct {
+       int dummy;
+} _JOHABEncodingInfo;
+
+typedef struct {
+       _JOHABEncodingInfo      ei;
+       struct {
+               /* for future multi-locale facility */
+               _JOHABState     s_mblen;
+               _JOHABState     s_mbrlen;
+               _JOHABState     s_mbrtowc;
+               _JOHABState     s_mbtowc;
+               _JOHABState     s_mbsrtowcs;
+               _JOHABState     s_wcrtomb;
+               _JOHABState     s_wcsrtombs;
+               _JOHABState     s_wctomb;
+       } states;
+} _JOHABCTypeInfo;
+
+#define _CEI_TO_EI(_cei_)              (&(_cei_)->ei)
+#define _CEI_TO_STATE(_cei_, _func_)   (_cei_)->states.s_##_func_
+
+#define _FUNCNAME(m)                   _citrus_JOHAB_##m
+#define _ENCODING_INFO                 _JOHABEncodingInfo
+#define _CTYPE_INFO                    _JOHABCTypeInfo
+#define _ENCODING_STATE                        _JOHABState
+#define _ENCODING_MB_CUR_MAX(_ei_)             2
+#define _ENCODING_IS_STATE_DEPENDENT           0
+#define _STATE_NEEDS_EXPLICIT_INIT(_ps_)       0
+
+
+static __inline void
+/*ARGSUSED*/
+_citrus_JOHAB_init_state(_JOHABEncodingInfo * __restrict ei,
+       _JOHABState * __restrict psenc)
+{
+       /* ei may be null */
+       _DIAGASSERT(psenc != NULL);
+
+       psenc->chlen = 0;
+}
+
+static __inline void
+/*ARGSUSED*/
+_citrus_JOHAB_pack_state(_JOHABEncodingInfo * __restrict ei,
+       void * __restrict pspriv,
+       const _JOHABState * __restrict psenc)
+{
+       /* ei may be null */
+       _DIAGASSERT(pspriv != NULL);
+       _DIAGASSERT(psenc != NULL);
+
+       memcpy(pspriv, (const void *)psenc, sizeof(*psenc));
+}
+
+static __inline void
+/*ARGSUSED*/
+_citrus_JOHAB_unpack_state(_JOHABEncodingInfo * __restrict ei,
+       _JOHABState * __restrict psenc,
+       const void * __restrict pspriv)
+{
+       /* ei may be null */
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(pspriv != NULL);
+
+       memcpy((void *)psenc, pspriv, sizeof(*psenc));
+}
+
+static void
+/*ARGSUSED*/
+_citrus_JOHAB_encoding_module_uninit(_JOHABEncodingInfo *ei)
+{
+       /* ei may be null */
+}
+
+static int
+/*ARGSUSED*/
+_citrus_JOHAB_encoding_module_init(_JOHABEncodingInfo * __restrict ei,
+       const void * __restrict var, size_t lenvar)
+{
+       /* ei may be null */
+       return 0;
+}
+
+static __inline int
+ishangul(int l, int t)
+{
+
+       return (l >= 0x84 && l <= 0xD3) &&
+             ((t >= 0x41 && t <= 0x7E) || (t >= 0x81 && t <= 0xFE));
+}
+
+static __inline int
+isuda(int l, int t)
+{
+       return (l == 0xD8) &&
+              ((t >= 0x31 && t <= 0x7E) || (t >= 0x91 && t <= 0xFE));
+}
+
+static __inline int
+ishanja(int l, int t)
+{
+       return ((l >= 0xD9 && l <= 0xDE) || (l >= 0xE0 && l <= 0xF9)) &&
+              ((t >= 0x31 && t <= 0x7E) || (t >= 0x91 && t <= 0xFE));
+}
+
+static int
+/*ARGSUSED*/
+_citrus_JOHAB_mbrtowc_priv(_JOHABEncodingInfo * __restrict ei,
+       wchar_t * __restrict pwc, const char ** __restrict s, size_t n,
+       _JOHABState * __restrict psenc, size_t * __restrict nresult)
+{
+       const char *s0;
+       int l, t;
+
+       /* ei may be unused */
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(nresult != 0);
+
+       if (*s == NULL) {
+               _citrus_JOHAB_init_state(ei, psenc);
+               *nresult = _ENCODING_IS_STATE_DEPENDENT;
+               return 0;
+       } 
+       s0 = *s;
+
+       switch (psenc->chlen) {
+       case 0:
+               if (n-- < 1)
+                       goto restart;
+               l = *s0++ & 0xFF;
+               if (l <= 0x7F) {
+                       if (pwc != NULL)
+                               *pwc = (wchar_t)l;
+                       *nresult = (l == 0) ? 0 : 1;
+                       *s = s0;
+                       return 0;
+               }
+               psenc->ch[psenc->chlen++] = l;
+               break;
+       case 1:
+               l = psenc->ch[0] & 0xFF;
+               break;
+       default:
+               return EINVAL;
+       }
+       if (n-- < 1) {
+restart:
+               *nresult = (size_t)-2;
+               *s = s0;
+               return 0;
+       }
+       t = *s0++ & 0xFF;
+       if (!ishangul(l, t) && !isuda(l, t) && !ishanja(l, t)) {
+               *nresult = (size_t)-1;
+               return EILSEQ;
+       }
+       if (pwc != NULL)
+               *pwc = (wchar_t)(l << 8 | t);
+       *nresult = s0 - *s;
+       *s = s0;
+       psenc->chlen = 0;
+
+       return 0;
+}
+
+static int
+/*ARGSUSED*/
+_citrus_JOHAB_wcrtomb_priv(_JOHABEncodingInfo * __restrict ei,
+       char * __restrict s, size_t n, wchar_t wc,
+       _JOHABState * __restrict psenc, size_t * __restrict nresult)
+{
+       int l, t;
+
+       /* ei may be unused */
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(psenc != NULL);
+       _DIAGASSERT(nresult != NULL);
+
+       if (psenc->chlen != 0)
+               return EINVAL;
+
+       /* XXX assume wchar_t as int */
+       if ((uint32_t)wc <= 0x7F) {
+               if (n < 1)
+                       goto e2big;
+               *s = wc & 0xFF;
+               *nresult = 1;
+       } else if ((uint32_t)wc <= 0xFFFF) {
+               if (n < 2) {
+e2big: