├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── binding.c ├── binding.gyp ├── deps └── libiconv │ └── lib │ ├── aliases.h │ ├── aliases2.h │ ├── aliases_aix.h │ ├── aliases_aix_sysaix.h │ ├── aliases_dos.h │ ├── aliases_extra.h │ ├── aliases_osf1.h │ ├── aliases_osf1_sysosf1.h │ ├── aliases_sysaix.h │ ├── aliases_syshpux.h │ ├── aliases_sysosf1.h │ ├── aliases_syssolaris.h │ ├── armscii_8.h │ ├── ascii.h │ ├── atarist.h │ ├── big5.h │ ├── big5_2003.h │ ├── big5hkscs1999.h │ ├── big5hkscs2001.h │ ├── big5hkscs2004.h │ ├── big5hkscs2008.h │ ├── c99.h │ ├── canonical.h │ ├── canonical_aix.h │ ├── canonical_aix_sysaix.h │ ├── canonical_dos.h │ ├── canonical_extra.h │ ├── canonical_local.h │ ├── canonical_local_sysaix.h │ ├── canonical_local_syshpux.h │ ├── canonical_local_sysosf1.h │ ├── canonical_local_syssolaris.h │ ├── canonical_osf1.h │ ├── canonical_osf1_sysosf1.h │ ├── canonical_sysaix.h │ ├── canonical_syshpux.h │ ├── canonical_sysosf1.h │ ├── canonical_syssolaris.h │ ├── ces_big5.h │ ├── ces_gbk.h │ ├── cjk_variants.h │ ├── cns11643.h │ ├── cns11643_1.h │ ├── cns11643_15.h │ ├── cns11643_2.h │ ├── cns11643_3.h │ ├── cns11643_4.h │ ├── cns11643_4a.h │ ├── cns11643_4b.h │ ├── cns11643_5.h │ ├── cns11643_6.h │ ├── cns11643_7.h │ ├── cns11643_inv.h │ ├── converters.h │ ├── cp1046.h │ ├── cp1124.h │ ├── cp1125.h │ ├── cp1129.h │ ├── cp1131.h │ ├── cp1133.h │ ├── cp1161.h │ ├── cp1162.h │ ├── cp1163.h │ ├── cp1250.h │ ├── cp1251.h │ ├── cp1252.h │ ├── cp1253.h │ ├── cp1254.h │ ├── cp1255.h │ ├── cp1256.h │ ├── cp1257.h │ ├── cp1258.h │ ├── cp437.h │ ├── cp50221_0208_ext.h │ ├── cp50221_0212_ext.h │ ├── cp737.h │ ├── cp775.h │ ├── cp850.h │ ├── cp852.h │ ├── cp853.h │ ├── cp855.h │ ├── cp856.h │ ├── cp857.h │ ├── cp858.h │ ├── cp860.h │ ├── cp861.h │ ├── cp862.h │ ├── cp863.h │ ├── cp864.h │ ├── cp865.h │ ├── cp866.h │ ├── cp869.h │ ├── cp874.h │ ├── cp922.h │ ├── cp932.h │ ├── cp932ext.h │ ├── cp936.h │ ├── cp936ext.h │ ├── cp943.h │ ├── cp949.h │ ├── cp950.h │ ├── cp950ext.h │ ├── dec_hanyu.h │ ├── dec_kanji.h │ ├── encodings.def │ ├── encodings_aix.def │ ├── encodings_dos.def │ ├── encodings_extra.def │ ├── encodings_local.def │ ├── encodings_osf1.def │ ├── euc_cn.h │ ├── euc_jisx0213.h │ ├── euc_jp.h │ ├── euc_kr.h │ ├── euc_tw.h │ ├── flags.h │ ├── flushwc.h │ ├── gb12345.h │ ├── gb12345ext.h │ ├── gb18030.h │ ├── gb18030ext.h │ ├── gb18030uni.h │ ├── gb2312.h │ ├── gbk.h │ ├── gbkext1.h │ ├── gbkext2.h │ ├── gbkext_inv.h │ ├── georgian_academy.h │ ├── georgian_ps.h │ ├── hkscs1999.h │ ├── hkscs2001.h │ ├── hkscs2004.h │ ├── hkscs2008.h │ ├── hp_roman8.h │ ├── hz.h │ ├── iconv.c │ ├── iconv_open1.h │ ├── iconv_open2.h │ ├── iso2022_cn.h │ ├── iso2022_cnext.h │ ├── iso2022_jp.h │ ├── iso2022_jp1.h │ ├── iso2022_jp2.h │ ├── iso2022_jp3.h │ ├── iso2022_jpms.h │ ├── iso2022_kr.h │ ├── iso646_cn.h │ ├── iso646_jp.h │ ├── iso8859_1.h │ ├── iso8859_10.h │ ├── iso8859_11.h │ ├── iso8859_13.h │ ├── iso8859_14.h │ ├── iso8859_15.h │ ├── iso8859_16.h │ ├── iso8859_2.h │ ├── iso8859_3.h │ ├── iso8859_4.h │ ├── iso8859_5.h │ ├── iso8859_6.h │ ├── iso8859_7.h │ ├── iso8859_8.h │ ├── iso8859_9.h │ ├── isoir165.h │ ├── isoir165ext.h │ ├── java.h │ ├── jisx0201.h │ ├── jisx0208.h │ ├── jisx0212.h │ ├── jisx0213.h │ ├── johab.h │ ├── johab_hangul.h │ ├── koi8_r.h │ ├── koi8_ru.h │ ├── koi8_t.h │ ├── koi8_u.h │ ├── ksc5601.h │ ├── loop_unicode.h │ ├── loop_wchar.h │ ├── loops.h │ ├── mac_arabic.h │ ├── mac_centraleurope.h │ ├── mac_croatian.h │ ├── mac_cyrillic.h │ ├── mac_greek.h │ ├── mac_hebrew.h │ ├── mac_iceland.h │ ├── mac_roman.h │ ├── mac_romania.h │ ├── mac_thai.h │ ├── mac_turkish.h │ ├── mac_ukraine.h │ ├── mulelao.h │ ├── nextstep.h │ ├── pt154.h │ ├── riscos1.h │ ├── rk1048.h │ ├── shift_jisx0213.h │ ├── sjis.h │ ├── tcvn.h │ ├── tds565.h │ ├── tis620.h │ ├── translit.h │ ├── ucs2.h │ ├── ucs2be.h │ ├── ucs2internal.h │ ├── ucs2le.h │ ├── ucs2swapped.h │ ├── ucs4.h │ ├── ucs4be.h │ ├── ucs4internal.h │ ├── ucs4le.h │ ├── ucs4swapped.h │ ├── uhc_1.h │ ├── uhc_2.h │ ├── utf16.h │ ├── utf16be.h │ ├── utf16le.h │ ├── utf32.h │ ├── utf32be.h │ ├── utf32le.h │ ├── utf7.h │ ├── utf8.h │ ├── vietcomb.h │ └── viscii.h ├── index.js ├── package.json ├── support ├── config.h ├── iconv.h ├── localcharset.c └── localcharset.h └── test ├── fixtures └── lorem-ipsum.txt ├── run-tests.js ├── test-basic.js ├── test-big-buffer.js ├── test-stream.js ├── test-worker.js └── tmp └── .gitignore /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: node-iconv 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | strategy: 8 | matrix: 9 | os: [macos-latest, ubuntu-18.04, ubuntu-20.04, windows-latest] 10 | node: [12.x, 14.x, 16.x] 11 | runs-on: ${{matrix.os}} 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Node.js ${{matrix.node}} 15 | uses: actions/setup-node@v1 16 | with: 17 | node-version: ${{matrix.node}} 18 | - run: npm install 19 | - run: npm test 20 | env: 21 | CI: true 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.node 2 | *.o 3 | .lock-wscript 4 | .project 5 | /build/ 6 | /node_modules/ 7 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | deps/libiconv/tests -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | node-iconv license 2 | ============================================================================== 3 | Copyright (c) 2013, Ben Noordhuis 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | 17 | 18 | GNU libiconv license 19 | ============================================================================== 20 | Copyright (C) 2000-2009, 2011 Free Software Foundation, Inc. 21 | 22 | This program is free software: you can redistribute it and/or modify 23 | it under the terms of the GNU General Public License as published by 24 | the Free Software Foundation; either version 3 of the License, or 25 | (at your option) any later version. 26 | 27 | This program is distributed in the hope that it will be useful, 28 | but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | GNU General Public License for more details. 31 | 32 | You should have received a copy of the GNU General Public License 33 | along with this program. If not, see . 34 | -------------------------------------------------------------------------------- /binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'variables': { 3 | 'node_iconv_use_system_libiconv%': 0, 4 | }, 5 | 6 | 'targets': [ 7 | { 8 | 'target_name': 'iconv', 9 | 'sources': ['binding.c'], 10 | 'ccflags': ['-Wall', '-Wextra'], 11 | # Have to repeat flags on mac because of gyp's xcode emulation "feature". 12 | 'xcode_settings': { 13 | 'WARNING_CFLAGS': ['-Wall', '-Wextra'], 14 | }, 15 | 'conditions': [ 16 | ['node_iconv_use_system_libiconv==0', { 17 | 'defines': ['ICONV_CONST=const', 'ENABLE_EXTRA=1'], 18 | 'include_dirs': ['support'], 19 | 'sources': [ 20 | 'deps/libiconv/lib/iconv.c', 21 | 'support/localcharset.c', 22 | ], 23 | 'cflags!': ['-W', '-Wall', '-Wextra'], 24 | 'msvs_settings': { 25 | 'VCCLCompilerTool': { 26 | 'DisableSpecificWarnings': [ 27 | '4018', # Signed/unsigned comparison. 28 | '4090', # Const/non-const mismatch. 29 | '4244', # Narrowing cast. 30 | '4267', # Narrowing cast. 31 | '4311', # https://github.com/bnoordhuis/node-iconv/issues/174 32 | ], 33 | }, 34 | }, 35 | 'xcode_settings': { 36 | 'WARNING_CFLAGS!': ['-W', '-Wall', '-Wextra'], 37 | 'WARNING_CFLAGS': [ 38 | '-Wno-parentheses-equality', 39 | '-Wno-static-in-inline', 40 | '-Wno-tautological-compare', 41 | ], 42 | }, 43 | }], 44 | ], 45 | }, 46 | ], 47 | } 48 | -------------------------------------------------------------------------------- /deps/libiconv/lib/aliases2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2003, 2008 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | #ifdef USE_AIX 21 | # if defined _AIX 22 | # include "aliases_aix_sysaix.h" 23 | # else 24 | # include "aliases_aix.h" 25 | # endif 26 | #endif 27 | #ifdef USE_OSF1 28 | # if defined __osf__ 29 | # include "aliases_osf1_sysosf1.h" 30 | # else 31 | # include "aliases_osf1.h" 32 | # endif 33 | #endif 34 | #ifdef USE_DOS 35 | # include "aliases_dos.h" 36 | #endif 37 | #ifdef USE_EXTRA 38 | # include "aliases_extra.h" 39 | #endif 40 | -------------------------------------------------------------------------------- /deps/libiconv/lib/aliases_aix.h: -------------------------------------------------------------------------------- 1 | S(aix_0, "CP856", ei_cp856 ) 2 | S(aix_1, "CP922", ei_cp922 ) 3 | S(aix_2, "CP943", ei_cp943 ) 4 | S(aix_3, "CP1046", ei_cp1046 ) 5 | S(aix_4, "CP1124", ei_cp1124 ) 6 | S(aix_5, "CP1129", ei_cp1129 ) 7 | S(aix_6, "CP1161", ei_cp1161 ) 8 | S(aix_7, "IBM1161", ei_cp1161 ) 9 | S(aix_8, "IBM-1161", ei_cp1161 ) 10 | S(aix_9, "CSIBM1161", ei_cp1161 ) 11 | S(aix_10, "CP1162", ei_cp1162 ) 12 | S(aix_11, "IBM1162", ei_cp1162 ) 13 | S(aix_12, "IBM-1162", ei_cp1162 ) 14 | S(aix_13, "CSIBM1162", ei_cp1162 ) 15 | S(aix_14, "CP1163", ei_cp1163 ) 16 | S(aix_15, "IBM1163", ei_cp1163 ) 17 | S(aix_16, "IBM-1163", ei_cp1163 ) 18 | S(aix_17, "CSIBM1163", ei_cp1163 ) 19 | -------------------------------------------------------------------------------- /deps/libiconv/lib/aliases_aix_sysaix.h: -------------------------------------------------------------------------------- 1 | S(aix_0, "CP856", ei_cp856 ) 2 | S(aix_1, "IBM-856", ei_cp856 ) 3 | S(aix_2, "CP922", ei_cp922 ) 4 | S(aix_3, "IBM-922", ei_cp922 ) 5 | S(aix_4, "CP943", ei_cp943 ) 6 | S(aix_5, "IBM-943", ei_cp943 ) 7 | S(aix_6, "CP1046", ei_cp1046 ) 8 | S(aix_7, "IBM-1046", ei_cp1046 ) 9 | S(aix_8, "CP1124", ei_cp1124 ) 10 | S(aix_9, "IBM-1124", ei_cp1124 ) 11 | S(aix_10, "CP1129", ei_cp1129 ) 12 | S(aix_11, "IBM-1129", ei_cp1129 ) 13 | S(aix_12, "CP1161", ei_cp1161 ) 14 | S(aix_13, "IBM1161", ei_cp1161 ) 15 | S(aix_14, "IBM-1161", ei_cp1161 ) 16 | S(aix_15, "CSIBM1161", ei_cp1161 ) 17 | S(aix_16, "CP1162", ei_cp1162 ) 18 | S(aix_17, "IBM1162", ei_cp1162 ) 19 | S(aix_18, "IBM-1162", ei_cp1162 ) 20 | S(aix_19, "CSIBM1162", ei_cp1162 ) 21 | S(aix_20, "CP1163", ei_cp1163 ) 22 | S(aix_21, "IBM1163", ei_cp1163 ) 23 | S(aix_22, "IBM-1163", ei_cp1163 ) 24 | S(aix_23, "CSIBM1163", ei_cp1163 ) 25 | -------------------------------------------------------------------------------- /deps/libiconv/lib/aliases_dos.h: -------------------------------------------------------------------------------- 1 | S(dos_0, "CP437", ei_cp437 ) 2 | S(dos_1, "IBM437", ei_cp437 ) 3 | S(dos_2, "437", ei_cp437 ) 4 | S(dos_3, "CSPC8CODEPAGE437", ei_cp437 ) 5 | S(dos_4, "CP737", ei_cp737 ) 6 | S(dos_5, "CP775", ei_cp775 ) 7 | S(dos_6, "IBM775", ei_cp775 ) 8 | S(dos_7, "CSPC775BALTIC", ei_cp775 ) 9 | S(dos_8, "CP852", ei_cp852 ) 10 | S(dos_9, "IBM852", ei_cp852 ) 11 | S(dos_10, "852", ei_cp852 ) 12 | S(dos_11, "CSPCP852", ei_cp852 ) 13 | S(dos_12, "CP853", ei_cp853 ) 14 | S(dos_13, "CP855", ei_cp855 ) 15 | S(dos_14, "IBM855", ei_cp855 ) 16 | S(dos_15, "855", ei_cp855 ) 17 | S(dos_16, "CSIBM855", ei_cp855 ) 18 | S(dos_17, "CP857", ei_cp857 ) 19 | S(dos_18, "IBM857", ei_cp857 ) 20 | S(dos_19, "857", ei_cp857 ) 21 | S(dos_20, "CSIBM857", ei_cp857 ) 22 | S(dos_21, "CP858", ei_cp858 ) 23 | S(dos_22, "CP860", ei_cp860 ) 24 | S(dos_23, "IBM860", ei_cp860 ) 25 | S(dos_24, "860", ei_cp860 ) 26 | S(dos_25, "CSIBM860", ei_cp860 ) 27 | S(dos_26, "CP861", ei_cp861 ) 28 | S(dos_27, "IBM861", ei_cp861 ) 29 | S(dos_28, "861", ei_cp861 ) 30 | S(dos_29, "CP-IS", ei_cp861 ) 31 | S(dos_30, "CSIBM861", ei_cp861 ) 32 | S(dos_31, "CP863", ei_cp863 ) 33 | S(dos_32, "IBM863", ei_cp863 ) 34 | S(dos_33, "863", ei_cp863 ) 35 | S(dos_34, "CSIBM863", ei_cp863 ) 36 | S(dos_35, "CP864", ei_cp864 ) 37 | S(dos_36, "IBM864", ei_cp864 ) 38 | S(dos_37, "CSIBM864", ei_cp864 ) 39 | S(dos_38, "CP865", ei_cp865 ) 40 | S(dos_39, "IBM865", ei_cp865 ) 41 | S(dos_40, "865", ei_cp865 ) 42 | S(dos_41, "CSIBM865", ei_cp865 ) 43 | S(dos_42, "CP869", ei_cp869 ) 44 | S(dos_43, "IBM869", ei_cp869 ) 45 | S(dos_44, "869", ei_cp869 ) 46 | S(dos_45, "CP-GR", ei_cp869 ) 47 | S(dos_46, "CSIBM869", ei_cp869 ) 48 | S(dos_47, "CP1125", ei_cp1125 ) 49 | -------------------------------------------------------------------------------- /deps/libiconv/lib/aliases_extra.h: -------------------------------------------------------------------------------- 1 | S(extra_0, "EUC-JISX0213", ei_euc_jisx0213 ) 2 | S(extra_1, "EUC-JIS-2004", ei_euc_jisx0213 ) 3 | S(extra_2, "SHIFT_JISX0213", ei_shift_jisx0213 ) 4 | S(extra_3, "SHIFT_JIS-2004", ei_shift_jisx0213 ) 5 | S(extra_4, "ISO-2022-JP-3", ei_iso2022_jp3 ) 6 | S(extra_5, "ISO-2022-JP-2004", ei_iso2022_jp3 ) 7 | S(extra_6, "BIG5-2003", ei_big5_2003 ) 8 | S(extra_7, "TDS565", ei_tds565 ) 9 | S(extra_8, "ISO-IR-230", ei_tds565 ) 10 | S(extra_9, "ATARIST", ei_atarist ) 11 | S(extra_10, "ATARI", ei_atarist ) 12 | S(extra_11, "RISCOS-LATIN1", ei_riscos1 ) 13 | -------------------------------------------------------------------------------- /deps/libiconv/lib/aliases_osf1.h: -------------------------------------------------------------------------------- 1 | S(osf1_0, "DEC-KANJI", ei_dec_kanji ) 2 | S(osf1_1, "DEC-HANYU", ei_dec_hanyu ) 3 | -------------------------------------------------------------------------------- /deps/libiconv/lib/aliases_osf1_sysosf1.h: -------------------------------------------------------------------------------- 1 | S(osf1_0, "DEC-KANJI", ei_dec_kanji ) 2 | S(osf1_1, "DECKANJI", ei_dec_kanji ) 3 | S(osf1_2, "DEC-HANYU", ei_dec_hanyu ) 4 | S(osf1_3, "DECHANYU", ei_dec_hanyu ) 5 | -------------------------------------------------------------------------------- /deps/libiconv/lib/armscii_8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ARMSCII-8 22 | */ 23 | 24 | static const unsigned short armscii_8_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0xfffd, 0x0587, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, 27 | 0x2014, 0x002e, 0x055d, 0x002c, 0x002d, 0x058a, 0x2026, 0x055c, 28 | /* 0xb0 */ 29 | 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, 30 | 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, 31 | /* 0xc0 */ 32 | 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, 33 | 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, 34 | /* 0xd0 */ 35 | 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, 36 | 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, 37 | /* 0xe0 */ 38 | 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, 39 | 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, 40 | /* 0xf0 */ 41 | 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, 42 | 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x055a, 0xfffd, 43 | }; 44 | 45 | static int 46 | armscii_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0xa0) { 50 | *pwc = (ucs4_t) c; 51 | return 1; 52 | } 53 | else { 54 | unsigned short wc = armscii_8_2uni[c-0xa0]; 55 | if (wc != 0xfffd) { 56 | *pwc = (ucs4_t) wc; 57 | return 1; 58 | } 59 | } 60 | return RET_ILSEQ; 61 | } 62 | 63 | static const unsigned char armscii_8_page00[8] = { 64 | 0xa5, 0xa4, 0x2a, 0x2b, 0xab, 0xac, 0xa9, 0x2f, /* 0x28-0x2f */ 65 | }; 66 | static const unsigned char armscii_8_page00_1[32] = { 67 | 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 68 | 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ 70 | 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 71 | }; 72 | static const unsigned char armscii_8_page05[96] = { 73 | 0x00, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, /* 0x30-0x37 */ 74 | 0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, /* 0x38-0x3f */ 75 | 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, /* 0x40-0x47 */ 76 | 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, /* 0x48-0x4f */ 77 | 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0x00, /* 0x50-0x57 */ 78 | 0x00, 0x00, 0xfe, 0xb0, 0xaf, 0xaa, 0xb1, 0x00, /* 0x58-0x5f */ 79 | 0x00, 0xb3, 0xb5, 0xb7, 0xb9, 0xbb, 0xbd, 0xbf, /* 0x60-0x67 */ 80 | 0xc1, 0xc3, 0xc5, 0xc7, 0xc9, 0xcb, 0xcd, 0xcf, /* 0x68-0x6f */ 81 | 0xd1, 0xd3, 0xd5, 0xd7, 0xd9, 0xdb, 0xdd, 0xdf, /* 0x70-0x77 */ 82 | 0xe1, 0xe3, 0xe5, 0xe7, 0xe9, 0xeb, 0xed, 0xef, /* 0x78-0x7f */ 83 | 0xf1, 0xf3, 0xf5, 0xf7, 0xf9, 0xfb, 0xfd, 0xa2, /* 0x80-0x87 */ 84 | 0x00, 0xa3, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 85 | }; 86 | static const unsigned char armscii_8_page20[24] = { 87 | 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00, /* 0x20-0x27 */ 90 | }; 91 | 92 | static int 93 | armscii_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 94 | { 95 | unsigned char c = 0; 96 | if (wc < 0x0028) { 97 | *r = wc; 98 | return 1; 99 | } 100 | else if (wc >= 0x0028 && wc < 0x0030) 101 | c = armscii_8_page00[wc-0x0028]; 102 | else if (wc >= 0x0030 && wc < 0x00a0) 103 | c = wc; 104 | else if (wc >= 0x00a0 && wc < 0x00c0) 105 | c = armscii_8_page00_1[wc-0x00a0]; 106 | else if (wc >= 0x0530 && wc < 0x0590) 107 | c = armscii_8_page05[wc-0x0530]; 108 | else if (wc >= 0x2010 && wc < 0x2028) 109 | c = armscii_8_page20[wc-0x2010]; 110 | if (c != 0) { 111 | *r = c; 112 | return 1; 113 | } 114 | return RET_ILUNI; 115 | } 116 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ascii.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ASCII 22 | */ 23 | 24 | static int 25 | ascii_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | if (c < 0x80) { 29 | *pwc = (ucs4_t) c; 30 | return 1; 31 | } 32 | return RET_ILSEQ; 33 | } 34 | 35 | static int 36 | ascii_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 37 | { 38 | if (wc < 0x0080) { 39 | *r = wc; 40 | return 1; 41 | } 42 | return RET_ILUNI; 43 | } 44 | -------------------------------------------------------------------------------- /deps/libiconv/lib/c99.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * C99 22 | * This is ASCII with \uXXXX and \UXXXXXXXX escape sequences, denoting Unicode 23 | * characters. See ISO/IEC 9899:1999, section 6.4.3. 24 | * The treatment of control characters in the range U+0080..U+009F is not 25 | * specified; we pass them through unmodified. 26 | */ 27 | 28 | static int 29 | c99_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 30 | { 31 | unsigned char c; 32 | ucs4_t wc; 33 | int i; 34 | 35 | c = s[0]; 36 | if (c < 0xa0) { 37 | if (c != '\\') { 38 | *pwc = c; 39 | return 1; 40 | } 41 | if (n < 2) 42 | return RET_TOOFEW(0); 43 | c = s[1]; 44 | if (c == 'u') { 45 | wc = 0; 46 | for (i = 2; i < 6; i++) { 47 | if (n <= i) 48 | return RET_TOOFEW(0); 49 | c = s[i]; 50 | if (c >= '0' && c <= '9') 51 | c -= '0'; 52 | else if (c >= 'A' && c <= 'Z') 53 | c -= 'A'-10; 54 | else if (c >= 'a' && c <= 'z') 55 | c -= 'a'-10; 56 | else 57 | goto simply_backslash; 58 | wc |= (ucs4_t) c << (4 * (5-i)); 59 | } 60 | if ((wc >= 0x00a0 && !(wc >= 0xd800 && wc < 0xe000)) 61 | || wc == 0x0024 || wc == 0x0040 || wc == 0x0060) { 62 | *pwc = wc; 63 | return 6; 64 | } 65 | } else if (c == 'U') { 66 | wc = 0; 67 | for (i = 2; i < 10; i++) { 68 | if (n <= i) 69 | return RET_TOOFEW(0); 70 | c = s[i]; 71 | if (c >= '0' && c <= '9') 72 | c -= '0'; 73 | else if (c >= 'A' && c <= 'Z') 74 | c -= 'A'-10; 75 | else if (c >= 'a' && c <= 'z') 76 | c -= 'a'-10; 77 | else 78 | goto simply_backslash; 79 | wc |= (ucs4_t) c << (4 * (9-i)); 80 | } 81 | if ((wc >= 0x00a0 && !(wc >= 0xd800 && wc < 0xe000)) 82 | || wc == 0x0024 || wc == 0x0040 || wc == 0x0060) { 83 | *pwc = wc; 84 | return 10; 85 | } 86 | } else 87 | goto simply_backslash; 88 | } 89 | return RET_ILSEQ; 90 | simply_backslash: 91 | *pwc = '\\'; 92 | return 1; 93 | } 94 | 95 | static int 96 | c99_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 97 | { 98 | if (wc < 0xa0) { 99 | *r = wc; 100 | return 1; 101 | } else { 102 | int result; 103 | unsigned char u; 104 | if (wc < 0x10000) { 105 | result = 6; 106 | u = 'u'; 107 | } else { 108 | result = 10; 109 | u = 'U'; 110 | } 111 | if (n >= result) { 112 | int count; 113 | r[0] = '\\'; 114 | r[1] = u; 115 | r += 2; 116 | for (count = result-3; count >= 0; count--) { 117 | unsigned int i = (wc >> (4*count)) & 0x0f; 118 | *r++ = (i < 10 ? '0'+i : 'a'-10+i); 119 | } 120 | return result; 121 | } else 122 | return RET_TOOSMALL; 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_aix.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_0, 2 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_1, 3 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_2, 4 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_3, 5 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_4, 6 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_5, 7 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_6, 8 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_10, 9 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_14, 10 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_aix_sysaix.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_0, 2 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_2, 3 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_4, 4 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_6, 5 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_8, 6 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_10, 7 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_12, 8 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_16, 9 | (int)(long)&((struct stringpool2_t *)0)->stringpool_aix_20, 10 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_dos.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_0, 2 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_4, 3 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_5, 4 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_8, 5 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_12, 6 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_13, 7 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_17, 8 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_21, 9 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_22, 10 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_26, 11 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_31, 12 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_35, 13 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_38, 14 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_42, 15 | (int)(long)&((struct stringpool2_t *)0)->stringpool_dos_47, 16 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_extra.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool2_t *)0)->stringpool_extra_0, 2 | (int)(long)&((struct stringpool2_t *)0)->stringpool_extra_2, 3 | (int)(long)&((struct stringpool2_t *)0)->stringpool_extra_4, 4 | (int)(long)&((struct stringpool2_t *)0)->stringpool_extra_6, 5 | (int)(long)&((struct stringpool2_t *)0)->stringpool_extra_7, 6 | (int)(long)&((struct stringpool2_t *)0)->stringpool_extra_9, 7 | (int)(long)&((struct stringpool2_t *)0)->stringpool_extra_11, 8 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_local.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool_t *)0)->stringpool_str193, 2 | (int)(long)&((struct stringpool_t *)0)->stringpool_str496, 3 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_local_sysaix.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool_t *)0)->stringpool_str15, 2 | (int)(long)&((struct stringpool_t *)0)->stringpool_str484, 3 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_local_syshpux.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool_t *)0)->stringpool_str171, 2 | (int)(long)&((struct stringpool_t *)0)->stringpool_str723, 3 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_local_sysosf1.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool_t *)0)->stringpool_str193, 2 | (int)(long)&((struct stringpool_t *)0)->stringpool_str457, 3 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_local_syssolaris.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool_t *)0)->stringpool_str112, 2 | (int)(long)&((struct stringpool_t *)0)->stringpool_str491, 3 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_osf1.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool2_t *)0)->stringpool_osf1_0, 2 | (int)(long)&((struct stringpool2_t *)0)->stringpool_osf1_1, 3 | -------------------------------------------------------------------------------- /deps/libiconv/lib/canonical_osf1_sysosf1.h: -------------------------------------------------------------------------------- 1 | (int)(long)&((struct stringpool2_t *)0)->stringpool_osf1_0, 2 | (int)(long)&((struct stringpool2_t *)0)->stringpool_osf1_2, 3 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ces_big5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * BIG-5 22 | */ 23 | 24 | static int 25 | ces_big5_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | /* Code set 0 (ASCII) */ 29 | if (c < 0x80) 30 | return ascii_mbtowc(conv,pwc,s,n); 31 | /* Code set 1 (BIG5) */ 32 | if (c >= 0xa1 && c < 0xff) { 33 | if (n < 2) 34 | return RET_TOOFEW(0); 35 | { 36 | unsigned char c2 = s[1]; 37 | if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) 38 | return big5_mbtowc(conv,pwc,s,2); 39 | else 40 | return RET_ILSEQ; 41 | } 42 | } 43 | return RET_ILSEQ; 44 | } 45 | 46 | static int 47 | ces_big5_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 48 | { 49 | unsigned char buf[2]; 50 | int ret; 51 | 52 | /* Code set 0 (ASCII) */ 53 | ret = ascii_wctomb(conv,r,wc,n); 54 | if (ret != RET_ILUNI) 55 | return ret; 56 | 57 | /* Code set 1 (BIG5) */ 58 | ret = big5_wctomb(conv,buf,wc,2); 59 | if (ret != RET_ILUNI) { 60 | if (ret != 2) abort(); 61 | if (n < 2) 62 | return RET_TOOSMALL; 63 | r[0] = buf[0]; 64 | r[1] = buf[1]; 65 | return 2; 66 | } 67 | 68 | return RET_ILUNI; 69 | } 70 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ces_gbk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2005, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * GBK 22 | */ 23 | 24 | static int 25 | ces_gbk_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | 29 | /* Code set 0 (ASCII or GB 1988-89) */ 30 | if (c < 0x80) 31 | return ascii_mbtowc(conv,pwc,s,n); 32 | /* Code set 1 (GBK) */ 33 | if (c >= 0x81 && c < 0xff) { 34 | if (n < 2) 35 | return RET_TOOFEW(0); 36 | return gbk_mbtowc(conv,pwc,s,2); 37 | } 38 | return RET_ILSEQ; 39 | } 40 | 41 | static int 42 | ces_gbk_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 43 | { 44 | unsigned char buf[2]; 45 | int ret; 46 | 47 | /* Code set 0 (ASCII or GB 1988-89) */ 48 | ret = ascii_wctomb(conv,r,wc,n); 49 | if (ret != RET_ILUNI) 50 | return ret; 51 | 52 | /* Code set 1 (GBK) */ 53 | ret = gbk_wctomb(conv,buf,wc,2); 54 | if (ret != RET_ILUNI) { 55 | if (ret != 2) abort(); 56 | if (n < 2) 57 | return RET_TOOSMALL; 58 | r[0] = buf[0]; 59 | r[1] = buf[1]; 60 | return 2; 61 | } 62 | 63 | return RET_ILUNI; 64 | } 65 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cns11643.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CNS 11643-1992 22 | */ 23 | 24 | /* ISO-2022-CN and EUC-TW use CNS 11643-1992 planes 1 to 7. We also 25 | * have a table for the older plane 15. We use a trick to keep the 26 | * Unicode -> CNS 11643 table as small as possible (see cns11643_inv.h). 27 | */ 28 | 29 | #include "cns11643_1.h" 30 | #include "cns11643_2.h" 31 | #include "cns11643_3.h" 32 | #include "cns11643_4.h" 33 | #include "cns11643_5.h" 34 | #include "cns11643_6.h" 35 | #include "cns11643_7.h" 36 | #include "cns11643_15.h" 37 | #include "cns11643_inv.h" 38 | 39 | /* Returns the plane number (1,...,7,15) in r[0], the two bytes in r[1],r[2]. */ 40 | #define cns11643_wctomb cns11643_inv_wctomb 41 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cns11643_4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CNS 11643-1992 plane 4 22 | */ 23 | 24 | /* 25 | * The table has been split into two parts. Each part's entries fit it 16 bits. 26 | * But the combined table would need 17 bits per entry. 27 | */ 28 | #include "cns11643_4a.h" 29 | #include "cns11643_4b.h" 30 | 31 | static int 32 | cns11643_4_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 33 | { 34 | unsigned char c1 = s[0]; 35 | if ((c1 >= 0x21 && c1 <= 0x6e)) { 36 | if (n >= 2) { 37 | unsigned char c2 = s[1]; 38 | if (c2 >= 0x21 && c2 < 0x7f) { 39 | unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); 40 | ucs4_t wc = 0xfffd; 41 | unsigned short swc; 42 | { 43 | if (i < 2914) 44 | swc = cns11643_4a_2uni_page21[i], 45 | wc = cns11643_4a_2uni_upages[swc>>8] | (swc & 0xff); 46 | else if (i < 7298) 47 | swc = cns11643_4b_2uni_page40[i-2914], 48 | wc = cns11643_4b_2uni_upages[swc>>8] | (swc & 0xff); 49 | } 50 | if (wc != 0xfffd) { 51 | *pwc = wc; 52 | return 2; 53 | } 54 | } 55 | return RET_ILSEQ; 56 | } 57 | return RET_TOOFEW(0); 58 | } 59 | return RET_ILSEQ; 60 | } 61 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp1124.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP1124 22 | */ 23 | 24 | static const unsigned short cp1124_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0x0401, 0x0402, 0x0490, 0x0404, 0x0405, 0x0406, 0x0407, 27 | 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, 28 | /* 0xb0 */ 29 | 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 30 | 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 31 | /* 0xc0 */ 32 | 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 33 | 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 34 | /* 0xd0 */ 35 | 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 36 | 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 37 | /* 0xe0 */ 38 | 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 39 | 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 40 | /* 0xf0 */ 41 | 0x2116, 0x0451, 0x0452, 0x0491, 0x0454, 0x0455, 0x0456, 0x0457, 42 | 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, 43 | }; 44 | 45 | static int 46 | cp1124_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0xa0) 50 | *pwc = (ucs4_t) c; 51 | else 52 | *pwc = (ucs4_t) cp1124_2uni[c-0xa0]; 53 | return 1; 54 | } 55 | 56 | static const unsigned char cp1124_page00[16] = { 57 | 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, /* 0xa0-0xa7 */ 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 59 | }; 60 | static const unsigned char cp1124_page04[152] = { 61 | 0x00, 0xa1, 0xa2, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ 62 | 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */ 63 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ 64 | 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ 65 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 66 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 67 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ 68 | 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x38-0x3f */ 69 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ 70 | 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ 71 | 0x00, 0xf1, 0xf2, 0x00, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ 72 | 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */ 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 74 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 75 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 77 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 78 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 79 | 0xa3, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 80 | }; 81 | 82 | static int 83 | cp1124_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 84 | { 85 | unsigned char c = 0; 86 | if (wc < 0x00a0) { 87 | *r = wc; 88 | return 1; 89 | } 90 | else if (wc >= 0x00a0 && wc < 0x00b0) 91 | c = cp1124_page00[wc-0x00a0]; 92 | else if (wc >= 0x0400 && wc < 0x0498) 93 | c = cp1124_page04[wc-0x0400]; 94 | else if (wc == 0x2116) 95 | c = 0xf0; 96 | if (c != 0) { 97 | *r = c; 98 | return 1; 99 | } 100 | return RET_ILUNI; 101 | } 102 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp1133.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * IBM-CP1133 22 | */ 23 | 24 | static const unsigned short cp1133_2uni_1[64] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0x0e81, 0x0e82, 0x0e84, 0x0e87, 0x0e88, 0x0eaa, 0x0e8a, 27 | 0x0e8d, 0x0e94, 0x0e95, 0x0e96, 0x0e97, 0x0e99, 0x0e9a, 0x0e9b, 28 | /* 0xb0 */ 29 | 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, 0x0ea1, 0x0ea2, 0x0ea3, 0x0ea5, 30 | 0x0ea7, 0x0eab, 0x0ead, 0x0eae, 0xfffd, 0xfffd, 0xfffd, 0x0eaf, 31 | /* 0xc0 */ 32 | 0x0eb0, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, 0x0eb8, 33 | 0x0eb9, 0x0ebc, 0x0eb1, 0x0ebb, 0x0ebd, 0xfffd, 0xfffd, 0xfffd, 34 | /* 0xd0 */ 35 | 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0x0ec8, 0x0ec9, 0x0eca, 36 | 0x0ecb, 0x0ecc, 0x0ecd, 0x0ec6, 0xfffd, 0x0edc, 0x0edd, 0x20ad, 37 | }; 38 | static const unsigned short cp1133_2uni_2[16] = { 39 | /* 0xf0 */ 40 | 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, 41 | 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x00a2, 0x00ac, 0x00a6, 0xfffd, 42 | }; 43 | 44 | static int 45 | cp1133_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 46 | { 47 | unsigned char c = *s; 48 | if (c < 0xa0) { 49 | *pwc = (ucs4_t) c; 50 | return 1; 51 | } 52 | else if (c < 0xe0) { 53 | unsigned short wc = cp1133_2uni_1[c-0xa0]; 54 | if (wc != 0xfffd) { 55 | *pwc = (ucs4_t) wc; 56 | return 1; 57 | } 58 | } 59 | else if (c < 0xf0) { 60 | } 61 | else { 62 | unsigned short wc = cp1133_2uni_2[c-0xf0]; 63 | if (wc != 0xfffd) { 64 | *pwc = (ucs4_t) wc; 65 | return 1; 66 | } 67 | } 68 | return RET_ILSEQ; 69 | } 70 | 71 | static const unsigned char cp1133_page00[16] = { 72 | 0xa0, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfe, 0x00, /* 0xa0-0xa7 */ 73 | 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 74 | }; 75 | static const unsigned char cp1133_page0e[96] = { 76 | 0x00, 0xa1, 0xa2, 0x00, 0xa3, 0x00, 0x00, 0xa4, /* 0x80-0x87 */ 77 | 0xa5, 0x00, 0xa7, 0x00, 0x00, 0xa8, 0x00, 0x00, /* 0x88-0x8f */ 78 | 0x00, 0x00, 0x00, 0x00, 0xa9, 0xaa, 0xab, 0xac, /* 0x90-0x97 */ 79 | 0x00, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, /* 0x98-0x9f */ 80 | 0x00, 0xb4, 0xb5, 0xb6, 0x00, 0xb7, 0x00, 0xb8, /* 0xa0-0xa7 */ 81 | 0x00, 0x00, 0xa6, 0xb9, 0x00, 0xba, 0xbb, 0xbf, /* 0xa8-0xaf */ 82 | 0xc0, 0xca, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, /* 0xb0-0xb7 */ 83 | 0xc7, 0xc8, 0x00, 0xcb, 0xc9, 0xcc, 0x00, 0x00, /* 0xb8-0xbf */ 84 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xdb, 0x00, /* 0xc0-0xc7 */ 85 | 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0x00, 0x00, /* 0xc8-0xcf */ 86 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ 87 | 0xf8, 0xf9, 0x00, 0x00, 0xdd, 0xde, 0x00, 0x00, /* 0xd8-0xdf */ 88 | }; 89 | 90 | static int 91 | cp1133_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 92 | { 93 | unsigned char c = 0; 94 | if (wc < 0x00a0) { 95 | *r = wc; 96 | return 1; 97 | } 98 | else if (wc >= 0x00a0 && wc < 0x00b0) 99 | c = cp1133_page00[wc-0x00a0]; 100 | else if (wc >= 0x0e80 && wc < 0x0ee0) 101 | c = cp1133_page0e[wc-0x0e80]; 102 | else if (wc == 0x20ad) 103 | c = 0xdf; 104 | if (c != 0) { 105 | *r = c; 106 | return 1; 107 | } 108 | return RET_ILUNI; 109 | } 110 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp1161.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP1161 22 | */ 23 | 24 | static const unsigned short cp1161_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x0e48, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 27 | 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, 28 | /* 0xb0 */ 29 | 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, 30 | 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, 31 | /* 0xc0 */ 32 | 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, 33 | 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, 34 | /* 0xd0 */ 35 | 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, 36 | 0x0e38, 0x0e39, 0x0e3a, 0x0e49, 0x0e4a, 0x0e4b, 0x20ac, 0x0e3f, 37 | /* 0xe0 */ 38 | 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, 39 | 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, 40 | /* 0xf0 */ 41 | 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 42 | 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x00a2, 0x00ac, 0x00a6, 0x00a0, 43 | }; 44 | 45 | static int 46 | cp1161_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0x80) { 50 | *pwc = (ucs4_t) c; 51 | return 1; 52 | } 53 | else if (c < 0xa0) { 54 | } 55 | else { 56 | *pwc = (ucs4_t) cp1161_2uni[c-0xa0]; 57 | return 1; 58 | } 59 | return RET_ILSEQ; 60 | } 61 | 62 | static const unsigned char cp1161_page00[16] = { 63 | 0xff, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfe, 0x00, /* 0xa0-0xa7 */ 64 | 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 65 | }; 66 | 67 | static int 68 | cp1161_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 69 | { 70 | unsigned char c = 0; 71 | if (wc < 0x0080) { 72 | *r = wc; 73 | return 1; 74 | } 75 | else if (wc >= 0x00a0 && wc < 0x00b0) 76 | c = cp1161_page00[wc-0x00a0]; 77 | else if (wc >= 0x0e48 && wc < 0x0e4c) 78 | c = wc-0x0d60; 79 | else if (wc >= 0x0e00 && wc < 0x0e60) 80 | c = cp874_page0e[wc-0x0e00]; 81 | else if (wc == 0x20ac) 82 | c = 0xde; 83 | if (c != 0) { 84 | *r = c; 85 | return 1; 86 | } 87 | return RET_ILUNI; 88 | } 89 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp1162.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP1162 22 | */ 23 | 24 | static int 25 | cp1162_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | if (c < 0x80) { 29 | *pwc = (ucs4_t) c; 30 | return 1; 31 | } 32 | else { 33 | unsigned short wc = cp874_2uni[c-0x80]; 34 | if (wc != 0xfffd) { 35 | *pwc = (ucs4_t) wc; 36 | return 1; 37 | } 38 | if (c < 0xa0) { 39 | *pwc = (ucs4_t) c; 40 | return 1; 41 | } 42 | } 43 | return RET_ILSEQ; 44 | } 45 | 46 | static int 47 | cp1162_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 48 | { 49 | unsigned char c = 0; 50 | if (wc < 0x0080) { 51 | *r = wc; 52 | return 1; 53 | } 54 | else if (wc >= 0x0080 && wc < 0x00a0 && cp874_2uni[wc-0x0080] == 0xfffd) 55 | c = wc; 56 | else if (wc == 0x00a0) 57 | c = 0xa0; 58 | else if (wc >= 0x0e00 && wc < 0x0e60) 59 | c = cp874_page0e[wc-0x0e00]; 60 | else if (wc >= 0x2010 && wc < 0x2028) 61 | c = cp874_page20[wc-0x2010]; 62 | else if (wc == 0x20ac) 63 | c = 0x80; 64 | if (c != 0) { 65 | *r = c; 66 | return 1; 67 | } 68 | return RET_ILUNI; 69 | } 70 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp1163.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP1163 22 | */ 23 | 24 | static int 25 | cp1163_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | if (c < 0xa0) 29 | *pwc = (ucs4_t) c; 30 | else if (c == 0xa4) 31 | *pwc = 0x20ac; 32 | else 33 | *pwc = (ucs4_t) cp1129_2uni[c-0xa0]; 34 | return 1; 35 | } 36 | 37 | static const unsigned char cp1163_page20[8] = { 38 | 0x00, 0x00, 0x00, 0xfe, 0xa4, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 39 | }; 40 | 41 | static int 42 | cp1163_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 43 | { 44 | unsigned char c = 0; 45 | if (wc < 0x00a0 || (wc < 0x00a8 && wc != 0x00a4) || wc == 0x00d0) { 46 | *r = wc; 47 | return 1; 48 | } 49 | else if (wc >= 0x00a8 && wc < 0x01b8) 50 | c = cp1129_page00[wc-0x00a8]; 51 | else if (wc >= 0x0300 && wc < 0x0328) 52 | c = cp1129_page03[wc-0x0300]; 53 | else if (wc == 0x203e) 54 | c = 0xaf; 55 | else if (wc >= 0x20a8 && wc < 0x20b0) 56 | c = cp1163_page20[wc-0x20a8]; 57 | if (c != 0) { 58 | *r = c; 59 | return 1; 60 | } 61 | return RET_ILUNI; 62 | } 63 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp1252.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP1252 22 | */ 23 | 24 | static const unsigned short cp1252_2uni[32] = { 25 | /* 0x80 */ 26 | 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 27 | 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0xfffd, 0x017d, 0xfffd, 28 | /* 0x90 */ 29 | 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 30 | 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0xfffd, 0x017e, 0x0178, 31 | }; 32 | 33 | static int 34 | cp1252_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 35 | { 36 | unsigned char c = *s; 37 | if (c < 0x80 || c >= 0xa0) { 38 | *pwc = (ucs4_t) c; 39 | return 1; 40 | } 41 | else { 42 | unsigned short wc = cp1252_2uni[c-0x80]; 43 | if (wc != 0xfffd) { 44 | *pwc = (ucs4_t) wc; 45 | return 1; 46 | } 47 | } 48 | return RET_ILSEQ; 49 | } 50 | 51 | static const unsigned char cp1252_page01[72] = { 52 | 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 54 | 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 57 | 0x9f, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x9e, 0x00, /* 0x78-0x7f */ 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 60 | 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 61 | }; 62 | static const unsigned char cp1252_page02[32] = { 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 66 | 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 67 | }; 68 | static const unsigned char cp1252_page20[48] = { 69 | 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 70 | 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 71 | 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 72 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 73 | 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 74 | 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 75 | }; 76 | 77 | static int 78 | cp1252_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 79 | { 80 | unsigned char c = 0; 81 | if (wc < 0x0080) { 82 | *r = wc; 83 | return 1; 84 | } 85 | else if (wc >= 0x00a0 && wc < 0x0100) 86 | c = wc; 87 | else if (wc >= 0x0150 && wc < 0x0198) 88 | c = cp1252_page01[wc-0x0150]; 89 | else if (wc >= 0x02c0 && wc < 0x02e0) 90 | c = cp1252_page02[wc-0x02c0]; 91 | else if (wc >= 0x2010 && wc < 0x2040) 92 | c = cp1252_page20[wc-0x2010]; 93 | else if (wc == 0x20ac) 94 | c = 0x80; 95 | else if (wc == 0x2122) 96 | c = 0x99; 97 | if (c != 0) { 98 | *r = c; 99 | return 1; 100 | } 101 | return RET_ILUNI; 102 | } 103 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp858.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP858 22 | */ 23 | 24 | static int 25 | cp858_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | if (c < 0x80) 29 | *pwc = (ucs4_t) c; 30 | else if (c == 0xd5) 31 | *pwc = 0x20ac; 32 | else 33 | *pwc = (ucs4_t) cp850_2uni[c-0x80]; 34 | return 1; 35 | } 36 | 37 | static int 38 | cp858_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 39 | { 40 | unsigned char c = 0; 41 | if (wc < 0x0080) { 42 | *r = wc; 43 | return 1; 44 | } 45 | else if (wc >= 0x00a0 && wc < 0x0100) 46 | c = cp850_page00[wc-0x00a0]; 47 | else if (wc == 0x0192) 48 | c = 0x9f; 49 | else if (wc == 0x2017) 50 | c = 0xf2; 51 | else if (wc == 0x20ac) 52 | c = 0xd5; 53 | else if (wc >= 0x2500 && wc < 0x25a8) 54 | c = cp850_page25[wc-0x2500]; 55 | if (c != 0) { 56 | *r = c; 57 | return 1; 58 | } 59 | return RET_ILUNI; 60 | } 61 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp874.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP874 22 | */ 23 | 24 | static const unsigned short cp874_2uni[128] = { 25 | /* 0x80 */ 26 | 0x20ac, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2026, 0xfffd, 0xfffd, 27 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 28 | /* 0x90 */ 29 | 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 30 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 31 | /* 0xa0 */ 32 | 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 33 | 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, 34 | /* 0xb0 */ 35 | 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, 36 | 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, 37 | /* 0xc0 */ 38 | 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, 39 | 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, 40 | /* 0xd0 */ 41 | 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, 42 | 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, 43 | /* 0xe0 */ 44 | 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, 45 | 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, 46 | /* 0xf0 */ 47 | 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 48 | 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 49 | }; 50 | 51 | static int 52 | cp874_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 53 | { 54 | unsigned char c = *s; 55 | if (c < 0x80) { 56 | *pwc = (ucs4_t) c; 57 | return 1; 58 | } 59 | else { 60 | unsigned short wc = cp874_2uni[c-0x80]; 61 | if (wc != 0xfffd) { 62 | *pwc = (ucs4_t) wc; 63 | return 1; 64 | } 65 | } 66 | return RET_ILSEQ; 67 | } 68 | 69 | static const unsigned char cp874_page0e[96] = { 70 | 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ 71 | 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */ 72 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ 73 | 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ 74 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 75 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 76 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ 77 | 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x38-0x3f */ 78 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ 79 | 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ 80 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ 81 | 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 82 | }; 83 | static const unsigned char cp874_page20[24] = { 84 | 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 85 | 0x91, 0x92, 0x00, 0x00, 0x93, 0x94, 0x00, 0x00, /* 0x18-0x1f */ 86 | 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 87 | }; 88 | 89 | static int 90 | cp874_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 91 | { 92 | unsigned char c = 0; 93 | if (wc < 0x0080) { 94 | *r = wc; 95 | return 1; 96 | } 97 | else if (wc == 0x00a0) 98 | c = 0xa0; 99 | else if (wc >= 0x0e00 && wc < 0x0e60) 100 | c = cp874_page0e[wc-0x0e00]; 101 | else if (wc >= 0x2010 && wc < 0x2028) 102 | c = cp874_page20[wc-0x2010]; 103 | else if (wc == 0x20ac) 104 | c = 0x80; 105 | if (c != 0) { 106 | *r = c; 107 | return 1; 108 | } 109 | return RET_ILUNI; 110 | } 111 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp922.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP922 22 | */ 23 | 24 | static const unsigned short cp922_2uni_1[16] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 27 | 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x203e, 28 | }; 29 | static const unsigned short cp922_2uni_2[16] = { 30 | /* 0xd0 */ 31 | 0x0160, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 32 | 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x017d, 0x00df, 33 | }; 34 | static const unsigned short cp922_2uni_3[16] = { 35 | /* 0xf0 */ 36 | 0x0161, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 37 | 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x017e, 0x00ff, 38 | }; 39 | 40 | static int 41 | cp922_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 42 | { 43 | unsigned char c = *s; 44 | if (c < 0xa0) 45 | *pwc = (ucs4_t) c; 46 | else if (c < 0xb0) 47 | *pwc = (ucs4_t) cp922_2uni_1[c-0xa0]; 48 | else if (c < 0xd0) 49 | *pwc = (ucs4_t) c; 50 | else if (c < 0xe0) 51 | *pwc = (ucs4_t) cp922_2uni_2[c-0xd0]; 52 | else if (c < 0xf0) 53 | *pwc = (ucs4_t) c; 54 | else 55 | *pwc = (ucs4_t) cp922_2uni_3[c-0xf0]; 56 | return 1; 57 | } 58 | 59 | static const unsigned char cp922_page00[88] = { 60 | 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ 61 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 62 | 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 63 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 64 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 65 | 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 66 | 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ 67 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 68 | 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 69 | 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 70 | 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0xff, /* 0xf8-0xff */ 71 | }; 72 | static const unsigned char cp922_page01[32] = { 73 | 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 74 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 75 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, 0x00, /* 0x78-0x7f */ 77 | }; 78 | 79 | static int 80 | cp922_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 81 | { 82 | unsigned char c = 0; 83 | if (wc < 0x00a8) { 84 | *r = wc; 85 | return 1; 86 | } 87 | else if (wc >= 0x00a8 && wc < 0x0100) 88 | c = cp922_page00[wc-0x00a8]; 89 | else if (wc >= 0x0160 && wc < 0x0180) 90 | c = cp922_page01[wc-0x0160]; 91 | else if (wc == 0x203e) 92 | c = 0xaf; 93 | if (c != 0) { 94 | *r = c; 95 | return 1; 96 | } 97 | return RET_ILUNI; 98 | } 99 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp936.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP936 22 | */ 23 | 24 | /* 25 | * The IANA has CP936 as an alias of GBK. But GBK is an official Chinese 26 | * specification, whereas CP936 is de-facto maintained by Microsoft. And, 27 | * of course, Microsoft modified CP936 since 1999. 28 | * 29 | * The differences from GBK are: 30 | * 31 | * 1. A single character: 32 | * 33 | * code CP936.TXT 34 | * 0x80 0x20AC # EURO SIGN 35 | * 36 | * Some variants of CP936 (in JDK, Windows-2000, ICU) also add: 37 | * 38 | * 2. Private area mappings: 39 | * 40 | * code Unicode 41 | * 0x{A1..A2}{40..7E,80..A0} U+E4C6..U+E585 42 | * 0x{AA..AF,F8..FE}{A1..FE} U+E000..U+E4C5 43 | * 44 | * We add them too because, although there are backward compatibility problems 45 | * when a character from a private area is moved to an official Unicode code 46 | * point, they are useful for some people in practice. 47 | */ 48 | 49 | static int 50 | cp936_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 51 | { 52 | /* Try GBK first. */ 53 | { 54 | int ret = ces_gbk_mbtowc(conv,pwc,s,n); 55 | if (ret != RET_ILSEQ) 56 | return ret; 57 | } 58 | /* Then handle the additional mappings. */ 59 | { 60 | unsigned char c = *s; 61 | if (c == 0x80) { 62 | *pwc = 0x20ac; 63 | return 1; 64 | } 65 | /* User-defined characters */ 66 | if (c >= 0xa1 && c <= 0xa2) { 67 | if (n < 2) 68 | return RET_TOOFEW(0); 69 | { 70 | unsigned char c2 = s[1]; 71 | if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0x80 && c2 < 0xa1)) { 72 | *pwc = 0xe4c6 + 96 * (c - 0xa1) + (c2 - (c2 >= 0x80 ? 0x41 : 0x40)); 73 | return 2; 74 | } 75 | } 76 | } else if ((c >= 0xaa && c < 0xb0) || (c >= 0xf8 && c < 0xff)) { 77 | if (n < 2) 78 | return RET_TOOFEW(0); 79 | { 80 | unsigned char c2 = s[1]; 81 | if (c2 >= 0xa1 && c2 < 0xff) { 82 | *pwc = 0xe000 + 94 * (c - (c >= 0xf8 ? 0xf2 : 0xaa)) + (c2 - 0xa1); 83 | return 2; 84 | } 85 | } 86 | } 87 | } 88 | return RET_ILSEQ; 89 | } 90 | 91 | static int 92 | cp936_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 93 | { 94 | /* Try GBK first. */ 95 | { 96 | int ret = ces_gbk_wctomb(conv,r,wc,n); 97 | if (ret != RET_ILUNI) 98 | return ret; 99 | } 100 | /* Then handle the additional mappings. */ 101 | if (wc >= 0xe000 && wc < 0xe586) { 102 | /* User-defined characters */ 103 | if (n < 2) 104 | return RET_TOOFEW(0); 105 | if (wc < 0xe4c6) { 106 | unsigned int i = wc - 0xe000; 107 | unsigned int c1 = i / 94; 108 | unsigned int c2 = i % 94; 109 | r[0] = c1 + (c1 < 6 ? 0xaa : 0xf2); 110 | r[1] = c2 + 0xa1; 111 | return 2; 112 | } else { 113 | unsigned int i = wc - 0xe4c6; 114 | unsigned int c1 = i / 96; 115 | unsigned int c2 = i % 96; 116 | r[0] = c1 + 0xa1; 117 | r[1] = c2 + (c2 < 0x3f ? 0x40 : 0x41); 118 | return 2; 119 | } 120 | } else if (wc == 0x20ac) { 121 | r[0] = 0x80; 122 | return 1; 123 | } 124 | return RET_ILUNI; 125 | } 126 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp936ext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP936 extensions 22 | */ 23 | 24 | static const unsigned short cp936ext_2uni_pagea6[181-159] = { 25 | /* 0xa6 */ 26 | 0xfe35, 27 | 0xfe36, 0xfe39, 0xfe3a, 0xfe3f, 0xfe40, 0xfe3d, 0xfe3e, 0xfe41, 28 | 0xfe42, 0xfe43, 0xfe44, 0xfffd, 0xfffd, 0xfe3b, 0xfe3c, 0xfe37, 29 | 0xfe38, 0xfe31, 0xfffd, 0xfe33, 0xfe34, 30 | }; 31 | static const unsigned short cp936ext_2uni_pagea8[128-122] = { 32 | /* 0xa8 */ 33 | 0x0251, 0xfffd, 0x0144, 0x0148, 0xfffd, 0x0261, 34 | }; 35 | 36 | static int 37 | cp936ext_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 38 | { 39 | unsigned char c1 = s[0]; 40 | if ((c1 == 0xa6) || (c1 == 0xa8)) { 41 | if (n >= 2) { 42 | unsigned char c2 = s[1]; 43 | if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0x80 && c2 < 0xff)) { 44 | unsigned int i = 190 * (c1 - 0x81) + (c2 - (c2 >= 0x80 ? 0x41 : 0x40)); 45 | unsigned short wc = 0xfffd; 46 | if (i < 7410) { 47 | if (i >= 7189 && i < 7211) 48 | wc = cp936ext_2uni_pagea6[i-7189]; 49 | } else { 50 | if (i >= 7532 && i < 7538) 51 | wc = cp936ext_2uni_pagea8[i-7532]; 52 | } 53 | if (wc != 0xfffd) { 54 | *pwc = (ucs4_t) wc; 55 | return 2; 56 | } 57 | } 58 | return RET_ILSEQ; 59 | } 60 | return RET_TOOFEW(0); 61 | } 62 | return RET_ILSEQ; 63 | } 64 | 65 | static const unsigned short cp936ext_page01[16] = { 66 | 0x0000, 0x0000, 0x0000, 0x0000, 0xa8bd, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ 67 | 0xa8be, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ 68 | }; 69 | static const unsigned short cp936ext_page02[24] = { 70 | 0x0000, 0xa8bb, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ 71 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ 72 | 0x0000, 0xa8c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/ 73 | }; 74 | static const unsigned short cp936ext_pagefe[24] = { 75 | 0x0000, 0xa6f2, 0x0000, 0xa6f4, 0xa6f5, 0xa6e0, 0xa6e1, 0xa6f0, /*0x30-0x37*/ 76 | 0xa6f1, 0xa6e2, 0xa6e3, 0xa6ee, 0xa6ef, 0xa6e6, 0xa6e7, 0xa6e4, /*0x38-0x3f*/ 77 | 0xa6e5, 0xa6e8, 0xa6e9, 0xa6ea, 0xa6eb, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ 78 | }; 79 | 80 | static int 81 | cp936ext_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 82 | { 83 | if (n >= 2) { 84 | unsigned short c = 0; 85 | if (wc >= 0x0140 && wc < 0x0150) 86 | c = cp936ext_page01[wc-0x0140]; 87 | else if (wc >= 0x0250 && wc < 0x0268) 88 | c = cp936ext_page02[wc-0x0250]; 89 | else if (wc >= 0xfe30 && wc < 0xfe48) 90 | c = cp936ext_pagefe[wc-0xfe30]; 91 | if (c != 0) { 92 | r[0] = (c >> 8); r[1] = (c & 0xff); 93 | return 2; 94 | } 95 | return RET_ILUNI; 96 | } 97 | return RET_TOOSMALL; 98 | } 99 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp943.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * IBM CP943 22 | */ 23 | 24 | /* This is essentially CP932, with many mappings missing in the AIX conversion 25 | table. We just pretend it were the same as CP932. */ 26 | 27 | #define cp943_mbtowc cp932_mbtowc 28 | #define cp943_wctomb cp932_wctomb 29 | -------------------------------------------------------------------------------- /deps/libiconv/lib/cp949.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2005, 2007, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * CP949 is EUC-KR, extended with UHC (Unified Hangul Code). 22 | * 23 | * Some variants of CP949 (in JDK, Windows-2000, ICU) also add: 24 | * 25 | * 2. Private area mappings: 26 | * 27 | * code Unicode 28 | * 0xC9{A1..FE} U+E000..U+E05D 29 | * 0xFE{A1..FE} U+E05E..U+E0BB 30 | * 31 | * We add them too because, although there are backward compatibility problems 32 | * when a character from a private area is moved to an official Unicode code 33 | * point, they are useful for some people in practice. 34 | */ 35 | 36 | #include "uhc_1.h" 37 | #include "uhc_2.h" 38 | 39 | static int 40 | cp949_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 41 | { 42 | unsigned char c = *s; 43 | /* Code set 0 (ASCII) */ 44 | if (c < 0x80) 45 | return ascii_mbtowc(conv,pwc,s,n); 46 | /* UHC part 1 */ 47 | if (c >= 0x81 && c <= 0xa0) 48 | return uhc_1_mbtowc(conv,pwc,s,n); 49 | if (c >= 0xa1 && c < 0xff) { 50 | if (n < 2) 51 | return RET_TOOFEW(0); 52 | { 53 | unsigned char c2 = s[1]; 54 | if (c2 < 0xa1) 55 | /* UHC part 2 */ 56 | return uhc_2_mbtowc(conv,pwc,s,n); 57 | else if (c2 < 0xff && !(c == 0xa2 && c2 == 0xe8)) { 58 | /* Code set 1 (KS C 5601-1992, now KS X 1001:1998) */ 59 | unsigned char buf[2]; 60 | int ret; 61 | buf[0] = c-0x80; buf[1] = c2-0x80; 62 | ret = ksc5601_mbtowc(conv,pwc,buf,2); 63 | if (ret != RET_ILSEQ) 64 | return ret; 65 | /* User-defined characters */ 66 | if (c == 0xc9) { 67 | *pwc = 0xe000 + (c2 - 0xa1); 68 | return 2; 69 | } 70 | if (c == 0xfe) { 71 | *pwc = 0xe05e + (c2 - 0xa1); 72 | return 2; 73 | } 74 | } 75 | } 76 | } 77 | return RET_ILSEQ; 78 | } 79 | 80 | static int 81 | cp949_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 82 | { 83 | unsigned char buf[2]; 84 | int ret; 85 | 86 | /* Code set 0 (ASCII) */ 87 | ret = ascii_wctomb(conv,r,wc,n); 88 | if (ret != RET_ILUNI) 89 | return ret; 90 | 91 | /* Code set 1 (KS C 5601-1992, now KS X 1001:1998) */ 92 | if (wc != 0x327e) { 93 | ret = ksc5601_wctomb(conv,buf,wc,2); 94 | if (ret != RET_ILUNI) { 95 | if (ret != 2) abort(); 96 | if (n < 2) 97 | return RET_TOOSMALL; 98 | r[0] = buf[0]+0x80; 99 | r[1] = buf[1]+0x80; 100 | return 2; 101 | } 102 | } 103 | 104 | /* UHC */ 105 | if (wc >= 0xac00 && wc < 0xd7a4) { 106 | if (wc < 0xc8a5) 107 | return uhc_1_wctomb(conv,r,wc,n); 108 | else 109 | return uhc_2_wctomb(conv,r,wc,n); 110 | } 111 | 112 | /* User-defined characters */ 113 | if (wc >= 0xe000 && wc < 0xe0bc) { 114 | if (n < 2) 115 | return RET_TOOSMALL; 116 | if (wc < 0xe05e) { 117 | r[0] = 0xc9; 118 | r[1] = wc - 0xe000 + 0xa1; 119 | } else { 120 | r[0] = 0xfe; 121 | r[1] = wc - 0xe05e + 0xa1; 122 | } 123 | return 2; 124 | } 125 | 126 | return RET_ILUNI; 127 | } 128 | -------------------------------------------------------------------------------- /deps/libiconv/lib/dec_hanyu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001, 2005, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * DEC-HANYU 22 | */ 23 | 24 | static int 25 | dec_hanyu_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | /* Code set 0 (ASCII) */ 29 | if (c < 0x80) 30 | return ascii_mbtowc(conv,pwc,s,n); 31 | /* Code set 1 (CNS 11643-1992 Plane 1), 32 | Code set 2 (CNS 11643-1992 Plane 2), 33 | Code set 3 (CNS 11643-1992 Plane 3) */ 34 | if (c >= 0xa1 && c < 0xff) { 35 | if (n < 2) 36 | return RET_TOOFEW(0); 37 | { 38 | unsigned char c2 = s[1]; 39 | if (c == 0xc2 && c2 == 0xcb) { 40 | if (n < 4) 41 | return RET_TOOFEW(0); 42 | if (s[2] >= 0xa1 && s[2] < 0xff && s[3] >= 0xa1 && s[3] < 0xff) { 43 | unsigned char buf[2]; 44 | int ret; 45 | buf[0] = s[2]-0x80; buf[1] = s[3]-0x80; 46 | ret = cns11643_3_mbtowc(conv,pwc,buf,2); 47 | if (ret != RET_ILSEQ) { 48 | if (ret != 2) abort(); 49 | return 4; 50 | } 51 | } 52 | } else if (c2 >= 0xa1 && c2 < 0xff) { 53 | if (c != 0xc2 || c2 < 0xc2) { 54 | unsigned char buf[2]; 55 | buf[0] = c-0x80; buf[1] = c2-0x80; 56 | return cns11643_1_mbtowc(conv,pwc,buf,2); 57 | } 58 | } else if (c2 >= 0x21 && c2 < 0x7f) { 59 | unsigned char buf[2]; 60 | buf[0] = c-0x80; buf[1] = c2; 61 | return cns11643_2_mbtowc(conv,pwc,buf,2); 62 | } 63 | } 64 | } 65 | return RET_ILSEQ; 66 | } 67 | 68 | static int 69 | dec_hanyu_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 70 | { 71 | unsigned char buf[3]; 72 | int ret; 73 | 74 | /* Code set 0 (ASCII) */ 75 | ret = ascii_wctomb(conv,r,wc,n); 76 | if (ret != RET_ILUNI) 77 | return ret; 78 | 79 | ret = cns11643_wctomb(conv,buf,wc,3); 80 | if (ret != RET_ILUNI) { 81 | if (ret != 3) abort(); 82 | 83 | /* Code set 1 (CNS 11643-1992 Plane 1) */ 84 | if (buf[0] == 1 && (buf[1] != 0x42 || buf[2] < 0x42)) { 85 | if (n < 2) 86 | return RET_TOOSMALL; 87 | r[0] = buf[1]+0x80; 88 | r[1] = buf[2]+0x80; 89 | return 2; 90 | } 91 | 92 | /* Code set 2 (CNS 11643-1992 Plane 2) */ 93 | if (buf[0] == 2) { 94 | if (n < 2) 95 | return RET_TOOSMALL; 96 | r[0] = buf[1]+0x80; 97 | r[1] = buf[2]; 98 | return 2; 99 | } 100 | 101 | /* Code set 3 (CNS 11643-1992 Plane 3) */ 102 | if (buf[0] == 3) { 103 | if (n < 4) 104 | return RET_TOOSMALL; 105 | r[0] = 0xc2; 106 | r[1] = 0xcb; 107 | r[2] = buf[1]+0x80; 108 | r[3] = buf[2]+0x80; 109 | return 4; 110 | } 111 | } 112 | 113 | return RET_ILUNI; 114 | } 115 | -------------------------------------------------------------------------------- /deps/libiconv/lib/dec_kanji.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * DEC-KANJI 22 | */ 23 | 24 | static int 25 | dec_kanji_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | /* Code set 0 (ASCII or JIS X 0201-1976 Roman) */ 29 | if (c < 0x80) 30 | return ascii_mbtowc(conv,pwc,s,n); 31 | /* Code set 1 (JIS X 0208) */ 32 | if (c >= 0xa1 && c < 0xf5) { 33 | if (n < 2) 34 | return RET_TOOFEW(0); 35 | { 36 | unsigned char c2 = s[1]; 37 | if (c2 >= 0xa1 && c2 < 0xff) { 38 | unsigned char buf[2]; 39 | buf[0] = c-0x80; buf[1] = c2-0x80; 40 | return jisx0208_mbtowc(conv,pwc,buf,2); 41 | } 42 | } 43 | } 44 | return RET_ILSEQ; 45 | } 46 | 47 | static int 48 | dec_kanji_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 49 | { 50 | unsigned char buf[2]; 51 | int ret; 52 | 53 | /* Code set 0 (ASCII or JIS X 0201-1976 Roman) */ 54 | ret = ascii_wctomb(conv,r,wc,n); 55 | if (ret != RET_ILUNI) 56 | return ret; 57 | 58 | /* Code set 1 (JIS X 0208) */ 59 | ret = jisx0208_wctomb(conv,buf,wc,2); 60 | if (ret != RET_ILUNI) { 61 | if (ret != 2) abort(); 62 | if (n < 2) 63 | return RET_TOOSMALL; 64 | r[0] = buf[0]+0x80; 65 | r[1] = buf[1]+0x80; 66 | return 2; 67 | } 68 | 69 | return RET_ILUNI; 70 | } 71 | -------------------------------------------------------------------------------- /deps/libiconv/lib/encodings_aix.def: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc. 2 | This file is part of the GNU LIBICONV Library. 3 | 4 | The GNU LIBICONV Library is free software; you can redistribute it 5 | and/or modify it under the terms of the GNU Library General Public 6 | License as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | The GNU LIBICONV Library is distributed in the hope that it will be 10 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public 15 | License along with the GNU LIBICONV Library; see the file COPYING.LIB. 16 | If not, see . */ 17 | 18 | /* Encodings used by system dependent locales on AIX. */ 19 | 20 | DEFENCODING(( "CP856", 21 | ), 22 | cp856, 23 | { cp856_mbtowc, NULL }, { cp856_wctomb, NULL }) 24 | #ifdef USE_AIX_ALIASES 25 | DEFALIAS( "IBM-856", /* AIX */ 26 | cp856) 27 | #endif 28 | 29 | DEFENCODING(( "CP922", 30 | ), 31 | cp922, 32 | { cp922_mbtowc, NULL }, { cp922_wctomb, NULL }) 33 | #ifdef USE_AIX_ALIASES 34 | DEFALIAS( "IBM-922", /* AIX */ 35 | cp922) 36 | #endif 37 | 38 | DEFENCODING(( "CP943", 39 | ), 40 | cp943, 41 | { cp943_mbtowc, NULL }, { cp943_wctomb, NULL }) 42 | #ifdef USE_AIX_ALIASES 43 | DEFALIAS( "IBM-943", /* AIX */ 44 | cp943) 45 | #endif 46 | 47 | DEFENCODING(( "CP1046", 48 | ), 49 | cp1046, 50 | { cp1046_mbtowc, NULL }, { cp1046_wctomb, NULL }) 51 | #ifdef USE_AIX_ALIASES 52 | DEFALIAS( "IBM-1046", /* AIX */ 53 | cp1046) 54 | #endif 55 | 56 | DEFENCODING(( "CP1124", 57 | ), 58 | cp1124, 59 | { cp1124_mbtowc, NULL }, { cp1124_wctomb, NULL }) 60 | #ifdef USE_AIX_ALIASES 61 | DEFALIAS( "IBM-1124", /* AIX */ 62 | cp1124) 63 | #endif 64 | 65 | DEFENCODING(( "CP1129", 66 | ), 67 | cp1129, 68 | { cp1129_mbtowc, NULL }, { cp1129_wctomb, NULL }) 69 | #ifdef USE_AIX_ALIASES 70 | DEFALIAS( "IBM-1129", /* AIX */ 71 | cp1129) 72 | #endif 73 | 74 | DEFENCODING(( "CP1161", 75 | "IBM1161", /* glibc */ 76 | "IBM-1161", /* glibc */ 77 | "csIBM1161", /* glibc */ 78 | ), 79 | cp1161, 80 | { cp1161_mbtowc, NULL }, { cp1161_wctomb, NULL }) 81 | 82 | DEFENCODING(( "CP1162", 83 | "IBM1162", /* glibc */ 84 | "IBM-1162", /* glibc */ 85 | "csIBM1162", /* glibc */ 86 | ), 87 | cp1162, 88 | { cp1162_mbtowc, NULL }, { cp1162_wctomb, NULL }) 89 | 90 | DEFENCODING(( "CP1163", 91 | "IBM1163", /* glibc */ 92 | "IBM-1163", /* glibc */ 93 | "csIBM1163", /* glibc */ 94 | ), 95 | cp1163, 96 | { cp1163_mbtowc, NULL }, { cp1163_wctomb, NULL }) 97 | -------------------------------------------------------------------------------- /deps/libiconv/lib/encodings_extra.def: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002, 2005, 2008 Free Software Foundation, Inc. 2 | This file is part of the GNU LIBICONV Library. 3 | 4 | The GNU LIBICONV Library is free software; you can redistribute it 5 | and/or modify it under the terms of the GNU Library General Public 6 | License as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | The GNU LIBICONV Library is distributed in the hope that it will be 10 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public 15 | License along with the GNU LIBICONV Library; see the file COPYING.LIB. 16 | If not, see . */ 17 | 18 | DEFENCODING(( "EUC-JISX0213", 19 | "EUC-JIS-2004", /* x0213.org */ 20 | ), 21 | euc_jisx0213, 22 | { euc_jisx0213_mbtowc, euc_jisx0213_flushwc }, { euc_jisx0213_wctomb, euc_jisx0213_reset }) 23 | 24 | DEFENCODING(( "SHIFT_JISX0213", 25 | "SHIFT_JIS-2004", /* x0213.org */ 26 | ), 27 | shift_jisx0213, 28 | { shift_jisx0213_mbtowc, shift_jisx0213_flushwc }, { shift_jisx0213_wctomb, shift_jisx0213_reset }) 29 | 30 | DEFENCODING(( "ISO-2022-JP-3", 31 | "ISO-2022-JP-2004", /* x0213.org */ 32 | ), 33 | iso2022_jp3, 34 | { iso2022_jp3_mbtowc, iso2022_jp3_flushwc }, { iso2022_jp3_wctomb, iso2022_jp3_reset }) 35 | 36 | DEFENCODING(( "BIG5-2003", 37 | ), 38 | big5_2003, 39 | { big5_2003_mbtowc, NULL }, { big5_2003_wctomb, NULL }) 40 | 41 | DEFENCODING(( "TDS565", 42 | "ISO-IR-230", 43 | ), 44 | tds565, 45 | { tds565_mbtowc, NULL }, { tds565_wctomb, NULL }) 46 | 47 | DEFENCODING(( "ATARIST", 48 | "ATARI", 49 | ), 50 | atarist, 51 | { atarist_mbtowc, NULL }, { atarist_wctomb, NULL }) 52 | 53 | DEFENCODING(( "RISCOS-LATIN1", 54 | ), 55 | riscos1, 56 | { riscos1_mbtowc, NULL }, { riscos1_wctomb, NULL }) 57 | -------------------------------------------------------------------------------- /deps/libiconv/lib/encodings_local.def: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2000-2001 Free Software Foundation, Inc. 2 | This file is part of the GNU LIBICONV Library. 3 | 4 | The GNU LIBICONV Library is free software; you can redistribute it 5 | and/or modify it under the terms of the GNU Library General Public 6 | License as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | The GNU LIBICONV Library is distributed in the hope that it will be 10 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public 15 | License along with the GNU LIBICONV Library; see the file COPYING.LIB. 16 | If not, see . */ 17 | 18 | /* Names for locale dependent encodings. */ 19 | 20 | DEFENCODING(( "CHAR", 21 | ), 22 | local_char, 23 | { NULL, NULL }, { NULL, NULL }) 24 | 25 | DEFENCODING(( "WCHAR_T", /* glibc */ 26 | ), 27 | local_wchar_t, 28 | { NULL, NULL }, { NULL, NULL }) 29 | -------------------------------------------------------------------------------- /deps/libiconv/lib/encodings_osf1.def: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2001, 2008 Free Software Foundation, Inc. 2 | This file is part of the GNU LIBICONV Library. 3 | 4 | The GNU LIBICONV Library is free software; you can redistribute it 5 | and/or modify it under the terms of the GNU Library General Public 6 | License as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | The GNU LIBICONV Library is distributed in the hope that it will be 10 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public 15 | License along with the GNU LIBICONV Library; see the file COPYING.LIB. 16 | If not, see . */ 17 | 18 | /* Encodings used by system dependent locales on OSF/1 a.k.a. Tru64. */ 19 | 20 | DEFENCODING(( "DEC-KANJI", 21 | ), 22 | dec_kanji, 23 | { dec_kanji_mbtowc, NULL }, { dec_kanji_wctomb, NULL }) 24 | #ifdef USE_OSF1_ALIASES 25 | DEFALIAS( "DECKANJI", /* OSF/1 */ 26 | dec_kanji) 27 | #endif 28 | 29 | DEFENCODING(( "DEC-HANYU", 30 | ), 31 | dec_hanyu, 32 | { dec_hanyu_mbtowc, NULL }, { dec_hanyu_wctomb, NULL }) 33 | #ifdef USE_OSF1_ALIASES 34 | DEFALIAS( "DECHANYU", /* OSF/1 */ 35 | dec_hanyu) 36 | #endif 37 | -------------------------------------------------------------------------------- /deps/libiconv/lib/euc_cn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * EUC-CN 22 | */ 23 | 24 | static int 25 | euc_cn_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | /* Code set 0 (ASCII or GB 1988-89) */ 29 | if (c < 0x80) 30 | return ascii_mbtowc(conv,pwc,s,n); 31 | /* Code set 1 (GB 2312-1980) */ 32 | if (c >= 0xa1 && c < 0xff) { 33 | if (n < 2) 34 | return RET_TOOFEW(0); 35 | { 36 | unsigned char c2 = s[1]; 37 | if (c2 >= 0xa1 && c2 < 0xff) { 38 | unsigned char buf[2]; 39 | buf[0] = c-0x80; buf[1] = c2-0x80; 40 | return gb2312_mbtowc(conv,pwc,buf,2); 41 | } else 42 | return RET_ILSEQ; 43 | } 44 | } 45 | return RET_ILSEQ; 46 | } 47 | 48 | static int 49 | euc_cn_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 50 | { 51 | unsigned char buf[2]; 52 | int ret; 53 | 54 | /* Code set 0 (ASCII or GB 1988-89) */ 55 | ret = ascii_wctomb(conv,r,wc,n); 56 | if (ret != RET_ILUNI) 57 | return ret; 58 | 59 | /* Code set 1 (GB 2312-1980) */ 60 | ret = gb2312_wctomb(conv,buf,wc,2); 61 | if (ret != RET_ILUNI) { 62 | if (ret != 2) abort(); 63 | if (n < 2) 64 | return RET_TOOSMALL; 65 | r[0] = buf[0]+0x80; 66 | r[1] = buf[1]+0x80; 67 | return 2; 68 | } 69 | 70 | return RET_ILUNI; 71 | } 72 | -------------------------------------------------------------------------------- /deps/libiconv/lib/euc_kr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2007, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * EUC-KR 22 | */ 23 | 24 | /* Specification: RFC 1557 */ 25 | 26 | static int 27 | euc_kr_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 28 | { 29 | unsigned char c = *s; 30 | /* Code set 0 (ASCII or KS C 5636-1993) */ 31 | if (c < 0x80) 32 | return ascii_mbtowc(conv,pwc,s,n); 33 | /* Code set 1 (KS C 5601-1992, now KS X 1001:2002) */ 34 | if (c >= 0xa1 && c < 0xff) { 35 | if (n < 2) 36 | return RET_TOOFEW(0); 37 | { 38 | unsigned char c2 = s[1]; 39 | if (c2 >= 0xa1 && c2 < 0xff) { 40 | unsigned char buf[2]; 41 | buf[0] = c-0x80; buf[1] = c2-0x80; 42 | return ksc5601_mbtowc(conv,pwc,buf,2); 43 | } else 44 | return RET_ILSEQ; 45 | } 46 | } 47 | return RET_ILSEQ; 48 | } 49 | 50 | static int 51 | euc_kr_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 52 | { 53 | unsigned char buf[2]; 54 | int ret; 55 | 56 | /* Code set 0 (ASCII or KS C 5636-1993) */ 57 | ret = ascii_wctomb(conv,r,wc,n); 58 | if (ret != RET_ILUNI) 59 | return ret; 60 | 61 | /* Code set 1 (KS C 5601-1992, now KS X 1001:2002) */ 62 | ret = ksc5601_wctomb(conv,buf,wc,2); 63 | if (ret != RET_ILUNI) { 64 | if (ret != 2) abort(); 65 | if (n < 2) 66 | return RET_TOOSMALL; 67 | r[0] = buf[0]+0x80; 68 | r[1] = buf[1]+0x80; 69 | return 2; 70 | } 71 | 72 | return RET_ILUNI; 73 | } 74 | -------------------------------------------------------------------------------- /deps/libiconv/lib/euc_tw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * EUC-TW 22 | */ 23 | 24 | static int 25 | euc_tw_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | /* Code set 0 (ASCII) */ 29 | if (c < 0x80) 30 | return ascii_mbtowc(conv,pwc,s,n); 31 | /* Code set 1 (CNS 11643-1992 Plane 1) */ 32 | if (c >= 0xa1 && c < 0xff) { 33 | if (n < 2) 34 | return RET_TOOFEW(0); 35 | { 36 | unsigned char c2 = s[1]; 37 | if (c2 >= 0xa1 && c2 < 0xff) { 38 | unsigned char buf[2]; 39 | buf[0] = c-0x80; buf[1] = c2-0x80; 40 | return cns11643_1_mbtowc(conv,pwc,buf,2); 41 | } else 42 | return RET_ILSEQ; 43 | } 44 | } 45 | /* Code set 2 (CNS 11643-1992 Planes 1-16) */ 46 | if (c == 0x8e) { 47 | if (n < 4) 48 | return RET_TOOFEW(0); 49 | { 50 | unsigned char c2 = s[1]; 51 | if (c2 >= 0xa1 && c2 <= 0xb0) { 52 | unsigned char c3 = s[2]; 53 | unsigned char c4 = s[3]; 54 | if (c3 >= 0xa1 && c3 < 0xff && c4 >= 0xa1 && c4 < 0xff) { 55 | unsigned char buf[2]; 56 | int ret; 57 | buf[0] = c3-0x80; buf[1] = c4-0x80; 58 | switch (c2-0xa0) { 59 | case 1: ret = cns11643_1_mbtowc(conv,pwc,buf,2); break; 60 | case 2: ret = cns11643_2_mbtowc(conv,pwc,buf,2); break; 61 | case 3: ret = cns11643_3_mbtowc(conv,pwc,buf,2); break; 62 | case 4: ret = cns11643_4_mbtowc(conv,pwc,buf,2); break; 63 | case 5: ret = cns11643_5_mbtowc(conv,pwc,buf,2); break; 64 | case 6: ret = cns11643_6_mbtowc(conv,pwc,buf,2); break; 65 | case 7: ret = cns11643_7_mbtowc(conv,pwc,buf,2); break; 66 | case 15: ret = cns11643_15_mbtowc(conv,pwc,buf,2); break; 67 | default: return RET_ILSEQ; 68 | } 69 | if (ret == RET_ILSEQ) 70 | return RET_ILSEQ; 71 | if (ret != 2) abort(); 72 | return 4; 73 | } 74 | } 75 | } 76 | } 77 | return RET_ILSEQ; 78 | } 79 | 80 | static int 81 | euc_tw_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 82 | { 83 | unsigned char buf[3]; 84 | int ret; 85 | 86 | /* Code set 0 (ASCII) */ 87 | ret = ascii_wctomb(conv,r,wc,n); 88 | if (ret != RET_ILUNI) 89 | return ret; 90 | 91 | ret = cns11643_wctomb(conv,buf,wc,3); 92 | if (ret != RET_ILUNI) { 93 | if (ret != 3) abort(); 94 | 95 | /* Code set 1 (CNS 11643-1992 Plane 1) */ 96 | if (buf[0] == 1) { 97 | if (n < 2) 98 | return RET_TOOSMALL; 99 | r[0] = buf[1]+0x80; 100 | r[1] = buf[2]+0x80; 101 | return 2; 102 | } 103 | 104 | /* Code set 2 (CNS 11643-1992 Planes 1-16) */ 105 | if (n < 4) 106 | return RET_TOOSMALL; 107 | r[0] = 0x8e; 108 | r[1] = buf[0]+0xa0; 109 | r[2] = buf[1]+0x80; 110 | r[3] = buf[2]+0x80; 111 | return 4; 112 | } 113 | 114 | return RET_ILUNI; 115 | } 116 | -------------------------------------------------------------------------------- /deps/libiconv/lib/flushwc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2001 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | #ifndef _FLUSHWC_H 21 | #define _FLUSHWC_H 22 | 23 | static int 24 | normal_flushwc (conv_t conv, ucs4_t *pwc) 25 | { 26 | ucs4_t last_wc = conv->istate; 27 | if (last_wc) { 28 | /* Output the buffered character. */ 29 | conv->istate = 0; 30 | *pwc = (ucs4_t) last_wc; 31 | return 1; 32 | } else 33 | return 0; 34 | } 35 | 36 | #endif /* _FLUSHWC_H */ 37 | -------------------------------------------------------------------------------- /deps/libiconv/lib/gb12345.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * GB/T 12345-1990 22 | */ 23 | 24 | /* 25 | * GB/T 12345-1990 is a traditional chinese counterpart of GB 2312-1986. 26 | * According to the unicode.org tables: 27 | * 2146 characters have been changed to their traditional counterpart, 28 | * 103 characters have been added, no characters have been removed. 29 | * Therefore we use an auxiliary table, which contains only the changes. 30 | */ 31 | 32 | #include "gb12345ext.h" 33 | 34 | static int 35 | gb12345_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 36 | { 37 | int ret; 38 | 39 | /* The gb12345ext table overrides some entries in the gb2312 table. */ 40 | /* Try the GB12345 extensions -> Unicode table. */ 41 | ret = gb12345ext_mbtowc(conv,pwc,s,n); 42 | if (ret != RET_ILSEQ) 43 | return ret; 44 | /* Try the GB2312 -> Unicode table. */ 45 | ret = gb2312_mbtowc(conv,pwc,s,n); 46 | return ret; 47 | } 48 | 49 | static int 50 | gb12345_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 51 | { 52 | int ret; 53 | 54 | /* The gb12345ext table overrides some entries in the gb2312 table. */ 55 | /* Try the Unicode -> GB12345 extensions table. */ 56 | ret = gb12345ext_wctomb(conv,r,wc,n); 57 | if (ret != RET_ILUNI) 58 | return ret; 59 | /* Try the Unicode -> GB2312 table, and check that the resulting GB2312 60 | byte sequence is not overridden by the GB12345 extensions table. */ 61 | ret = gb2312_wctomb(conv,r,wc,n); 62 | if (ret == 2 && gb12345ext_mbtowc(conv,&wc,r,2) == 2) 63 | return RET_ILUNI; 64 | else 65 | return ret; 66 | } 67 | -------------------------------------------------------------------------------- /deps/libiconv/lib/georgian_academy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * GEORGIAN-ACADEMY 22 | */ 23 | 24 | static const unsigned short georgian_academy_2uni[32] = { 25 | /* 0x80 */ 26 | 0x0080, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 27 | 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x008e, 0x008f, 28 | /* 0x90 */ 29 | 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 30 | 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x009e, 0x0178, 31 | }; 32 | 33 | static int 34 | georgian_academy_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 35 | { 36 | unsigned char c = *s; 37 | if (c >= 0x80 && c < 0xa0) 38 | *pwc = (ucs4_t) georgian_academy_2uni[c-0x80]; 39 | else if (c >= 0xc0 && c < 0xe7) 40 | *pwc = (ucs4_t) c + 0x1010; 41 | else 42 | *pwc = (ucs4_t) c; 43 | return 1; 44 | } 45 | 46 | static const unsigned char georgian_academy_page00[32] = { 47 | 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ 49 | 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ 51 | }; 52 | static const unsigned char georgian_academy_page01[72] = { 53 | 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 54 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 55 | 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 58 | 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 61 | 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 62 | }; 63 | static const unsigned char georgian_academy_page02[32] = { 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 67 | 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 68 | }; 69 | static const unsigned char georgian_academy_page20[48] = { 70 | 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 71 | 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 72 | 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 74 | 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 75 | 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 76 | }; 77 | 78 | static int 79 | georgian_academy_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 80 | { 81 | unsigned char c = 0; 82 | if (wc < 0x0080) { 83 | *r = wc; 84 | return 1; 85 | } 86 | else if (wc >= 0x0080 && wc < 0x00a0) 87 | c = georgian_academy_page00[wc-0x0080]; 88 | else if ((wc >= 0x00a0 && wc < 0x00c0) || (wc >= 0x00e7 && wc < 0x0100)) 89 | c = wc; 90 | else if (wc >= 0x0150 && wc < 0x0198) 91 | c = georgian_academy_page01[wc-0x0150]; 92 | else if (wc >= 0x02c0 && wc < 0x02e0) 93 | c = georgian_academy_page02[wc-0x02c0]; 94 | else if (wc >= 0x10d0 && wc < 0x10f7) 95 | c = wc-0x1010; 96 | else if (wc >= 0x2010 && wc < 0x2040) 97 | c = georgian_academy_page20[wc-0x2010]; 98 | else if (wc == 0x2122) 99 | c = 0x99; 100 | if (c != 0) { 101 | *r = c; 102 | return 1; 103 | } 104 | return RET_ILUNI; 105 | } 106 | -------------------------------------------------------------------------------- /deps/libiconv/lib/hp_roman8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * HP-ROMAN8 22 | */ 23 | 24 | static const unsigned short hp_roman8_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0x00c0, 0x00c2, 0x00c8, 0x00ca, 0x00cb, 0x00ce, 0x00cf, 27 | 0x00b4, 0x02cb, 0x02c6, 0x00a8, 0x02dc, 0x00d9, 0x00db, 0x20a4, 28 | /* 0xb0 */ 29 | 0x00af, 0x00dd, 0x00fd, 0x00b0, 0x00c7, 0x00e7, 0x00d1, 0x00f1, 30 | 0x00a1, 0x00bf, 0x00a4, 0x00a3, 0x00a5, 0x00a7, 0x0192, 0x00a2, 31 | /* 0xc0 */ 32 | 0x00e2, 0x00ea, 0x00f4, 0x00fb, 0x00e1, 0x00e9, 0x00f3, 0x00fa, 33 | 0x00e0, 0x00e8, 0x00f2, 0x00f9, 0x00e4, 0x00eb, 0x00f6, 0x00fc, 34 | /* 0xd0 */ 35 | 0x00c5, 0x00ee, 0x00d8, 0x00c6, 0x00e5, 0x00ed, 0x00f8, 0x00e6, 36 | 0x00c4, 0x00ec, 0x00d6, 0x00dc, 0x00c9, 0x00ef, 0x00df, 0x00d4, 37 | /* 0xe0 */ 38 | 0x00c1, 0x00c3, 0x00e3, 0x00d0, 0x00f0, 0x00cd, 0x00cc, 0x00d3, 39 | 0x00d2, 0x00d5, 0x00f5, 0x0160, 0x0161, 0x00da, 0x0178, 0x00ff, 40 | /* 0xf0 */ 41 | 0x00de, 0x00fe, 0x00b7, 0x00b5, 0x00b6, 0x00be, 0x2014, 0x00bc, 42 | 0x00bd, 0x00aa, 0x00ba, 0x00ab, 0x25a0, 0x00bb, 0x00b1, 0xfffd, 43 | }; 44 | 45 | static int 46 | hp_roman8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0xa0) { 50 | *pwc = (ucs4_t) c; 51 | return 1; 52 | } 53 | else { 54 | unsigned short wc = hp_roman8_2uni[c-0xa0]; 55 | if (wc != 0xfffd) { 56 | *pwc = (ucs4_t) wc; 57 | return 1; 58 | } 59 | } 60 | return RET_ILSEQ; 61 | } 62 | 63 | static const unsigned char hp_roman8_page00[96] = { 64 | 0xa0, 0xb8, 0xbf, 0xbb, 0xba, 0xbc, 0x00, 0xbd, /* 0xa0-0xa7 */ 65 | 0xab, 0x00, 0xf9, 0xfb, 0x00, 0x00, 0x00, 0xb0, /* 0xa8-0xaf */ 66 | 0xb3, 0xfe, 0x00, 0x00, 0xa8, 0xf3, 0xf4, 0xf2, /* 0xb0-0xb7 */ 67 | 0x00, 0x00, 0xfa, 0xfd, 0xf7, 0xf8, 0xf5, 0xb9, /* 0xb8-0xbf */ 68 | 0xa1, 0xe0, 0xa2, 0xe1, 0xd8, 0xd0, 0xd3, 0xb4, /* 0xc0-0xc7 */ 69 | 0xa3, 0xdc, 0xa4, 0xa5, 0xe6, 0xe5, 0xa6, 0xa7, /* 0xc8-0xcf */ 70 | 0xe3, 0xb6, 0xe8, 0xe7, 0xdf, 0xe9, 0xda, 0x00, /* 0xd0-0xd7 */ 71 | 0xd2, 0xad, 0xed, 0xae, 0xdb, 0xb1, 0xf0, 0xde, /* 0xd8-0xdf */ 72 | 0xc8, 0xc4, 0xc0, 0xe2, 0xcc, 0xd4, 0xd7, 0xb5, /* 0xe0-0xe7 */ 73 | 0xc9, 0xc5, 0xc1, 0xcd, 0xd9, 0xd5, 0xd1, 0xdd, /* 0xe8-0xef */ 74 | 0xe4, 0xb7, 0xca, 0xc6, 0xc2, 0xea, 0xce, 0x00, /* 0xf0-0xf7 */ 75 | 0xd6, 0xcb, 0xc7, 0xc3, 0xcf, 0xb2, 0xf1, 0xef, /* 0xf8-0xff */ 76 | }; 77 | static const unsigned char hp_roman8_page01[56] = { 78 | 0xeb, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 81 | 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 84 | 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 85 | }; 86 | static const unsigned char hp_roman8_page02[32] = { 87 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, /* 0xc0-0xc7 */ 88 | 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 90 | 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 91 | }; 92 | 93 | static int 94 | hp_roman8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 95 | { 96 | unsigned char c = 0; 97 | if (wc < 0x00a0) { 98 | *r = wc; 99 | return 1; 100 | } 101 | else if (wc >= 0x00a0 && wc < 0x0100) 102 | c = hp_roman8_page00[wc-0x00a0]; 103 | else if (wc >= 0x0160 && wc < 0x0198) 104 | c = hp_roman8_page01[wc-0x0160]; 105 | else if (wc >= 0x02c0 && wc < 0x02e0) 106 | c = hp_roman8_page02[wc-0x02c0]; 107 | else if (wc == 0x2014) 108 | c = 0xf6; 109 | else if (wc == 0x20a4) 110 | c = 0xaf; 111 | else if (wc == 0x25a0) 112 | c = 0xfc; 113 | if (c != 0) { 114 | *r = c; 115 | return 1; 116 | } 117 | return RET_ILUNI; 118 | } 119 | -------------------------------------------------------------------------------- /deps/libiconv/lib/hz.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2008, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * HZ 22 | */ 23 | 24 | /* Specification: RFC 1842, RFC 1843 */ 25 | 26 | /* 27 | * The state is 1 in GB mode, 0 in ASCII mode. 28 | */ 29 | 30 | static int 31 | hz_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 32 | { 33 | state_t state = conv->istate; 34 | unsigned int count = 0; 35 | unsigned char c; 36 | for (;;) { 37 | c = *s; 38 | if (c == '~') { 39 | if (n < count+2) 40 | goto none; 41 | c = s[1]; 42 | if (state == 0) { 43 | if (c == '~') { 44 | *pwc = (ucs4_t) '~'; 45 | conv->istate = state; 46 | return count+2; 47 | } 48 | if (c == '{') { 49 | state = 1; 50 | s += 2; count += 2; 51 | if (n < count+1) 52 | goto none; 53 | continue; 54 | } 55 | if (c == '\n') { 56 | s += 2; count += 2; 57 | if (n < count+1) 58 | goto none; 59 | continue; 60 | } 61 | } else { 62 | if (c == '}') { 63 | state = 0; 64 | s += 2; count += 2; 65 | if (n < count+1) 66 | goto none; 67 | continue; 68 | } 69 | } 70 | goto ilseq; 71 | } 72 | break; 73 | } 74 | if (state == 0) { 75 | *pwc = (ucs4_t) c; 76 | conv->istate = state; 77 | return count+1; 78 | } else { 79 | int ret; 80 | if (n < count+2) 81 | goto none; 82 | ret = gb2312_mbtowc(conv,pwc,s,2); 83 | if (ret == RET_ILSEQ) 84 | goto ilseq; 85 | if (ret != 2) abort(); 86 | conv->istate = state; 87 | return count+2; 88 | } 89 | 90 | none: 91 | conv->istate = state; 92 | return RET_TOOFEW(count); 93 | 94 | ilseq: 95 | conv->istate = state; 96 | return RET_SHIFT_ILSEQ(count); 97 | } 98 | 99 | static int 100 | hz_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 101 | { 102 | state_t state = conv->ostate; 103 | unsigned char buf[2]; 104 | int ret; 105 | 106 | /* Code set 0 (ASCII or GB 1988-89) */ 107 | ret = ascii_wctomb(conv,buf,wc,1); 108 | if (ret != RET_ILUNI) { 109 | if (ret != 1) abort(); 110 | if (buf[0] < 0x80) { 111 | int count = (state ? 3 : 1); 112 | if (n < count) 113 | return RET_TOOSMALL; 114 | if (state) { 115 | r[0] = '~'; 116 | r[1] = '}'; 117 | r += 2; 118 | state = 0; 119 | } 120 | r[0] = buf[0]; 121 | conv->ostate = state; 122 | return count; 123 | } 124 | } 125 | 126 | /* Code set 1 (GB 2312-1980) */ 127 | ret = gb2312_wctomb(conv,buf,wc,2); 128 | if (ret != RET_ILUNI) { 129 | if (ret != 2) abort(); 130 | if (buf[0] < 0x80 && buf[1] < 0x80) { 131 | int count = (state ? 2 : 4); 132 | if (n < count) 133 | return RET_TOOSMALL; 134 | if (!state) { 135 | r[0] = '~'; 136 | r[1] = '{'; 137 | r += 2; 138 | state = 1; 139 | } 140 | r[0] = buf[0]; 141 | r[1] = buf[1]; 142 | conv->ostate = state; 143 | return count; 144 | } 145 | } 146 | 147 | return RET_ILUNI; 148 | } 149 | 150 | static int 151 | hz_reset (conv_t conv, unsigned char *r, size_t n) 152 | { 153 | state_t state = conv->ostate; 154 | if (state) { 155 | if (n < 2) 156 | return RET_TOOSMALL; 157 | r[0] = '~'; 158 | r[1] = '}'; 159 | /* conv->ostate = 0; will be done by the caller */ 160 | return 2; 161 | } else 162 | return 0; 163 | } 164 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iconv_open2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2009 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* Part 2 of iconv_open. 21 | Input: 22 | struct conv_struct * cd; 23 | unsigned int from_index; 24 | int from_wchar; 25 | unsigned int to_index; 26 | int to_wchar; 27 | int transliterate; 28 | int discard_ilseq; 29 | Output: none. 30 | Side effects: Fills cd. 31 | */ 32 | 33 | cd->iindex = from_index; 34 | cd->ifuncs = all_encodings[from_index].ifuncs; 35 | cd->oindex = to_index; 36 | cd->ofuncs = all_encodings[to_index].ofuncs; 37 | cd->oflags = all_encodings[to_index].oflags; 38 | /* Initialize the loop functions. */ 39 | #if HAVE_MBRTOWC 40 | if (to_wchar) { 41 | #if HAVE_WCRTOMB 42 | if (from_wchar) { 43 | cd->lfuncs.loop_convert = wchar_id_loop_convert; 44 | cd->lfuncs.loop_reset = wchar_id_loop_reset; 45 | } else 46 | #endif 47 | { 48 | cd->lfuncs.loop_convert = wchar_to_loop_convert; 49 | cd->lfuncs.loop_reset = wchar_to_loop_reset; 50 | } 51 | } else 52 | #endif 53 | { 54 | #if HAVE_WCRTOMB 55 | if (from_wchar) { 56 | cd->lfuncs.loop_convert = wchar_from_loop_convert; 57 | cd->lfuncs.loop_reset = wchar_from_loop_reset; 58 | } else 59 | #endif 60 | { 61 | cd->lfuncs.loop_convert = unicode_loop_convert; 62 | cd->lfuncs.loop_reset = unicode_loop_reset; 63 | } 64 | } 65 | /* Initialize the states. */ 66 | memset(&cd->istate,'\0',sizeof(state_t)); 67 | memset(&cd->ostate,'\0',sizeof(state_t)); 68 | /* Initialize the operation flags. */ 69 | cd->transliterate = transliterate; 70 | cd->discard_ilseq = discard_ilseq; 71 | #ifndef LIBICONV_PLUG 72 | cd->fallbacks.mb_to_uc_fallback = NULL; 73 | cd->fallbacks.uc_to_mb_fallback = NULL; 74 | cd->fallbacks.mb_to_wc_fallback = NULL; 75 | cd->fallbacks.wc_to_mb_fallback = NULL; 76 | cd->fallbacks.data = NULL; 77 | cd->hooks.uc_hook = NULL; 78 | cd->hooks.wc_hook = NULL; 79 | cd->hooks.data = NULL; 80 | #endif 81 | /* Initialize additional fields. */ 82 | if (from_wchar != to_wchar) { 83 | struct wchar_conv_struct * wcd = (struct wchar_conv_struct *) cd; 84 | #if HAVE_WCRTOMB || HAVE_MBRTOWC 85 | memset(&wcd->state,'\0',sizeof(mbstate_t)); 86 | #endif 87 | } 88 | /* Done. */ 89 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso646_cn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO646-CN 22 | * also known as GB_1988-80 23 | */ 24 | 25 | static int 26 | iso646_cn_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 27 | { 28 | unsigned char c = *s; 29 | if (c < 0x80) { 30 | if (c == 0x24) 31 | *pwc = (ucs4_t) 0x00a5; 32 | else if (c == 0x7e) 33 | *pwc = (ucs4_t) 0x203e; 34 | else 35 | *pwc = (ucs4_t) c; 36 | return 1; 37 | } 38 | return RET_ILSEQ; 39 | } 40 | 41 | static int 42 | iso646_cn_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 43 | { 44 | if (wc < 0x0080 && !(wc == 0x0024 || wc == 0x007e)) { 45 | *r = wc; 46 | return 1; 47 | } 48 | if (wc == 0x00a5) { 49 | *r = 0x24; 50 | return 1; 51 | } 52 | if (wc == 0x203e) { 53 | *r = 0x7e; 54 | return 1; 55 | } 56 | return RET_ILUNI; 57 | } 58 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso646_jp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO646-JP 22 | * also known as JIS_C6220-1969-RO 23 | */ 24 | 25 | /* This is the lower half of JIS_X0201. */ 26 | 27 | static int 28 | iso646_jp_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 29 | { 30 | unsigned char c = *s; 31 | if (c < 0x80) { 32 | if (c == 0x5c) 33 | *pwc = (ucs4_t) 0x00a5; 34 | else if (c == 0x7e) 35 | *pwc = (ucs4_t) 0x203e; 36 | else 37 | *pwc = (ucs4_t) c; 38 | return 1; 39 | } 40 | return RET_ILSEQ; 41 | } 42 | 43 | static int 44 | iso646_jp_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 45 | { 46 | if (wc < 0x0080 && !(wc == 0x005c || wc == 0x007e)) { 47 | *r = wc; 48 | return 1; 49 | } 50 | if (wc == 0x00a5) { 51 | *r = 0x5c; 52 | return 1; 53 | } 54 | if (wc == 0x203e) { 55 | *r = 0x7e; 56 | return 1; 57 | } 58 | return RET_ILUNI; 59 | } 60 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso8859_1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO-8859-1 22 | */ 23 | 24 | static int 25 | iso8859_1_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | *pwc = (ucs4_t) c; 29 | return 1; 30 | } 31 | 32 | static int 33 | iso8859_1_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 34 | { 35 | if (wc < 0x0100) { 36 | *r = wc; 37 | return 1; 38 | } 39 | return RET_ILUNI; 40 | } 41 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso8859_10.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO-8859-10 22 | */ 23 | 24 | static const unsigned short iso8859_10_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7, 27 | 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, 28 | /* 0xb0 */ 29 | 0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, 30 | 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b, 31 | /* 0xc0 */ 32 | 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, 33 | 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf, 34 | /* 0xd0 */ 35 | 0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, 36 | 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 37 | /* 0xe0 */ 38 | 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, 39 | 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef, 40 | /* 0xf0 */ 41 | 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, 42 | 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138, 43 | }; 44 | 45 | static int 46 | iso8859_10_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0xa0) 50 | *pwc = (ucs4_t) c; 51 | else 52 | *pwc = (ucs4_t) iso8859_10_2uni[c-0xa0]; 53 | return 1; 54 | } 55 | 56 | static const unsigned char iso8859_10_page00[224] = { 57 | 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 59 | 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 61 | 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */ 62 | 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 63 | 0xd0, 0x00, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ 64 | 0xd8, 0x00, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ 65 | 0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */ 66 | 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 67 | 0xf0, 0x00, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ 68 | 0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */ 69 | /* 0x0100 */ 70 | 0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */ 71 | 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ 72 | 0xa9, 0xb9, 0xa2, 0xb2, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */ 73 | 0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 74 | 0x00, 0x00, 0xa3, 0xb3, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 75 | 0xa5, 0xb5, 0xa4, 0xb4, 0x00, 0x00, 0xc7, 0xe7, /* 0x28-0x2f */ 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0xb6, /* 0x30-0x37 */ 77 | 0xff, 0x00, 0x00, 0xa8, 0xb8, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 78 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00, /* 0x40-0x47 */ 79 | 0x00, 0x00, 0xaf, 0xbf, 0xd2, 0xf2, 0x00, 0x00, /* 0x48-0x4f */ 80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 81 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 82 | 0xaa, 0xba, 0x00, 0x00, 0x00, 0x00, 0xab, 0xbb, /* 0x60-0x67 */ 83 | 0xd7, 0xf7, 0xae, 0xbe, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 84 | 0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, 0x00, /* 0x78-0x7f */ 86 | }; 87 | 88 | static int 89 | iso8859_10_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 90 | { 91 | unsigned char c = 0; 92 | if (wc < 0x00a0) { 93 | *r = wc; 94 | return 1; 95 | } 96 | else if (wc >= 0x00a0 && wc < 0x0180) 97 | c = iso8859_10_page00[wc-0x00a0]; 98 | else if (wc == 0x2015) 99 | c = 0xbd; 100 | if (c != 0) { 101 | *r = c; 102 | return 1; 103 | } 104 | return RET_ILUNI; 105 | } 106 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso8859_11.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2004, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO-8859-11 22 | */ 23 | 24 | static int 25 | iso8859_11_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | if (c < 0xa1) { 29 | *pwc = (ucs4_t) c; 30 | return 1; 31 | } 32 | else if (c <= 0xfb && !(c >= 0xdb && c <= 0xde)) { 33 | *pwc = (ucs4_t) (c + 0x0d60); 34 | return 1; 35 | } 36 | return RET_ILSEQ; 37 | } 38 | 39 | static int 40 | iso8859_11_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 41 | { 42 | if (wc < 0x00a1) { 43 | *r = wc; 44 | return 1; 45 | } 46 | else if (wc >= 0x0e01 && wc <= 0x0e5b && !(wc >= 0x0e3b && wc <= 0x0e3e)) { 47 | *r = wc-0x0d60; 48 | return 1; 49 | } 50 | return RET_ILUNI; 51 | } 52 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso8859_15.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO-8859-15 22 | */ 23 | 24 | static const unsigned short iso8859_15_2uni[32] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, 27 | 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 28 | /* 0xb0 */ 29 | 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, 30 | 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, 31 | }; 32 | 33 | static int 34 | iso8859_15_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 35 | { 36 | unsigned char c = *s; 37 | if (c >= 0xa0 && c < 0xc0) 38 | *pwc = (ucs4_t) iso8859_15_2uni[c-0xa0]; 39 | else 40 | *pwc = (ucs4_t) c; 41 | return 1; 42 | } 43 | 44 | static const unsigned char iso8859_15_page00[32] = { 45 | 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */ 46 | 0x00, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 47 | 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 48 | 0x00, 0xb9, 0xba, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */ 49 | }; 50 | static const unsigned char iso8859_15_page01[48] = { 51 | 0x00, 0x00, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 53 | 0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 54 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 56 | 0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */ 57 | }; 58 | 59 | static int 60 | iso8859_15_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 61 | { 62 | unsigned char c = 0; 63 | if (wc < 0x00a0) { 64 | *r = wc; 65 | return 1; 66 | } 67 | else if (wc >= 0x00a0 && wc < 0x00c0) 68 | c = iso8859_15_page00[wc-0x00a0]; 69 | else if (wc >= 0x00c0 && wc < 0x0100) 70 | c = wc; 71 | else if (wc >= 0x0150 && wc < 0x0180) 72 | c = iso8859_15_page01[wc-0x0150]; 73 | else if (wc == 0x20ac) 74 | c = 0xa4; 75 | if (c != 0) { 76 | *r = c; 77 | return 1; 78 | } 79 | return RET_ILUNI; 80 | } 81 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso8859_5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO-8859-5 22 | */ 23 | 24 | static const unsigned short iso8859_5_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 27 | 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, 28 | /* 0xb0 */ 29 | 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 30 | 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 31 | /* 0xc0 */ 32 | 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 33 | 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 34 | /* 0xd0 */ 35 | 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 36 | 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 37 | /* 0xe0 */ 38 | 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 39 | 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 40 | /* 0xf0 */ 41 | 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 42 | 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, 43 | }; 44 | 45 | static int 46 | iso8859_5_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0xa0) 50 | *pwc = (ucs4_t) c; 51 | else 52 | *pwc = (ucs4_t) iso8859_5_2uni[c-0xa0]; 53 | return 1; 54 | } 55 | 56 | static const unsigned char iso8859_5_page00[16] = { 57 | 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, /* 0xa0-0xa7 */ 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 59 | }; 60 | static const unsigned char iso8859_5_page04[96] = { 61 | 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ 62 | 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */ 63 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ 64 | 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ 65 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 66 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 67 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ 68 | 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x38-0x3f */ 69 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ 70 | 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ 71 | 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ 72 | 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */ 73 | }; 74 | 75 | static int 76 | iso8859_5_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 77 | { 78 | unsigned char c = 0; 79 | if (wc < 0x00a0) { 80 | *r = wc; 81 | return 1; 82 | } 83 | else if (wc >= 0x00a0 && wc < 0x00b0) 84 | c = iso8859_5_page00[wc-0x00a0]; 85 | else if (wc >= 0x0400 && wc < 0x0460) 86 | c = iso8859_5_page04[wc-0x0400]; 87 | else if (wc == 0x2116) 88 | c = 0xf0; 89 | if (c != 0) { 90 | *r = c; 91 | return 1; 92 | } 93 | return RET_ILUNI; 94 | } 95 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso8859_6.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO-8859-6 22 | */ 23 | 24 | static const unsigned short iso8859_6_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0xfffd, 0xfffd, 0xfffd, 0x00a4, 0xfffd, 0xfffd, 0xfffd, 27 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x060c, 0x00ad, 0xfffd, 0xfffd, 28 | /* 0xb0 */ 29 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 30 | 0xfffd, 0xfffd, 0xfffd, 0x061b, 0xfffd, 0xfffd, 0xfffd, 0x061f, 31 | /* 0xc0 */ 32 | 0xfffd, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 33 | 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, 34 | /* 0xd0 */ 35 | 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 36 | 0x0638, 0x0639, 0x063a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 37 | /* 0xe0 */ 38 | 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 39 | 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 40 | /* 0xf0 */ 41 | 0x0650, 0x0651, 0x0652, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 42 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 43 | }; 44 | 45 | static int 46 | iso8859_6_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0xa0) { 50 | *pwc = (ucs4_t) c; 51 | return 1; 52 | } 53 | else { 54 | unsigned short wc = iso8859_6_2uni[c-0xa0]; 55 | if (wc != 0xfffd) { 56 | *pwc = (ucs4_t) wc; 57 | return 1; 58 | } 59 | } 60 | return RET_ILSEQ; 61 | } 62 | 63 | static const unsigned char iso8859_6_page00[16] = { 64 | 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 66 | }; 67 | static const unsigned char iso8859_6_page06[80] = { 68 | 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 70 | 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ 71 | 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 72 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 73 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ 74 | 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 75 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ 76 | 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ 77 | 0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 78 | }; 79 | 80 | static int 81 | iso8859_6_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 82 | { 83 | unsigned char c = 0; 84 | if (wc < 0x00a0) { 85 | *r = wc; 86 | return 1; 87 | } 88 | else if (wc >= 0x00a0 && wc < 0x00b0) 89 | c = iso8859_6_page00[wc-0x00a0]; 90 | else if (wc >= 0x0608 && wc < 0x0658) 91 | c = iso8859_6_page06[wc-0x0608]; 92 | if (c != 0) { 93 | *r = c; 94 | return 1; 95 | } 96 | return RET_ILUNI; 97 | } 98 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso8859_7.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2004, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO-8859-7 22 | */ 23 | 24 | static const unsigned short iso8859_7_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0x2018, 0x2019, 0x00a3, 0x20ac, 0x20af, 0x00a6, 0x00a7, 27 | 0x00a8, 0x00a9, 0x037a, 0x00ab, 0x00ac, 0x00ad, 0xfffd, 0x2015, 28 | /* 0xb0 */ 29 | 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, 30 | 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, 31 | /* 0xc0 */ 32 | 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 33 | 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 34 | /* 0xd0 */ 35 | 0x03a0, 0x03a1, 0xfffd, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 36 | 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, 37 | /* 0xe0 */ 38 | 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 39 | 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 40 | /* 0xf0 */ 41 | 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 42 | 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0xfffd, 43 | }; 44 | 45 | static int 46 | iso8859_7_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0xa0) { 50 | *pwc = (ucs4_t) c; 51 | return 1; 52 | } 53 | else { 54 | unsigned short wc = iso8859_7_2uni[c-0xa0]; 55 | if (wc != 0xfffd) { 56 | *pwc = (ucs4_t) wc; 57 | return 1; 58 | } 59 | } 60 | return RET_ILSEQ; 61 | } 62 | 63 | static const unsigned char iso8859_7_page00[32] = { 64 | 0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ 65 | 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 66 | 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ 67 | 0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ 68 | }; 69 | static const unsigned char iso8859_7_page03[88] = { 70 | 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 71 | 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0x00, /* 0x80-0x87 */ 72 | 0xb8, 0xb9, 0xba, 0x00, 0xbc, 0x00, 0xbe, 0xbf, /* 0x88-0x8f */ 73 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x90-0x97 */ 74 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x98-0x9f */ 75 | 0xd0, 0xd1, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xa0-0xa7 */ 76 | 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xa8-0xaf */ 77 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xb0-0xb7 */ 78 | 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xb8-0xbf */ 79 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xc0-0xc7 */ 80 | 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xc8-0xcf */ 81 | }; 82 | static const unsigned char iso8859_7_page20[16] = { 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, /* 0x10-0x17 */ 84 | 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 85 | }; 86 | 87 | static int 88 | iso8859_7_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 89 | { 90 | unsigned char c = 0; 91 | if (wc < 0x00a0) { 92 | *r = wc; 93 | return 1; 94 | } 95 | else if (wc >= 0x00a0 && wc < 0x00c0) 96 | c = iso8859_7_page00[wc-0x00a0]; 97 | else if (wc >= 0x0378 && wc < 0x03d0) 98 | c = iso8859_7_page03[wc-0x0378]; 99 | else if (wc >= 0x2010 && wc < 0x2020) 100 | c = iso8859_7_page20[wc-0x2010]; 101 | else if (wc == 0x20ac) 102 | c = 0xa4; 103 | else if (wc == 0x20af) 104 | c = 0xa5; 105 | if (c != 0) { 106 | *r = c; 107 | return 1; 108 | } 109 | return RET_ILUNI; 110 | } 111 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso8859_8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO-8859-8 22 | */ 23 | 24 | static const unsigned short iso8859_8_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0xfffd, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 27 | 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 28 | /* 0xb0 */ 29 | 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 30 | 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0xfffd, 31 | /* 0xc0 */ 32 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 33 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 34 | /* 0xd0 */ 35 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 36 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2017, 37 | /* 0xe0 */ 38 | 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 39 | 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, 40 | /* 0xf0 */ 41 | 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 42 | 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, 43 | }; 44 | 45 | static int 46 | iso8859_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c >= 0xa0) { 50 | unsigned short wc = iso8859_8_2uni[c-0xa0]; 51 | if (wc != 0xfffd) { 52 | *pwc = (ucs4_t) wc; 53 | return 1; 54 | } 55 | } 56 | else { 57 | *pwc = (ucs4_t) c; 58 | return 1; 59 | } 60 | return RET_ILSEQ; 61 | } 62 | 63 | static const unsigned char iso8859_8_page00[88] = { 64 | 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 65 | 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 66 | 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 67 | 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ 68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */ 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 72 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 74 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ 75 | }; 76 | static const unsigned char iso8859_8_page05[32] = { 77 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */ 78 | 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */ 79 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */ 80 | 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 81 | }; 82 | static const unsigned char iso8859_8_page20[16] = { 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ 84 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x10-0x17 */ 85 | }; 86 | 87 | static int 88 | iso8859_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 89 | { 90 | unsigned char c = 0; 91 | if (wc < 0x00a0) { 92 | *r = wc; 93 | return 1; 94 | } 95 | else if (wc >= 0x00a0 && wc < 0x00f8) 96 | c = iso8859_8_page00[wc-0x00a0]; 97 | else if (wc >= 0x05d0 && wc < 0x05f0) 98 | c = iso8859_8_page05[wc-0x05d0]; 99 | else if (wc >= 0x2008 && wc < 0x2018) 100 | c = iso8859_8_page20[wc-0x2008]; 101 | if (c != 0) { 102 | *r = c; 103 | return 1; 104 | } 105 | return RET_ILUNI; 106 | } 107 | -------------------------------------------------------------------------------- /deps/libiconv/lib/iso8859_9.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * ISO-8859-9 22 | */ 23 | 24 | static const unsigned short iso8859_9_2uni[48] = { 25 | /* 0xd0 */ 26 | 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 27 | 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, 28 | /* 0xe0 */ 29 | 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 30 | 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 31 | /* 0xf0 */ 32 | 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 33 | 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, 34 | }; 35 | 36 | static int 37 | iso8859_9_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 38 | { 39 | unsigned char c = *s; 40 | if (c >= 0xd0) 41 | *pwc = (ucs4_t) iso8859_9_2uni[c-0xd0]; 42 | else 43 | *pwc = (ucs4_t) c; 44 | return 1; 45 | } 46 | 47 | static const unsigned char iso8859_9_page00[48] = { 48 | 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 49 | 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ 50 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 51 | 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 52 | 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 53 | 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ 54 | }; 55 | static const unsigned char iso8859_9_page01[72] = { 56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, /* 0x18-0x1f */ 57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 59 | 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */ 65 | }; 66 | 67 | static int 68 | iso8859_9_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 69 | { 70 | unsigned char c = 0; 71 | if (wc < 0x00d0) { 72 | *r = wc; 73 | return 1; 74 | } 75 | else if (wc >= 0x00d0 && wc < 0x0100) 76 | c = iso8859_9_page00[wc-0x00d0]; 77 | else if (wc >= 0x0118 && wc < 0x0160) 78 | c = iso8859_9_page01[wc-0x0118]; 79 | if (c != 0) { 80 | *r = c; 81 | return 1; 82 | } 83 | return RET_ILUNI; 84 | } 85 | -------------------------------------------------------------------------------- /deps/libiconv/lib/java.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * JAVA 22 | * This is ISO 8859-1 with \uXXXX escape sequences, denoting Unicode BMP 23 | * characters. Consecutive pairs of \uXXXX escape sequences in the surrogate 24 | * range, as in UTF-16, denote Unicode characters outside the BMP. 25 | */ 26 | 27 | static int 28 | java_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 29 | { 30 | unsigned char c; 31 | ucs4_t wc, wc2; 32 | int i; 33 | 34 | c = s[0]; 35 | if (c != '\\') { 36 | *pwc = c; 37 | return 1; 38 | } 39 | if (n < 2) 40 | return RET_TOOFEW(0); 41 | if (s[1] != 'u') 42 | goto simply_backslash; 43 | wc = 0; 44 | for (i = 2; i < 6; i++) { 45 | if (n <= i) 46 | return RET_TOOFEW(0); 47 | c = s[i]; 48 | if (c >= '0' && c <= '9') 49 | c -= '0'; 50 | else if (c >= 'A' && c <= 'Z') 51 | c -= 'A'-10; 52 | else if (c >= 'a' && c <= 'z') 53 | c -= 'a'-10; 54 | else 55 | goto simply_backslash; 56 | wc |= (ucs4_t) c << (4 * (5-i)); 57 | } 58 | if (!(wc >= 0xd800 && wc < 0xe000)) { 59 | *pwc = wc; 60 | return 6; 61 | } 62 | if (wc >= 0xdc00) 63 | goto simply_backslash; 64 | if (n < 7) 65 | return RET_TOOFEW(0); 66 | if (s[6] != '\\') 67 | goto simply_backslash; 68 | if (n < 8) 69 | return RET_TOOFEW(0); 70 | if (s[7] != 'u') 71 | goto simply_backslash; 72 | wc2 = 0; 73 | for (i = 8; i < 12; i++) { 74 | if (n <= i) 75 | return RET_TOOFEW(0); 76 | c = s[i]; 77 | if (c >= '0' && c <= '9') 78 | c -= '0'; 79 | else if (c >= 'A' && c <= 'Z') 80 | c -= 'A'-10; 81 | else if (c >= 'a' && c <= 'z') 82 | c -= 'a'-10; 83 | else 84 | goto simply_backslash; 85 | wc2 |= (ucs4_t) c << (4 * (11-i)); 86 | } 87 | if (!(wc2 >= 0xdc00 && wc2 < 0xe000)) 88 | goto simply_backslash; 89 | *pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00); 90 | return 12; 91 | simply_backslash: 92 | *pwc = '\\'; 93 | return 1; 94 | } 95 | 96 | static int 97 | java_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 98 | { 99 | if (wc < 0x80) { 100 | *r = wc; 101 | return 1; 102 | } else if (wc < 0x10000) { 103 | if (n >= 6) { 104 | unsigned int i; 105 | r[0] = '\\'; 106 | r[1] = 'u'; 107 | i = (wc >> 12) & 0x0f; r[2] = (i < 10 ? '0'+i : 'a'-10+i); 108 | i = (wc >> 8) & 0x0f; r[3] = (i < 10 ? '0'+i : 'a'-10+i); 109 | i = (wc >> 4) & 0x0f; r[4] = (i < 10 ? '0'+i : 'a'-10+i); 110 | i = wc & 0x0f; r[5] = (i < 10 ? '0'+i : 'a'-10+i); 111 | return 6; 112 | } else 113 | return RET_TOOSMALL; 114 | } else if (wc < 0x110000) { 115 | if (n >= 12) { 116 | ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10); 117 | ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff); 118 | unsigned int i; 119 | r[0] = '\\'; 120 | r[1] = 'u'; 121 | i = (wc1 >> 12) & 0x0f; r[2] = (i < 10 ? '0'+i : 'a'-10+i); 122 | i = (wc1 >> 8) & 0x0f; r[3] = (i < 10 ? '0'+i : 'a'-10+i); 123 | i = (wc1 >> 4) & 0x0f; r[4] = (i < 10 ? '0'+i : 'a'-10+i); 124 | i = wc1 & 0x0f; r[5] = (i < 10 ? '0'+i : 'a'-10+i); 125 | r[6] = '\\'; 126 | r[7] = 'u'; 127 | i = (wc2 >> 12) & 0x0f; r[8] = (i < 10 ? '0'+i : 'a'-10+i); 128 | i = (wc2 >> 8) & 0x0f; r[9] = (i < 10 ? '0'+i : 'a'-10+i); 129 | i = (wc2 >> 4) & 0x0f; r[10] = (i < 10 ? '0'+i : 'a'-10+i); 130 | i = wc2 & 0x0f; r[11] = (i < 10 ? '0'+i : 'a'-10+i); 131 | return 12; 132 | } else 133 | return RET_TOOSMALL; 134 | } 135 | return RET_ILUNI; 136 | } 137 | -------------------------------------------------------------------------------- /deps/libiconv/lib/jisx0201.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * JISX0201.1976-0 22 | */ 23 | 24 | static int 25 | jisx0201_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | if (c < 0x80) { 29 | if (c == 0x5c) 30 | *pwc = (ucs4_t) 0x00a5; 31 | else if (c == 0x7e) 32 | *pwc = (ucs4_t) 0x203e; 33 | else 34 | *pwc = (ucs4_t) c; 35 | return 1; 36 | } else { 37 | if (c >= 0xa1 && c < 0xe0) { 38 | *pwc = (ucs4_t) c + 0xfec0; 39 | return 1; 40 | } 41 | } 42 | return RET_ILSEQ; 43 | } 44 | 45 | static int 46 | jisx0201_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 47 | { 48 | if (wc < 0x0080 && !(wc == 0x005c || wc == 0x007e)) { 49 | *r = wc; 50 | return 1; 51 | } 52 | if (wc == 0x00a5) { 53 | *r = 0x5c; 54 | return 1; 55 | } 56 | if (wc == 0x203e) { 57 | *r = 0x7e; 58 | return 1; 59 | } 60 | if (wc >= 0xff61 && wc < 0xffa0) { 61 | *r = wc - 0xfec0; 62 | return 1; 63 | } 64 | return RET_ILUNI; 65 | } 66 | -------------------------------------------------------------------------------- /deps/libiconv/lib/loops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2000 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* This file defines all the loops. */ 21 | 22 | #include "loop_unicode.h" 23 | #include "loop_wchar.h" 24 | 25 | -------------------------------------------------------------------------------- /deps/libiconv/lib/mulelao.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * MULELAO-1 22 | */ 23 | 24 | static const unsigned short mulelao_2uni[96] = { 25 | /* 0xa0 */ 26 | 0x00a0, 0x0e81, 0x0e82, 0xfffd, 0x0e84, 0xfffd, 0xfffd, 0x0e87, 27 | 0x0e88, 0xfffd, 0x0e8a, 0xfffd, 0xfffd, 0x0e8d, 0xfffd, 0xfffd, 28 | /* 0xb0 */ 29 | 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e94, 0x0e95, 0x0e96, 0x0e97, 30 | 0xfffd, 0x0e99, 0x0e9a, 0x0e9b, 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, 31 | /* 0xc0 */ 32 | 0xfffd, 0x0ea1, 0x0ea2, 0x0ea3, 0xfffd, 0x0ea5, 0xfffd, 0x0ea7, 33 | 0xfffd, 0xfffd, 0x0eaa, 0x0eab, 0xfffd, 0x0ead, 0x0eae, 0x0eaf, 34 | /* 0xd0 */ 35 | 0x0eb0, 0x0eb1, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, 36 | 0x0eb8, 0x0eb9, 0xfffd, 0x0ebb, 0x0ebc, 0x0ebd, 0xfffd, 0xfffd, 37 | /* 0xe0 */ 38 | 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0xfffd, 0x0ec6, 0xfffd, 39 | 0x0ec8, 0x0ec9, 0x0eca, 0x0ecb, 0x0ecc, 0x0ecd, 0xfffd, 0xfffd, 40 | /* 0xf0 */ 41 | 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, 42 | 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x0edc, 0x0edd, 0xfffd, 0xfffd, 43 | }; 44 | 45 | static int 46 | mulelao_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0xa0) { 50 | *pwc = (ucs4_t) c; 51 | return 1; 52 | } 53 | else { 54 | unsigned short wc = mulelao_2uni[c-0xa0]; 55 | if (wc != 0xfffd) { 56 | *pwc = (ucs4_t) wc; 57 | return 1; 58 | } 59 | } 60 | return RET_ILSEQ; 61 | } 62 | 63 | static const unsigned char mulelao_page0e[96] = { 64 | 0x00, 0xa1, 0xa2, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0x80-0x87 */ 65 | 0xa8, 0x00, 0xaa, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0x88-0x8f */ 66 | 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x90-0x97 */ 67 | 0x00, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x98-0x9f */ 68 | 0x00, 0xc1, 0xc2, 0xc3, 0x00, 0xc5, 0x00, 0xc7, /* 0xa0-0xa7 */ 69 | 0x00, 0x00, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xa8-0xaf */ 70 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xb0-0xb7 */ 71 | 0xd8, 0xd9, 0x00, 0xdb, 0xdc, 0xdd, 0x00, 0x00, /* 0xb8-0xbf */ 72 | 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0x00, 0xe6, 0x00, /* 0xc0-0xc7 */ 73 | 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0x00, 0x00, /* 0xc8-0xcf */ 74 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ 75 | 0xf8, 0xf9, 0x00, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xd8-0xdf */ 76 | }; 77 | 78 | static int 79 | mulelao_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 80 | { 81 | unsigned char c = 0; 82 | if (wc < 0x00a0) { 83 | *r = wc; 84 | return 1; 85 | } 86 | else if (wc == 0x00a0) 87 | c = 0xa0; 88 | else if (wc >= 0x0e80 && wc < 0x0ee0) 89 | c = mulelao_page0e[wc-0x0e80]; 90 | if (c != 0) { 91 | *r = c; 92 | return 1; 93 | } 94 | return RET_ILUNI; 95 | } 96 | -------------------------------------------------------------------------------- /deps/libiconv/lib/riscos1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * RISCOS-LATIN1 22 | */ 23 | 24 | static const unsigned short riscos1_2uni[32] = { 25 | /* 0x80 */ 26 | 0x221a, 0x0174, 0x0175, 0x0083, 0x2573, 0x0176, 0x0177, 0x0087, 27 | 0x21e6, 0x21e8, 0x21e9, 0x21e7, 0x2026, 0x2122, 0x2030, 0x2022, 28 | /* 0x90 */ 29 | 0x2018, 0x2019, 0x2039, 0x203a, 0x201c, 0x201d, 0x201e, 0x2013, 30 | 0x2014, 0x2212, 0x0152, 0x0153, 0x2020, 0x2021, 0xfb01, 0xfb02, 31 | }; 32 | 33 | static int 34 | riscos1_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 35 | { 36 | unsigned char c = *s; 37 | if (c >= 0x80 && c < 0xa0) 38 | *pwc = (ucs4_t) riscos1_2uni[c-0x80]; 39 | else 40 | *pwc = (ucs4_t) c; 41 | return 1; 42 | } 43 | 44 | static const unsigned char riscos1_page01[40] = { 45 | 0x00, 0x00, 0x9a, 0x9b, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 49 | 0x00, 0x00, 0x00, 0x00, 0x81, 0x82, 0x85, 0x86, /* 0x70-0x77 */ 50 | }; 51 | static const unsigned char riscos1_page20[48] = { 52 | 0x00, 0x00, 0x00, 0x97, 0x98, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 53 | 0x90, 0x91, 0x00, 0x00, 0x94, 0x95, 0x96, 0x00, /* 0x18-0x1f */ 54 | 0x9c, 0x9d, 0x8f, 0x00, 0x00, 0x00, 0x8c, 0x00, /* 0x20-0x27 */ 55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 56 | 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 57 | 0x00, 0x92, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 58 | }; 59 | static const unsigned char riscos1_page21[16] = { 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x8b, /* 0xe0-0xe7 */ 61 | 0x89, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 62 | }; 63 | static const unsigned char riscos1_page22[16] = { 64 | 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 65 | 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 66 | }; 67 | 68 | static int 69 | riscos1_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 70 | { 71 | unsigned char c = 0; 72 | if (wc < 0x0080 || wc == 0x0083 || wc == 0x0087 || (wc >= 0x00a0 && wc < 0x0100)) { 73 | *r = wc; 74 | return 1; 75 | } 76 | else if (wc >= 0x0150 && wc < 0x0178) 77 | c = riscos1_page01[wc-0x0150]; 78 | else if (wc >= 0x2010 && wc < 0x2040) 79 | c = riscos1_page20[wc-0x2010]; 80 | else if (wc == 0x2122) 81 | c = 0x8d; 82 | else if (wc >= 0x21e0 && wc < 0x21f0) 83 | c = riscos1_page21[wc-0x21e0]; 84 | else if (wc >= 0x2210 && wc < 0x2220) 85 | c = riscos1_page22[wc-0x2210]; 86 | else if (wc == 0x2573) 87 | c = 0x84; 88 | else if (wc >= 0xfb01 && wc < 0xfb03) 89 | c = wc-0xfa63; 90 | if (c != 0) { 91 | *r = c; 92 | return 1; 93 | } 94 | return RET_ILUNI; 95 | } 96 | -------------------------------------------------------------------------------- /deps/libiconv/lib/sjis.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * SHIFT_JIS 22 | */ 23 | 24 | /* 25 | Conversion between SJIS codes (s1,s2) and JISX0208 codes (c1,c2): 26 | Example. (s1,s2) = 0x8140, (c1,c2) = 0x2121. 27 | 0x81 <= s1 <= 0x9F || 0xE0 <= s1 <= 0xEA, 28 | 0x40 <= s2 <= 0x7E || 0x80 <= s2 <= 0xFC, 29 | 0x21 <= c1 <= 0x74, 0x21 <= c2 <= 0x7E. 30 | Invariant: 31 | 94*2*(s1 < 0xE0 ? s1-0x81 : s1-0xC1) + (s2 < 0x80 ? s2-0x40 : s2-0x41) 32 | = 94*(c1-0x21)+(c2-0x21) 33 | Conversion (s1,s2) -> (c1,c2): 34 | t1 := (s1 < 0xE0 ? s1-0x81 : s1-0xC1) 35 | t2 := (s2 < 0x80 ? s2-0x40 : s2-0x41) 36 | c1 := 2*t1 + (t2 < 0x5E ? 0 : 1) + 0x21 37 | c2 := (t2 < 0x5E ? t2 : t2-0x5E) + 0x21 38 | Conversion (c1,c2) -> (s1,s2): 39 | t1 := (c1 - 0x21) >> 1 40 | t2 := ((c1 - 0x21) & 1) * 0x5E + (c2 - 0x21) 41 | s1 := (t1 < 0x1F ? t1+0x81 : t1+0xC1) 42 | s2 := (t2 < 0x3F ? t2+0x40 : t2+0x41) 43 | */ 44 | 45 | static int 46 | sjis_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 47 | { 48 | unsigned char c = *s; 49 | if (c < 0x80 || (c >= 0xa1 && c <= 0xdf)) 50 | return jisx0201_mbtowc(conv,pwc,s,n); 51 | else { 52 | unsigned char s1, s2; 53 | s1 = c; 54 | if ((s1 >= 0x81 && s1 <= 0x9f) || (s1 >= 0xe0 && s1 <= 0xea)) { 55 | if (n < 2) 56 | return RET_TOOFEW(0); 57 | s2 = s[1]; 58 | if ((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0x80 && s2 <= 0xfc)) { 59 | unsigned char t1 = (s1 < 0xe0 ? s1-0x81 : s1-0xc1); 60 | unsigned char t2 = (s2 < 0x80 ? s2-0x40 : s2-0x41); 61 | unsigned char buf[2]; 62 | buf[0] = 2*t1 + (t2 < 0x5e ? 0 : 1) + 0x21; 63 | buf[1] = (t2 < 0x5e ? t2 : t2-0x5e) + 0x21; 64 | return jisx0208_mbtowc(conv,pwc,buf,2); 65 | } 66 | } else if (s1 >= 0xf0 && s1 <= 0xf9) { 67 | /* User-defined range. See 68 | * Ken Lunde's "CJKV Information Processing", table 4-66, p. 206. */ 69 | if (n < 2) 70 | return RET_TOOFEW(0); 71 | s2 = s[1]; 72 | if ((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0x80 && s2 <= 0xfc)) { 73 | *pwc = 0xe000 + 188*(s1 - 0xf0) + (s2 < 0x80 ? s2-0x40 : s2-0x41); 74 | return 2; 75 | } 76 | } 77 | return RET_ILSEQ; 78 | } 79 | } 80 | 81 | static int 82 | sjis_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 83 | { 84 | unsigned char buf[2]; 85 | int ret; 86 | 87 | /* Try JIS X 0201-1976. */ 88 | ret = jisx0201_wctomb(conv,buf,wc,1); 89 | if (ret != RET_ILUNI) { 90 | unsigned char c; 91 | if (ret != 1) abort(); 92 | c = buf[0]; 93 | if (c < 0x80 || (c >= 0xa1 && c <= 0xdf)) { 94 | r[0] = c; 95 | return 1; 96 | } 97 | } 98 | 99 | /* Try JIS X 0208-1990. */ 100 | ret = jisx0208_wctomb(conv,buf,wc,2); 101 | if (ret != RET_ILUNI) { 102 | unsigned char c1, c2; 103 | if (ret != 2) abort(); 104 | if (n < 2) 105 | return RET_TOOSMALL; 106 | c1 = buf[0]; 107 | c2 = buf[1]; 108 | if ((c1 >= 0x21 && c1 <= 0x74) && (c2 >= 0x21 && c2 <= 0x7e)) { 109 | unsigned char t1 = (c1 - 0x21) >> 1; 110 | unsigned char t2 = (((c1 - 0x21) & 1) ? 0x5e : 0) + (c2 - 0x21); 111 | r[0] = (t1 < 0x1f ? t1+0x81 : t1+0xc1); 112 | r[1] = (t2 < 0x3f ? t2+0x40 : t2+0x41); 113 | return 2; 114 | } 115 | } 116 | 117 | /* User-defined range. See 118 | * Ken Lunde's "CJKV Information Processing", table 4-66, p. 206. */ 119 | if (wc >= 0xe000 && wc < 0xe758) { 120 | unsigned char c1, c2; 121 | if (n < 2) 122 | return RET_TOOSMALL; 123 | c1 = (unsigned int) (wc - 0xe000) / 188; 124 | c2 = (unsigned int) (wc - 0xe000) % 188; 125 | r[0] = c1+0xf0; 126 | r[1] = (c2 < 0x3f ? c2+0x40 : c2+0x41); 127 | return 2; 128 | } 129 | 130 | return RET_ILUNI; 131 | } 132 | -------------------------------------------------------------------------------- /deps/libiconv/lib/tds565.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2002, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * TDS565 22 | */ 23 | 24 | static const unsigned short tds565_2uni[64] = { 25 | /* 0x40 */ 26 | 0x0040, 0x0041, 0x0042, 0x00c7, 0x0044, 0x0045, 0x00c4, 0x0046, 27 | 0x0047, 0x0048, 0x0049, 0x004a, 0x017d, 0x004b, 0x004c, 0x004d, 28 | /* 0x50 */ 29 | 0x004e, 0x0147, 0x004f, 0x00d6, 0x0050, 0x0052, 0x0053, 0x015e, 30 | 0x0054, 0x0055, 0x00dc, 0x0057, 0x0059, 0x00dd, 0x005a, 0x005f, 31 | /* 0x60 */ 32 | 0x2116, 0x0061, 0x0062, 0x00e7, 0x0064, 0x0065, 0x00e4, 0x0066, 33 | 0x0067, 0x0068, 0x0069, 0x006a, 0x017e, 0x006b, 0x006c, 0x006d, 34 | /* 0x70 */ 35 | 0x006e, 0x0148, 0x006f, 0x00f6, 0x0070, 0x0072, 0x0073, 0x015f, 36 | 0x0074, 0x0075, 0x00fc, 0x0077, 0x0079, 0x00fd, 0x007a, 0x007f, 37 | }; 38 | 39 | static int 40 | tds565_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 41 | { 42 | unsigned char c = *s; 43 | if (c < 0x40) { 44 | *pwc = (ucs4_t) c; 45 | return 1; 46 | } 47 | else if (c < 0x80) { 48 | *pwc = (ucs4_t) tds565_2uni[c-0x40]; 49 | return 1; 50 | } 51 | return RET_ILSEQ; 52 | } 53 | 54 | static const unsigned char tds565_page00[64] = { 55 | 0x40, 0x41, 0x42, 0x00, 0x44, 0x45, 0x47, 0x48, /* 0x40-0x47 */ 56 | 0x49, 0x4a, 0x4b, 0x4d, 0x4e, 0x4f, 0x50, 0x52, /* 0x48-0x4f */ 57 | 0x54, 0x00, 0x55, 0x56, 0x58, 0x59, 0x00, 0x5b, /* 0x50-0x57 */ 58 | 0x00, 0x5c, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x5f, /* 0x58-0x5f */ 59 | 0x00, 0x61, 0x62, 0x00, 0x64, 0x65, 0x67, 0x68, /* 0x60-0x67 */ 60 | 0x69, 0x6a, 0x6b, 0x6d, 0x6e, 0x6f, 0x70, 0x72, /* 0x68-0x6f */ 61 | 0x74, 0x00, 0x75, 0x76, 0x78, 0x79, 0x00, 0x7b, /* 0x70-0x77 */ 62 | 0x00, 0x7c, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7f, /* 0x78-0x7f */ 63 | }; 64 | static const unsigned char tds565_page00_1[64] = { 65 | 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x43, /* 0xc0-0xc7 */ 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, /* 0xd0-0xd7 */ 68 | 0x00, 0x00, 0x00, 0x00, 0x5a, 0x5d, 0x00, 0x00, /* 0xd8-0xdf */ 69 | 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x63, /* 0xe0-0xe7 */ 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, /* 0xf0-0xf7 */ 72 | 0x00, 0x00, 0x00, 0x00, 0x7a, 0x7d, 0x00, 0x00, /* 0xf8-0xff */ 73 | }; 74 | static const unsigned char tds565_page01[64] = { 75 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, /* 0x40-0x47 */ 76 | 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 77 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 78 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x77, /* 0x58-0x5f */ 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 81 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x6c, 0x00, /* 0x78-0x7f */ 83 | }; 84 | 85 | static int 86 | tds565_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 87 | { 88 | unsigned char c = 0; 89 | if (wc < 0x0040) { 90 | *r = wc; 91 | return 1; 92 | } 93 | else if (wc >= 0x0040 && wc < 0x0080) 94 | c = tds565_page00[wc-0x0040]; 95 | else if (wc >= 0x00c0 && wc < 0x0100) 96 | c = tds565_page00_1[wc-0x00c0]; 97 | else if (wc >= 0x0140 && wc < 0x0180) 98 | c = tds565_page01[wc-0x0140]; 99 | else if (wc == 0x2116) 100 | c = 0x60; 101 | if (c != 0) { 102 | *r = c; 103 | return 1; 104 | } 105 | return RET_ILUNI; 106 | } 107 | -------------------------------------------------------------------------------- /deps/libiconv/lib/tis620.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * TIS620.2533-1 22 | */ 23 | 24 | static int 25 | tis620_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | unsigned char c = *s; 28 | if (c < 0x80) { 29 | *pwc = (ucs4_t) c; 30 | return 1; 31 | } 32 | else if (c >= 0xa1 && c <= 0xfb && !(c >= 0xdb && c <= 0xde)) { 33 | *pwc = (ucs4_t) (c + 0x0d60); 34 | return 1; 35 | } 36 | return RET_ILSEQ; 37 | } 38 | 39 | static int 40 | tis620_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 41 | { 42 | if (wc < 0x0080) { 43 | *r = wc; 44 | return 1; 45 | } 46 | else if (wc >= 0x0e01 && wc <= 0x0e5b && !(wc >= 0x0e3b && wc <= 0x0e3e)) { 47 | *r = wc-0x0d60; 48 | return 1; 49 | } 50 | return RET_ILUNI; 51 | } 52 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2008, 2011, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-2 22 | */ 23 | 24 | /* Here we accept FFFE/FEFF marks as endianness indicators everywhere 25 | in the stream, not just at the beginning. The default is big-endian. */ 26 | /* The state is 0 if big-endian, 1 if little-endian. */ 27 | static int 28 | ucs2_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 29 | { 30 | state_t state = conv->istate; 31 | int count = 0; 32 | for (; n >= 2 && count <= RET_COUNT_MAX && count <= INT_MAX-2;) { 33 | ucs4_t wc = (state ? s[0] + (s[1] << 8) : (s[0] << 8) + s[1]); 34 | if (wc == 0xfeff) { 35 | } else if (wc == 0xfffe) { 36 | state ^= 1; 37 | } else if (wc >= 0xd800 && wc < 0xe000) { 38 | conv->istate = state; 39 | return RET_SHIFT_ILSEQ(count); 40 | } else { 41 | *pwc = wc; 42 | conv->istate = state; 43 | return count+2; 44 | } 45 | s += 2; n -= 2; count += 2; 46 | } 47 | conv->istate = state; 48 | return RET_TOOFEW(count); 49 | } 50 | 51 | /* But we output UCS-2 in big-endian order, without byte-order mark. */ 52 | /* RFC 2152 says: 53 | "ISO/IEC 10646-1:1993(E) specifies that when characters the UCS-2 form are 54 | serialized as octets, that the most significant octet appear first." */ 55 | static int 56 | ucs2_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 57 | { 58 | if (wc < 0x10000 && wc != 0xfffe && !(wc >= 0xd800 && wc < 0xe000)) { 59 | if (n >= 2) { 60 | r[0] = (unsigned char) (wc >> 8); 61 | r[1] = (unsigned char) wc; 62 | return 2; 63 | } else 64 | return RET_TOOSMALL; 65 | } else 66 | return RET_ILUNI; 67 | } 68 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs2be.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-2BE = UCS-2 big endian 22 | */ 23 | 24 | static int 25 | ucs2be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | if (n >= 2) { 28 | if (s[0] >= 0xd8 && s[0] < 0xe0) { 29 | return RET_ILSEQ; 30 | } else { 31 | *pwc = (s[0] << 8) + s[1]; 32 | return 2; 33 | } 34 | } 35 | return RET_TOOFEW(0); 36 | } 37 | 38 | static int 39 | ucs2be_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 40 | { 41 | if (wc < 0x10000 && !(wc >= 0xd800 && wc < 0xe000)) { 42 | if (n >= 2) { 43 | r[0] = (unsigned char) (wc >> 8); 44 | r[1] = (unsigned char) wc; 45 | return 2; 46 | } else 47 | return RET_TOOSMALL; 48 | } 49 | return RET_ILUNI; 50 | } 51 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs2internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-2-INTERNAL = UCS-2 with machine dependent endianness and alignment 22 | */ 23 | 24 | static int 25 | ucs2internal_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | if (n >= 2) { 28 | unsigned short x = *(const unsigned short *)s; 29 | if (x >= 0xd800 && x < 0xe000) { 30 | return RET_ILSEQ; 31 | } else { 32 | *pwc = x; 33 | return 2; 34 | } 35 | } 36 | return RET_TOOFEW(0); 37 | } 38 | 39 | static int 40 | ucs2internal_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 41 | { 42 | if (wc < 0x10000 && !(wc >= 0xd800 && wc < 0xe000)) { 43 | if (n >= 2) { 44 | *(unsigned short *)r = wc; 45 | return 2; 46 | } else 47 | return RET_TOOSMALL; 48 | } else 49 | return RET_ILUNI; 50 | } 51 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs2le.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-2LE = UCS-2 little endian 22 | */ 23 | 24 | static int 25 | ucs2le_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | if (n >= 2) { 28 | if (s[1] >= 0xd8 && s[1] < 0xe0) { 29 | return RET_ILSEQ; 30 | } else { 31 | *pwc = s[0] + (s[1] << 8); 32 | return 2; 33 | } 34 | } 35 | return RET_TOOFEW(0); 36 | } 37 | 38 | static int 39 | ucs2le_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 40 | { 41 | if (wc < 0x10000 && !(wc >= 0xd800 && wc < 0xe000)) { 42 | if (n >= 2) { 43 | r[0] = (unsigned char) wc; 44 | r[1] = (unsigned char) (wc >> 8); 45 | return 2; 46 | } else 47 | return RET_TOOSMALL; 48 | } 49 | return RET_ILUNI; 50 | } 51 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs2swapped.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-2-SWAPPED = UCS-2-INTERNAL with inverted endianness 22 | */ 23 | 24 | static int 25 | ucs2swapped_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | /* This function assumes that 'unsigned short' has exactly 16 bits. */ 28 | if (sizeof(unsigned short) != 2) abort(); 29 | 30 | if (n >= 2) { 31 | unsigned short x = *(const unsigned short *)s; 32 | x = (x >> 8) | (x << 8); 33 | if (x >= 0xd800 && x < 0xe000) { 34 | return RET_ILSEQ; 35 | } else { 36 | *pwc = x; 37 | return 2; 38 | } 39 | } 40 | return RET_TOOFEW(0); 41 | } 42 | 43 | static int 44 | ucs2swapped_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 45 | { 46 | /* This function assumes that 'unsigned short' has exactly 16 bits. */ 47 | if (sizeof(unsigned short) != 2) abort(); 48 | 49 | if (wc < 0x10000 && !(wc >= 0xd800 && wc < 0xe000)) { 50 | if (n >= 2) { 51 | unsigned short x = wc; 52 | x = (x >> 8) | (x << 8); 53 | *(unsigned short *)r = x; 54 | return 2; 55 | } else 56 | return RET_TOOSMALL; 57 | } else 58 | return RET_ILUNI; 59 | } 60 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2008, 2011, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-4 22 | */ 23 | 24 | /* Here we accept FFFE0000/0000FEFF marks as endianness indicators everywhere 25 | in the stream, not just at the beginning. The default is big-endian. */ 26 | /* The state is 0 if big-endian, 1 if little-endian. */ 27 | static int 28 | ucs4_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 29 | { 30 | state_t state = conv->istate; 31 | int count = 0; 32 | for (; n >= 4 && count <= RET_COUNT_MAX && count <= INT_MAX-4;) { 33 | ucs4_t wc = (state 34 | ? s[0] + (s[1] << 8) + (s[2] << 16) + (s[3] << 24) 35 | : (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3]); 36 | if (wc == 0x0000feff) { 37 | } else if (wc == 0xfffe0000u) { 38 | state ^= 1; 39 | } else if (wc <= 0x7fffffff) { 40 | *pwc = wc; 41 | conv->istate = state; 42 | return count+4; 43 | } else { 44 | conv->istate = state; 45 | return RET_SHIFT_ILSEQ(count); 46 | } 47 | s += 4; n -= 4; count += 4; 48 | } 49 | conv->istate = state; 50 | return RET_TOOFEW(count); 51 | } 52 | 53 | /* But we output UCS-4 in big-endian order, without byte-order mark. */ 54 | static int 55 | ucs4_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 56 | { 57 | if (wc <= 0x7fffffff) { 58 | if (n >= 4) { 59 | r[0] = (unsigned char) (wc >> 24); 60 | r[1] = (unsigned char) (wc >> 16); 61 | r[2] = (unsigned char) (wc >> 8); 62 | r[3] = (unsigned char) wc; 63 | return 4; 64 | } else 65 | return RET_TOOSMALL; 66 | } else 67 | return RET_ILUNI; 68 | } 69 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs4be.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2000, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-4BE = UCS-4 big endian 22 | */ 23 | 24 | static int 25 | ucs4be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | if (n >= 4) { 28 | *pwc = (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3]; 29 | return 4; 30 | } 31 | return RET_TOOFEW(0); 32 | } 33 | 34 | static int 35 | ucs4be_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 36 | { 37 | if (n >= 4) { 38 | r[0] = (unsigned char) (wc >> 24); 39 | r[1] = (unsigned char) (wc >> 16); 40 | r[2] = (unsigned char) (wc >> 8); 41 | r[3] = (unsigned char) wc; 42 | return 4; 43 | } else 44 | return RET_TOOSMALL; 45 | } 46 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs4internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2000, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-4-INTERNAL = UCS-4 with machine dependent endianness and alignment 22 | */ 23 | 24 | static int 25 | ucs4internal_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | if (n >= 4) { 28 | *pwc = *(const unsigned int *)s; 29 | return 4; 30 | } 31 | return RET_TOOFEW(0); 32 | } 33 | 34 | static int 35 | ucs4internal_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 36 | { 37 | if (n >= 4) { 38 | *(unsigned int *)r = wc; 39 | return 4; 40 | } else 41 | return RET_TOOSMALL; 42 | } 43 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs4le.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2000, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-4LE = UCS-4 little endian 22 | */ 23 | 24 | static int 25 | ucs4le_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | if (n >= 4) { 28 | *pwc = s[0] + (s[1] << 8) + (s[2] << 16) + (s[3] << 24); 29 | return 4; 30 | } 31 | return RET_TOOFEW(0); 32 | } 33 | 34 | static int 35 | ucs4le_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 36 | { 37 | if (n >= 4) { 38 | r[0] = (unsigned char) wc; 39 | r[1] = (unsigned char) (wc >> 8); 40 | r[2] = (unsigned char) (wc >> 16); 41 | r[3] = (unsigned char) (wc >> 24); 42 | return 4; 43 | } else 44 | return RET_TOOSMALL; 45 | } 46 | -------------------------------------------------------------------------------- /deps/libiconv/lib/ucs4swapped.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2000, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UCS-4-SWAPPED = UCS-4-INTERNAL with inverted endianness 22 | */ 23 | 24 | static int 25 | ucs4swapped_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 26 | { 27 | /* This function assumes that 'unsigned int' has exactly 32 bits. */ 28 | if (sizeof(unsigned int) != 4) abort(); 29 | 30 | if (n >= 4) { 31 | unsigned int x = *(const unsigned int *)s; 32 | x = (x >> 24) | ((x >> 8) & 0xff00) | ((x & 0xff00) << 8) | (x << 24); 33 | *pwc = x; 34 | return 4; 35 | } 36 | return RET_TOOFEW(0); 37 | } 38 | 39 | static int 40 | ucs4swapped_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 41 | { 42 | /* This function assumes that 'unsigned int' has exactly 32 bits. */ 43 | if (sizeof(unsigned int) != 4) abort(); 44 | 45 | if (n >= 4) { 46 | unsigned int x = wc; 47 | x = (x >> 24) | ((x >> 8) & 0xff00) | ((x & 0xff00) << 8) | (x << 24); 48 | *(unsigned int *)r = x; 49 | return 4; 50 | } else 51 | return RET_TOOSMALL; 52 | } 53 | -------------------------------------------------------------------------------- /deps/libiconv/lib/utf16.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2008, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UTF-16 22 | */ 23 | 24 | /* Specification: RFC 2781 */ 25 | 26 | /* Here we accept FFFE/FEFF marks as endianness indicators everywhere 27 | in the stream, not just at the beginning. (This is contrary to what 28 | RFC 2781 section 3.2 specifies, but it allows concatenation of byte 29 | sequences to work flawlessly, while disagreeing with the RFC behaviour 30 | only for strings containing U+FEFF characters, which is quite rare.) 31 | The default is big-endian. */ 32 | /* The state is 0 if big-endian, 1 if little-endian. */ 33 | static int 34 | utf16_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 35 | { 36 | state_t state = conv->istate; 37 | int count = 0; 38 | for (; n >= 2 && count <= RET_COUNT_MAX && count <= INT_MAX-2;) { 39 | ucs4_t wc = (state ? s[0] + (s[1] << 8) : (s[0] << 8) + s[1]); 40 | if (wc == 0xfeff) { 41 | } else if (wc == 0xfffe) { 42 | state ^= 1; 43 | } else if (wc >= 0xd800 && wc < 0xdc00) { 44 | if (n >= 4) { 45 | ucs4_t wc2 = (state ? s[2] + (s[3] << 8) : (s[2] << 8) + s[3]); 46 | if (!(wc2 >= 0xdc00 && wc2 < 0xe000)) 47 | goto ilseq; 48 | *pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00); 49 | conv->istate = state; 50 | return count+4; 51 | } else 52 | break; 53 | } else if (wc >= 0xdc00 && wc < 0xe000) { 54 | goto ilseq; 55 | } else { 56 | *pwc = wc; 57 | conv->istate = state; 58 | return count+2; 59 | } 60 | s += 2; n -= 2; count += 2; 61 | } 62 | conv->istate = state; 63 | return RET_TOOFEW(count); 64 | 65 | ilseq: 66 | conv->istate = state; 67 | return RET_SHIFT_ILSEQ(count); 68 | } 69 | 70 | /* We output UTF-16 in big-endian order, with byte-order mark. 71 | See RFC 2781 section 3.3 for a rationale: Some document formats 72 | mandate a BOM; the file concatenation issue is not so severe as 73 | long as the above utf16_mbtowc function is used. */ 74 | /* The state is 0 at the beginning, 1 after the BOM has been written. */ 75 | static int 76 | utf16_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 77 | { 78 | if (wc != 0xfffe && !(wc >= 0xd800 && wc < 0xe000)) { 79 | int count = 0; 80 | if (!conv->ostate) { 81 | if (n >= 2) { 82 | r[0] = 0xFE; 83 | r[1] = 0xFF; 84 | r += 2; n -= 2; count += 2; 85 | } else 86 | return RET_TOOSMALL; 87 | } 88 | if (wc < 0x10000) { 89 | if (n >= 2) { 90 | r[0] = (unsigned char) (wc >> 8); 91 | r[1] = (unsigned char) wc; 92 | conv->ostate = 1; 93 | return count+2; 94 | } else 95 | return RET_TOOSMALL; 96 | } 97 | else if (wc < 0x110000) { 98 | if (n >= 4) { 99 | ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10); 100 | ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff); 101 | r[0] = (unsigned char) (wc1 >> 8); 102 | r[1] = (unsigned char) wc1; 103 | r[2] = (unsigned char) (wc2 >> 8); 104 | r[3] = (unsigned char) wc2; 105 | conv->ostate = 1; 106 | return count+4; 107 | } else 108 | return RET_TOOSMALL; 109 | } 110 | } 111 | return RET_ILUNI; 112 | } 113 | -------------------------------------------------------------------------------- /deps/libiconv/lib/utf16be.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2008, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UTF-16BE 22 | */ 23 | 24 | /* Specification: RFC 2781 */ 25 | 26 | static int 27 | utf16be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 28 | { 29 | int count = 0; 30 | if (n >= 2) { 31 | ucs4_t wc = (s[0] << 8) + s[1]; 32 | if (wc >= 0xd800 && wc < 0xdc00) { 33 | if (n >= 4) { 34 | ucs4_t wc2 = (s[2] << 8) + s[3]; 35 | if (!(wc2 >= 0xdc00 && wc2 < 0xe000)) 36 | goto ilseq; 37 | *pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00); 38 | return count+4; 39 | } 40 | } else if (wc >= 0xdc00 && wc < 0xe000) { 41 | goto ilseq; 42 | } else { 43 | *pwc = wc; 44 | return count+2; 45 | } 46 | } 47 | return RET_TOOFEW(count); 48 | 49 | ilseq: 50 | return RET_SHIFT_ILSEQ(count); 51 | } 52 | 53 | static int 54 | utf16be_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 55 | { 56 | if (!(wc >= 0xd800 && wc < 0xe000)) { 57 | if (wc < 0x10000) { 58 | if (n >= 2) { 59 | r[0] = (unsigned char) (wc >> 8); 60 | r[1] = (unsigned char) wc; 61 | return 2; 62 | } else 63 | return RET_TOOSMALL; 64 | } 65 | else if (wc < 0x110000) { 66 | if (n >= 4) { 67 | ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10); 68 | ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff); 69 | r[0] = (unsigned char) (wc1 >> 8); 70 | r[1] = (unsigned char) wc1; 71 | r[2] = (unsigned char) (wc2 >> 8); 72 | r[3] = (unsigned char) wc2; 73 | return 4; 74 | } else 75 | return RET_TOOSMALL; 76 | } 77 | } 78 | return RET_ILUNI; 79 | } 80 | -------------------------------------------------------------------------------- /deps/libiconv/lib/utf16le.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2008, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UTF-16LE 22 | */ 23 | 24 | /* Specification: RFC 2781 */ 25 | 26 | static int 27 | utf16le_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 28 | { 29 | int count = 0; 30 | if (n >= 2) { 31 | ucs4_t wc = s[0] + (s[1] << 8); 32 | if (wc >= 0xd800 && wc < 0xdc00) { 33 | if (n >= 4) { 34 | ucs4_t wc2 = s[2] + (s[3] << 8); 35 | if (!(wc2 >= 0xdc00 && wc2 < 0xe000)) 36 | goto ilseq; 37 | *pwc = 0x10000 + ((wc - 0xd800) << 10) + (wc2 - 0xdc00); 38 | return count+4; 39 | } 40 | } else if (wc >= 0xdc00 && wc < 0xe000) { 41 | goto ilseq; 42 | } else { 43 | *pwc = wc; 44 | return count+2; 45 | } 46 | } 47 | return RET_TOOFEW(count); 48 | 49 | ilseq: 50 | return RET_SHIFT_ILSEQ(count); 51 | } 52 | 53 | static int 54 | utf16le_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 55 | { 56 | if (!(wc >= 0xd800 && wc < 0xe000)) { 57 | if (wc < 0x10000) { 58 | if (n >= 2) { 59 | r[0] = (unsigned char) wc; 60 | r[1] = (unsigned char) (wc >> 8); 61 | return 2; 62 | } else 63 | return RET_TOOSMALL; 64 | } 65 | else if (wc < 0x110000) { 66 | if (n >= 4) { 67 | ucs4_t wc1 = 0xd800 + ((wc - 0x10000) >> 10); 68 | ucs4_t wc2 = 0xdc00 + ((wc - 0x10000) & 0x3ff); 69 | r[0] = (unsigned char) wc1; 70 | r[1] = (unsigned char) (wc1 >> 8); 71 | r[2] = (unsigned char) wc2; 72 | r[3] = (unsigned char) (wc2 >> 8); 73 | return 4; 74 | } else 75 | return RET_TOOSMALL; 76 | } 77 | } 78 | return RET_ILUNI; 79 | } 80 | -------------------------------------------------------------------------------- /deps/libiconv/lib/utf32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2008, 2011, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UTF-32 22 | */ 23 | 24 | /* Specification: Unicode 3.1 Standard Annex #19 */ 25 | 26 | /* Here we accept FFFE0000/0000FEFF marks as endianness indicators 27 | everywhere in the stream, not just at the beginning. (This is contrary 28 | to what #19 D36c specifies, but it allows concatenation of byte 29 | sequences to work flawlessly, while disagreeing with #19 behaviour 30 | only for strings containing U+FEFF characters, which is quite rare.) 31 | The default is big-endian. */ 32 | /* The state is 0 if big-endian, 1 if little-endian. */ 33 | static int 34 | utf32_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 35 | { 36 | state_t state = conv->istate; 37 | int count = 0; 38 | for (; n >= 4 && count <= RET_COUNT_MAX && count <= INT_MAX-4;) { 39 | ucs4_t wc = (state 40 | ? s[0] + (s[1] << 8) + (s[2] << 16) + (s[3] << 24) 41 | : (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3]); 42 | if (wc == 0x0000feff) { 43 | } else if (wc == 0xfffe0000u) { 44 | state ^= 1; 45 | } else { 46 | if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { 47 | *pwc = wc; 48 | conv->istate = state; 49 | return count+4; 50 | } else { 51 | conv->istate = state; 52 | return RET_SHIFT_ILSEQ(count); 53 | } 54 | } 55 | s += 4; n -= 4; count += 4; 56 | } 57 | conv->istate = state; 58 | return RET_TOOFEW(count); 59 | } 60 | 61 | /* We output UTF-32 in big-endian order, with byte-order mark. */ 62 | /* The state is 0 at the beginning, 1 after the BOM has been written. */ 63 | static int 64 | utf32_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 65 | { 66 | if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { 67 | int count = 0; 68 | if (!conv->ostate) { 69 | if (n >= 4) { 70 | r[0] = 0x00; 71 | r[1] = 0x00; 72 | r[2] = 0xFE; 73 | r[3] = 0xFF; 74 | r += 4; n -= 4; count += 4; 75 | } else 76 | return RET_TOOSMALL; 77 | } 78 | if (wc < 0x110000) { 79 | if (n >= 4) { 80 | r[0] = 0; 81 | r[1] = (unsigned char) (wc >> 16); 82 | r[2] = (unsigned char) (wc >> 8); 83 | r[3] = (unsigned char) wc; 84 | conv->ostate = 1; 85 | return count+4; 86 | } else 87 | return RET_TOOSMALL; 88 | } 89 | } 90 | return RET_ILUNI; 91 | } 92 | -------------------------------------------------------------------------------- /deps/libiconv/lib/utf32be.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UTF-32BE 22 | */ 23 | 24 | /* Specification: Unicode 3.1 Standard Annex #19 */ 25 | 26 | static int 27 | utf32be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 28 | { 29 | if (n >= 4) { 30 | ucs4_t wc = (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + s[3]; 31 | if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { 32 | *pwc = wc; 33 | return 4; 34 | } else 35 | return RET_ILSEQ; 36 | } 37 | return RET_TOOFEW(0); 38 | } 39 | 40 | static int 41 | utf32be_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 42 | { 43 | if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { 44 | if (n >= 4) { 45 | r[0] = 0; 46 | r[1] = (unsigned char) (wc >> 16); 47 | r[2] = (unsigned char) (wc >> 8); 48 | r[3] = (unsigned char) wc; 49 | return 4; 50 | } else 51 | return RET_TOOSMALL; 52 | } 53 | return RET_ILUNI; 54 | } 55 | -------------------------------------------------------------------------------- /deps/libiconv/lib/utf32le.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UTF-32LE 22 | */ 23 | 24 | /* Specification: Unicode 3.1 Standard Annex #19 */ 25 | 26 | static int 27 | utf32le_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 28 | { 29 | if (n >= 4) { 30 | ucs4_t wc = s[0] + (s[1] << 8) + (s[2] << 16) + (s[3] << 24); 31 | if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { 32 | *pwc = wc; 33 | return 4; 34 | } else 35 | return RET_ILSEQ; 36 | } 37 | return RET_TOOFEW(0); 38 | } 39 | 40 | static int 41 | utf32le_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) 42 | { 43 | if (wc < 0x110000 && !(wc >= 0xd800 && wc < 0xe000)) { 44 | if (n >= 4) { 45 | r[0] = (unsigned char) wc; 46 | r[1] = (unsigned char) (wc >> 8); 47 | r[2] = (unsigned char) (wc >> 16); 48 | r[3] = 0; 49 | return 4; 50 | } else 51 | return RET_TOOSMALL; 52 | } 53 | return RET_ILUNI; 54 | } 55 | -------------------------------------------------------------------------------- /deps/libiconv/lib/utf8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2001, 2004, 2016 Free Software Foundation, Inc. 3 | * This file is part of the GNU LIBICONV Library. 4 | * 5 | * The GNU LIBICONV Library is free software; you can redistribute it 6 | * and/or modify it under the terms of the GNU Library General Public 7 | * License as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * The GNU LIBICONV Library is distributed in the hope that it will be 11 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Library General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Library General Public 16 | * License along with the GNU LIBICONV Library; see the file COPYING.LIB. 17 | * If not, see . 18 | */ 19 | 20 | /* 21 | * UTF-8 22 | */ 23 | 24 | /* Specification: RFC 3629 */ 25 | 26 | static int 27 | utf8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n) 28 | { 29 | unsigned char c = s[0]; 30 | 31 | if (c < 0x80) { 32 | *pwc = c; 33 | return 1; 34 | } else if (c < 0xc2) { 35 | return RET_ILSEQ; 36 | } else if (c < 0xe0) { 37 | if (n < 2) 38 | return RET_TOOFEW(0); 39 | if (!((s[1] ^ 0x80) < 0x40)) 40 | return RET_ILSEQ; 41 | *pwc = ((ucs4_t) (c & 0x1f) << 6) 42 | | (ucs4_t) (s[1] ^ 0x80); 43 | return 2; 44 | } else if (c < 0xf0) { 45 | if (n < 3) 46 | return RET_TOOFEW(0); 47 | if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 48 | && (c >= 0xe1 || s[1] >= 0xa0) 49 | && (c != 0xed || s[1] < 0xa0))) 50 | return RET_ILSEQ; 51 | *pwc = ((ucs4_t) (c & 0x0f) << 12) 52 | | ((ucs4_t) (s[1] ^ 0x80) << 6) 53 | | (ucs4_t) (s[2] ^ 0x80); 54 | return 3; 55 | } else if (c < 0xf8 && sizeof(ucs4_t)*8 >= 32) { 56 | if (n < 4) 57 | return RET_TOOFEW(0); 58 | if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 59 | && (s[3] ^ 0x80) < 0x40 60 | && (c >= 0xf1 || s[1] >= 0x90) 61 | && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)))) 62 | return RET_ILSEQ; 63 | *pwc = ((ucs4_t) (c & 0x07) << 18) 64 | | ((ucs4_t) (s[1] ^ 0x80) << 12) 65 | | ((ucs4_t) (s[2] ^ 0x80) << 6) 66 | | (ucs4_t) (s[3] ^ 0x80); 67 | return 4; 68 | } else 69 | return RET_ILSEQ; 70 | } 71 | 72 | static int 73 | utf8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) /* n == 0 is acceptable */ 74 | { 75 | int count; 76 | if (wc < 0x80) 77 | count = 1; 78 | else if (wc < 0x800) 79 | count = 2; 80 | else if (wc < 0x10000) { 81 | if (wc < 0xd800 || wc >= 0xe000) 82 | count = 3; 83 | else 84 | return RET_ILUNI; 85 | } else if (wc < 0x110000) 86 | count = 4; 87 | else 88 | return RET_ILUNI; 89 | if (n < count) 90 | return RET_TOOSMALL; 91 | switch (count) { /* note: code falls through cases! */ 92 | case 4: r[3] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x10000; 93 | case 3: r[2] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x800; 94 | case 2: r[1] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0xc0; 95 | case 1: r[0] = wc; 96 | } 97 | return count; 98 | } 99 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "iconv", 3 | "version": "3.0.1", 4 | "description": "Text recoding in JavaScript for fun and profit!", 5 | "homepage": "https://github.com/bnoordhuis/node-iconv", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/bnoordhuis/node-iconv.git" 9 | }, 10 | "author": { 11 | "name": "Ben Noordhuis", 12 | "email": "info@bnoordhuis.nl" 13 | }, 14 | "engines": { 15 | "node": ">=10.0.0" 16 | }, 17 | "license": "ISC", 18 | "readmeFilename": "README.md", 19 | "scripts": { 20 | "test": "node test/run-tests.js" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /support/config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnoordhuis/node-iconv/885ab019ed3006249307399f9aba076c423104bf/support/config.h -------------------------------------------------------------------------------- /support/localcharset.c: -------------------------------------------------------------------------------- 1 | #include "localcharset.h" 2 | 3 | const char *locale_charset(void) { 4 | return ""; 5 | } 6 | -------------------------------------------------------------------------------- /support/localcharset.h: -------------------------------------------------------------------------------- 1 | extern const char* locale_charset(void); 2 | -------------------------------------------------------------------------------- /test/fixtures/lorem-ipsum.txt: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh 2 | euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad 3 | minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut 4 | aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in 5 | vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla 6 | facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent 7 | luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber 8 | tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod 9 | mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus 10 | legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt 11 | lectores legere me lius quod ii legunt saepius. Claritas est etiam processus 12 | dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam 13 | littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas 14 | humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui 15 | nunc nobis videntur parum clari, fiant sollemnes in futurum. 16 | -------------------------------------------------------------------------------- /test/run-tests.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('./test-basic'); 3 | require('./test-big-buffer'); 4 | require('./test-stream'); 5 | require('./test-worker'); 6 | -------------------------------------------------------------------------------- /test/test-big-buffer.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, Ben Noordhuis 3 | * 4 | * Permission to use, copy, modify, and/or distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | const Iconv = require('../').Iconv; 20 | const assert = require('assert'); 21 | 22 | const iconv = new Iconv('UTF-8', 'UTF-16LE'); 23 | 24 | const utf8 = Buffer.alloc(20000000); 25 | for (let i = 0; i < utf8.length; i++) { 26 | utf8[i] = 97 + i % 26; // cycle from 'a' to 'z'. 27 | } 28 | const utf16 = iconv.convert(utf8); 29 | 30 | assert.equal(utf16.length, utf8.length * 2); 31 | 32 | for (let i = 0; i < utf8.length; ++i) { 33 | assert.equal(utf16[i * 2], utf8[i]); 34 | assert.equal(utf16[i * 2 + 1], 0); 35 | } 36 | -------------------------------------------------------------------------------- /test/test-worker.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, Ben Noordhuis 2 | // 3 | // Permission to use, copy, modify, and/or distribute this software for any 4 | // purpose with or without fee is hereby granted, provided that the above 5 | // copyright notice and this permission notice appear in all copies. 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | // https://github.com/bnoordhuis/node-iconv/issues/211 16 | 17 | 'use strict' 18 | 19 | let workerThreads 20 | try 21 | { 22 | workerThreads = require('worker_threads') // Introduced in v10.5.0. 23 | } 24 | catch (e) 25 | { 26 | return 27 | } 28 | 29 | const {Worker, isMainThread} = workerThreads 30 | const {strictEqual} = require('assert') 31 | 32 | if (isMainThread) 33 | return new Worker(__filename) 34 | 35 | require('./test-basic') 36 | require('./test-big-buffer') 37 | require('./test-stream') 38 | -------------------------------------------------------------------------------- /test/tmp/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | --------------------------------------------------------------------------------