| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CNS 11643-1992 | ||
| */ | ||
|
|
||
| /* ISO-2022-CN and EUC-TW use CNS 11643-1992 planes 1 to 7. We also | ||
| * have a table for the older plane 15. We use a trick to keep the | ||
| * Unicode -> CNS 11643 table as small as possible (see cns11643_inv.h). | ||
| */ | ||
|
|
||
| #include "cns11643_1.h" | ||
| #include "cns11643_2.h" | ||
| #include "cns11643_3.h" | ||
| #include "cns11643_4.h" | ||
| #include "cns11643_5.h" | ||
| #include "cns11643_6.h" | ||
| #include "cns11643_7.h" | ||
| #include "cns11643_15.h" | ||
| #include "cns11643_inv.h" | ||
|
|
||
| /* Returns the plane number (1,...,7,15) in r[0], the two bytes in r[1],r[2]. */ | ||
| #define cns11643_wctomb cns11643_inv_wctomb |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CNS 11643-1992 plane 4 | ||
| */ | ||
|
|
||
| /* | ||
| * The table has been split into two parts. Each part's entries fit it 16 bits. | ||
| * But the combined table would need 17 bits per entry. | ||
| */ | ||
| #include "cns11643_4a.h" | ||
| #include "cns11643_4b.h" | ||
|
|
||
| static int | ||
| cns11643_4_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c1 = s[0]; | ||
| if ((c1 >= 0x21 && c1 <= 0x6e)) { | ||
| if (n >= 2) { | ||
| unsigned char c2 = s[1]; | ||
| if (c2 >= 0x21 && c2 < 0x7f) { | ||
| unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); | ||
| ucs4_t wc = 0xfffd; | ||
| unsigned short swc; | ||
| { | ||
| if (i < 2914) | ||
| swc = cns11643_4a_2uni_page21[i], | ||
| wc = cns11643_4a_2uni_upages[swc>>8] | (swc & 0xff); | ||
| else if (i < 7298) | ||
| swc = cns11643_4b_2uni_page40[i-2914], | ||
| wc = cns11643_4b_2uni_upages[swc>>8] | (swc & 0xff); | ||
| } | ||
| if (wc != 0xfffd) { | ||
| *pwc = wc; | ||
| return 2; | ||
| } | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
| return RET_TOOFEW(0); | ||
| } | ||
| return RET_ILSEQ; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /* lib/config.h. Generated from config.h.in by configure. */ | ||
| /* Copyright (C) 1999-2003, 2005, 2007, 2010 Free Software Foundation, Inc. | ||
| This file is part of the GNU LIBICONV Library. | ||
| The GNU LIBICONV Library is free software; you can redistribute it | ||
| and/or modify it under the terms of the GNU Library General Public | ||
| License as published by the Free Software Foundation; either version 2 | ||
| of the License, or (at your option) any later version. | ||
| The GNU LIBICONV Library is distributed in the hope that it will be | ||
| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Library General Public License for more details. | ||
| You should have received a copy of the GNU Library General Public | ||
| License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
|
|
||
|
|
||
| /* Define to 1 to enable a few rarely used encodings. */ | ||
| /* #undef ENABLE_EXTRA */ | ||
|
|
||
| /* Define to 1 if the package shall run at any location in the filesystem. */ | ||
| /* #undef ENABLE_RELOCATABLE */ | ||
|
|
||
| /* Define to a type if <wchar.h> does not define. */ | ||
| /* #undef mbstate_t */ | ||
|
|
||
| /* Define if you have <iconv.h>, the iconv_t type, and the | ||
| iconv_open, iconv, iconv_close functions. */ | ||
| #define HAVE_ICONV 1 | ||
| /* Define as const if the declaration of iconv() needs const. */ | ||
| #define ICONV_CONST | ||
|
|
||
| /* Define to 1 if you have the getc_unlocked() function. */ | ||
| #define HAVE_GETC_UNLOCKED 1 | ||
|
|
||
| /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ | ||
| #define HAVE_LANGINFO_CODESET 1 | ||
|
|
||
| /* Define if you have the mbrtowc() function. */ | ||
| #define HAVE_MBRTOWC 1 | ||
|
|
||
| /* Define to 1 if you have the setlocale() function. */ | ||
| #define HAVE_SETLOCALE 1 | ||
|
|
||
| /* Define to 1 if you have the <stddef.h> header file. */ | ||
| /* #undef HAVE_STDDEF_H */ | ||
|
|
||
| /* Define to 1 if you have the <stdlib.h> header file. */ | ||
| #define HAVE_STDLIB_H 1 | ||
|
|
||
| /* Define to 1 if you have the <string.h> header file. */ | ||
| #define HAVE_STRING_H 1 | ||
|
|
||
| /* Define to 1 or 0, depending whether the compiler supports simple visibility | ||
| declarations. */ | ||
| #define HAVE_VISIBILITY 1 | ||
|
|
||
| /* Define if you have the wcrtomb() function. */ | ||
| #define HAVE_WCRTOMB 1 | ||
|
|
||
| /* Define to 1 if O_NOFOLLOW works. */ | ||
| #define HAVE_WORKING_O_NOFOLLOW 1 | ||
|
|
||
| /* Define if the machine's byte ordering is little endian. */ | ||
| #define WORDS_LITTLEENDIAN 1 | ||
|
|
||
| /* Define to the value of ${prefix}, as a string. */ | ||
| #define INSTALLPREFIX "/usr/local" | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /* Copyright (C) 1999-2003, 2005, 2007, 2010 Free Software Foundation, Inc. | ||
| This file is part of the GNU LIBICONV Library. | ||
|
|
||
| The GNU LIBICONV Library is free software; you can redistribute it | ||
| and/or modify it under the terms of the GNU Library General Public | ||
| License as published by the Free Software Foundation; either version 2 | ||
| of the License, or (at your option) any later version. | ||
|
|
||
| The GNU LIBICONV Library is distributed in the hope that it will be | ||
| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Library General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU Library General Public | ||
| License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
|
|
||
|
|
||
| /* Define to 1 to enable a few rarely used encodings. */ | ||
| #undef ENABLE_EXTRA | ||
|
|
||
| /* Define to 1 if the package shall run at any location in the filesystem. */ | ||
| #undef ENABLE_RELOCATABLE | ||
|
|
||
| /* Define to a type if <wchar.h> does not define. */ | ||
| #undef mbstate_t | ||
|
|
||
| /* Define if you have <iconv.h>, the iconv_t type, and the | ||
| iconv_open, iconv, iconv_close functions. */ | ||
| #undef HAVE_ICONV | ||
| /* Define as const if the declaration of iconv() needs const. */ | ||
| #define ICONV_CONST /* empty by default */ | ||
|
|
||
| /* Define to 1 if you have the getc_unlocked() function. */ | ||
| #undef HAVE_GETC_UNLOCKED | ||
|
|
||
| /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ | ||
| #undef HAVE_LANGINFO_CODESET | ||
|
|
||
| /* Define if you have the mbrtowc() function. */ | ||
| #undef HAVE_MBRTOWC | ||
|
|
||
| /* Define to 1 if you have the setlocale() function. */ | ||
| #undef HAVE_SETLOCALE | ||
|
|
||
| /* Define to 1 if you have the <stddef.h> header file. */ | ||
| #undef HAVE_STDDEF_H | ||
|
|
||
| /* Define to 1 if you have the <stdlib.h> header file. */ | ||
| #undef HAVE_STDLIB_H | ||
|
|
||
| /* Define to 1 if you have the <string.h> header file. */ | ||
| #undef HAVE_STRING_H | ||
|
|
||
| /* Define to 1 or 0, depending whether the compiler supports simple visibility | ||
| declarations. */ | ||
| #undef HAVE_VISIBILITY | ||
|
|
||
| /* Define if you have the wcrtomb() function. */ | ||
| #undef HAVE_WCRTOMB | ||
|
|
||
| /* Define to 1 if O_NOFOLLOW works. */ | ||
| #undef HAVE_WORKING_O_NOFOLLOW | ||
|
|
||
| /* Define if the machine's byte ordering is little endian. */ | ||
| #undef WORDS_LITTLEENDIAN | ||
|
|
||
| /* Define to the value of ${prefix}, as a string. */ | ||
| #undef INSTALLPREFIX | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,298 @@ | ||
| /* | ||
| * Copyright (C) 1999-2002, 2004-2010 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* This file defines all the converters. */ | ||
|
|
||
|
|
||
| /* Our own notion of wide character, as UCS-4, according to ISO-10646-1. */ | ||
| typedef unsigned int ucs4_t; | ||
|
|
||
| /* State used by a conversion. 0 denotes the initial state. */ | ||
| typedef unsigned int state_t; | ||
|
|
||
| /* iconv_t is an opaque type. This is the real iconv_t type. */ | ||
| typedef struct conv_struct * conv_t; | ||
|
|
||
| /* | ||
| * Data type for conversion multibyte -> unicode | ||
| */ | ||
| struct mbtowc_funcs { | ||
| int (*xxx_mbtowc) (conv_t conv, ucs4_t *pwc, unsigned char const *s, int n); | ||
| /* | ||
| * int xxx_mbtowc (conv_t conv, ucs4_t *pwc, unsigned char const *s, int n) | ||
| * converts the byte sequence starting at s to a wide character. Up to n bytes | ||
| * are available at s. n is >= 1. | ||
| * Result is number of bytes consumed (if a wide character was read), | ||
| * or -1 if invalid, or -2 if n too small, or -2-(number of bytes consumed) | ||
| * if only a shift sequence was read. | ||
| */ | ||
| int (*xxx_flushwc) (conv_t conv, ucs4_t *pwc); | ||
| /* | ||
| * int xxx_flushwc (conv_t conv, ucs4_t *pwc) | ||
| * returns to the initial state and stores the pending wide character, if any. | ||
| * Result is 1 (if a wide character was read) or 0 if none was pending. | ||
| */ | ||
| }; | ||
|
|
||
| /* Return code if invalid input after a shift sequence of n bytes was read. | ||
| (xxx_mbtowc) */ | ||
| #define RET_SHIFT_ILSEQ(n) (-1-2*(n)) | ||
| /* Return code if invalid. (xxx_mbtowc) */ | ||
| #define RET_ILSEQ RET_SHIFT_ILSEQ(0) | ||
| /* Return code if only a shift sequence of n bytes was read. (xxx_mbtowc) */ | ||
| #define RET_TOOFEW(n) (-2-2*(n)) | ||
| /* Retrieve the n from the encoded RET_... value. */ | ||
| #define DECODE_SHIFT_ILSEQ(r) ((unsigned int)(RET_SHIFT_ILSEQ(0) - (r)) / 2) | ||
| #define DECODE_TOOFEW(r) ((unsigned int)(RET_TOOFEW(0) - (r)) / 2) | ||
|
|
||
| /* | ||
| * Data type for conversion unicode -> multibyte | ||
| */ | ||
| struct wctomb_funcs { | ||
| int (*xxx_wctomb) (conv_t conv, unsigned char *r, ucs4_t wc, int n); | ||
| /* | ||
| * int xxx_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| * converts the wide character wc to the character set xxx, and stores the | ||
| * result beginning at r. Up to n bytes may be written at r. n is >= 1. | ||
| * Result is number of bytes written, or -1 if invalid, or -2 if n too small. | ||
| */ | ||
| int (*xxx_reset) (conv_t conv, unsigned char *r, int n); | ||
| /* | ||
| * int xxx_reset (conv_t conv, unsigned char *r, int n) | ||
| * stores a shift sequences returning to the initial state beginning at r. | ||
| * Up to n bytes may be written at r. n is >= 0. | ||
| * Result is number of bytes written, or -2 if n too small. | ||
| */ | ||
| }; | ||
|
|
||
| /* Return code if invalid. (xxx_wctomb) */ | ||
| #define RET_ILUNI -1 | ||
| /* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */ | ||
| #define RET_TOOSMALL -2 | ||
|
|
||
| /* | ||
| * Contents of a conversion descriptor. | ||
| */ | ||
| struct conv_struct { | ||
| struct loop_funcs lfuncs; | ||
| /* Input (conversion multibyte -> unicode) */ | ||
| int iindex; | ||
| struct mbtowc_funcs ifuncs; | ||
| state_t istate; | ||
| /* Output (conversion unicode -> multibyte) */ | ||
| int oindex; | ||
| struct wctomb_funcs ofuncs; | ||
| int oflags; | ||
| state_t ostate; | ||
| /* Operation flags */ | ||
| int transliterate; | ||
| int discard_ilseq; | ||
| #ifndef LIBICONV_PLUG | ||
| struct iconv_fallbacks fallbacks; | ||
| struct iconv_hooks hooks; | ||
| #endif | ||
| }; | ||
|
|
||
| /* | ||
| * Include all the converters. | ||
| */ | ||
|
|
||
| #include "ascii.h" | ||
|
|
||
| /* General multi-byte encodings */ | ||
| #include "utf8.h" | ||
| #include "ucs2.h" | ||
| #include "ucs2be.h" | ||
| #include "ucs2le.h" | ||
| #include "ucs4.h" | ||
| #include "ucs4be.h" | ||
| #include "ucs4le.h" | ||
| #include "utf16.h" | ||
| #include "utf16be.h" | ||
| #include "utf16le.h" | ||
| #include "utf32.h" | ||
| #include "utf32be.h" | ||
| #include "utf32le.h" | ||
| #include "utf7.h" | ||
| #include "ucs2internal.h" | ||
| #include "ucs2swapped.h" | ||
| #include "ucs4internal.h" | ||
| #include "ucs4swapped.h" | ||
| #include "c99.h" | ||
| #include "java.h" | ||
|
|
||
| /* 8-bit encodings */ | ||
| #include "iso8859_1.h" | ||
| #include "iso8859_2.h" | ||
| #include "iso8859_3.h" | ||
| #include "iso8859_4.h" | ||
| #include "iso8859_5.h" | ||
| #include "iso8859_6.h" | ||
| #include "iso8859_7.h" | ||
| #include "iso8859_8.h" | ||
| #include "iso8859_9.h" | ||
| #include "iso8859_10.h" | ||
| #include "iso8859_11.h" | ||
| #include "iso8859_13.h" | ||
| #include "iso8859_14.h" | ||
| #include "iso8859_15.h" | ||
| #include "iso8859_16.h" | ||
| #include "koi8_r.h" | ||
| #include "koi8_u.h" | ||
| #include "koi8_ru.h" | ||
| #include "cp1250.h" | ||
| #include "cp1251.h" | ||
| #include "cp1252.h" | ||
| #include "cp1253.h" | ||
| #include "cp1254.h" | ||
| #include "cp1255.h" | ||
| #include "cp1256.h" | ||
| #include "cp1257.h" | ||
| #include "cp1258.h" | ||
| #include "cp850.h" | ||
| #include "cp862.h" | ||
| #include "cp866.h" | ||
| #include "cp1131.h" | ||
| #include "mac_roman.h" | ||
| #include "mac_centraleurope.h" | ||
| #include "mac_iceland.h" | ||
| #include "mac_croatian.h" | ||
| #include "mac_romania.h" | ||
| #include "mac_cyrillic.h" | ||
| #include "mac_ukraine.h" | ||
| #include "mac_greek.h" | ||
| #include "mac_turkish.h" | ||
| #include "mac_hebrew.h" | ||
| #include "mac_arabic.h" | ||
| #include "mac_thai.h" | ||
| #include "hp_roman8.h" | ||
| #include "nextstep.h" | ||
| #include "armscii_8.h" | ||
| #include "georgian_academy.h" | ||
| #include "georgian_ps.h" | ||
| #include "koi8_t.h" | ||
| #include "pt154.h" | ||
| #include "rk1048.h" | ||
| #include "mulelao.h" | ||
| #include "cp1133.h" | ||
| #include "tis620.h" | ||
| #include "cp874.h" | ||
| #include "viscii.h" | ||
| #include "tcvn.h" | ||
|
|
||
| /* CJK character sets [CCS = coded character set] [CJKV.INF chapter 3] */ | ||
|
|
||
| typedef struct { | ||
| unsigned short indx; /* index into big table */ | ||
| unsigned short used; /* bitmask of used entries */ | ||
| } Summary16; | ||
|
|
||
| #include "iso646_jp.h" | ||
| #include "jisx0201.h" | ||
| #include "jisx0208.h" | ||
| #include "jisx0212.h" | ||
|
|
||
| #include "iso646_cn.h" | ||
| #include "gb2312.h" | ||
| #include "isoir165.h" | ||
| /*#include "gb12345.h"*/ | ||
| #include "gbk.h" | ||
| #include "cns11643.h" | ||
| #include "big5.h" | ||
|
|
||
| #include "ksc5601.h" | ||
| #include "johab_hangul.h" | ||
|
|
||
| /* CJK encodings [CES = character encoding scheme] [CJKV.INF chapter 4] */ | ||
|
|
||
| #include "euc_jp.h" | ||
| #include "sjis.h" | ||
| #include "cp932.h" | ||
| #include "iso2022_jp.h" | ||
| #include "iso2022_jp1.h" | ||
| #include "iso2022_jp2.h" | ||
|
|
||
| #include "euc_cn.h" | ||
| #include "ces_gbk.h" | ||
| #include "cp936.h" | ||
| #include "gb18030.h" | ||
| #include "iso2022_cn.h" | ||
| #include "iso2022_cnext.h" | ||
| #include "hz.h" | ||
| #include "euc_tw.h" | ||
| #include "ces_big5.h" | ||
| #include "cp950.h" | ||
| #include "big5hkscs1999.h" | ||
| #include "big5hkscs2001.h" | ||
| #include "big5hkscs2004.h" | ||
| #include "big5hkscs2008.h" | ||
|
|
||
| #include "euc_kr.h" | ||
| #include "cp949.h" | ||
| #include "johab.h" | ||
| #include "iso2022_kr.h" | ||
|
|
||
| /* Encodings used by system dependent locales. */ | ||
|
|
||
| #ifdef USE_AIX | ||
| #include "cp856.h" | ||
| #include "cp922.h" | ||
| #include "cp943.h" | ||
| #include "cp1046.h" | ||
| #include "cp1124.h" | ||
| #include "cp1129.h" | ||
| #include "cp1161.h" | ||
| #include "cp1162.h" | ||
| #include "cp1163.h" | ||
| #endif | ||
|
|
||
| #ifdef USE_OSF1 | ||
| #include "dec_kanji.h" | ||
| #include "dec_hanyu.h" | ||
| #endif | ||
|
|
||
| #ifdef USE_DOS | ||
| #include "cp437.h" | ||
| #include "cp737.h" | ||
| #include "cp775.h" | ||
| #include "cp852.h" | ||
| #include "cp853.h" | ||
| #include "cp855.h" | ||
| #include "cp857.h" | ||
| #include "cp858.h" | ||
| #include "cp860.h" | ||
| #include "cp861.h" | ||
| #include "cp863.h" | ||
| #include "cp864.h" | ||
| #include "cp865.h" | ||
| #include "cp869.h" | ||
| #include "cp1125.h" | ||
| #endif | ||
|
|
||
| #ifdef USE_EXTRA | ||
| #include "euc_jisx0213.h" | ||
| #include "shift_jisx0213.h" | ||
| #include "iso2022_jp3.h" | ||
| #include "big5_2003.h" | ||
| #include "tds565.h" | ||
| #include "atarist.h" | ||
| #include "riscos1.h" | ||
| #endif | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1046 | ||
| */ | ||
|
|
||
| static const unsigned short cp1046_2uni[128] = { | ||
| /* 0x80 */ | ||
| 0xfe88, 0x00d7, 0x00f7, 0xf8f6, 0xf8f5, 0xf8f4, 0xf8f7, 0xfe71, | ||
| 0x0088, 0x25a0, 0x2502, 0x2500, 0x2510, 0x250c, 0x2514, 0x2518, | ||
| /* 0x90 */ | ||
| 0xfe79, 0xfe7b, 0xfe7d, 0xfe7f, 0xfe77, 0xfe8a, 0xfef0, 0xfef3, | ||
| 0xfef2, 0xfece, 0xfecf, 0xfed0, 0xfef6, 0xfef8, 0xfefa, 0xfefc, | ||
| /* 0xa0 */ | ||
| 0x00a0, 0xf8fa, 0xf8f9, 0xf8f8, 0x00a4, 0xf8fb, 0xfe8b, 0xfe91, | ||
| 0xfe97, 0xfe9b, 0xfe9f, 0xfea3, 0x060c, 0x00ad, 0xfea7, 0xfeb3, | ||
| /* 0xb0 */ | ||
| 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, | ||
| 0x0668, 0x0669, 0xfeb7, 0x061b, 0xfebb, 0xfebf, 0xfeca, 0x061f, | ||
| /* 0xc0 */ | ||
| 0xfecb, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, | ||
| 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, | ||
| /* 0xd0 */ | ||
| 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, | ||
| 0xfec7, 0x0639, 0x063a, 0xfecc, 0xfe82, 0xfe84, 0xfe8e, 0xfed3, | ||
| /* 0xe0 */ | ||
| 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, | ||
| 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, | ||
| /* 0xf0 */ | ||
| 0x0650, 0x0651, 0x0652, 0xfed7, 0xfedb, 0xfedf, 0xf8fc, 0xfef5, | ||
| 0xfef7, 0xfef9, 0xfefb, 0xfee3, 0xfee7, 0xfeec, 0xfee9, 0xfffd, | ||
| }; | ||
|
|
||
| static int | ||
| cp1046_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else { | ||
| unsigned short wc = cp1046_2uni[c-0x80]; | ||
| if (wc != 0xfffd) { | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
|
|
||
| static const unsigned char cp1046_page00[112] = { | ||
| 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ | ||
| 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, /* 0xd0-0xd7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, /* 0xf0-0xf7 */ | ||
| }; | ||
| static const unsigned char cp1046_page06[104] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ | ||
| 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ | ||
| 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ | ||
| 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ | ||
| 0x00, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ | ||
| 0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ | ||
| 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x60-0x67 */ | ||
| 0xb8, 0xb9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| }; | ||
| static const unsigned char cp1046_page25[32] = { | ||
| 0x8b, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, /* 0x08-0x0f */ | ||
| 0x8c, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ | ||
| }; | ||
| static const unsigned char cp1046_pagef8[16] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0x85, 0x84, 0x83, 0x86, /* 0xf0-0xf7 */ | ||
| 0xa3, 0xa2, 0xa1, 0xa5, 0xf6, 0x00, 0x00, 0x00, /* 0xf8-0xff */ | ||
| }; | ||
| static const unsigned char cp1046_pagefe[144] = { | ||
| 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, /* 0x70-0x77 */ | ||
| 0x00, 0x90, 0x00, 0x91, 0x00, 0x92, 0x00, 0x93, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0xdc, 0x00, 0xdd, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0x80, 0x00, 0x95, 0xa6, 0x00, 0x00, 0xde, 0x00, /* 0x88-0x8f */ | ||
| 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, /* 0x90-0x97 */ | ||
| 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0xaa, /* 0x98-0x9f */ | ||
| 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0xae, /* 0xa0-0xa7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ | ||
| 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0xba, /* 0xb0-0xb7 */ | ||
| 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xbd, /* 0xb8-0xbf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0xbe, 0xc0, 0xdb, 0x00, 0x99, 0x9a, /* 0xc8-0xcf */ | ||
| 0x9b, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0xf3, /* 0xd0-0xd7 */ | ||
| 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xf5, /* 0xd8-0xdf */ | ||
| 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0xfc, /* 0xe0-0xe7 */ | ||
| 0x00, 0xfe, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xe8-0xef */ | ||
| 0x96, 0x00, 0x98, 0x97, 0x00, 0xf7, 0x9c, 0xf8, /* 0xf0-0xf7 */ | ||
| 0x9d, 0xf9, 0x9e, 0xfa, 0x9f, 0x00, 0x00, 0x00, /* 0xf8-0xff */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1046_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x0088 && wc < 0x00f8) | ||
| c = cp1046_page00[wc-0x0088]; | ||
| else if (wc >= 0x0608 && wc < 0x0670) | ||
| c = cp1046_page06[wc-0x0608]; | ||
| else if (wc >= 0x2500 && wc < 0x2520) | ||
| c = cp1046_page25[wc-0x2500]; | ||
| else if (wc == 0x25a0) | ||
| c = 0x89; | ||
| else if (wc >= 0xf8f0 && wc < 0xf900) | ||
| c = cp1046_pagef8[wc-0xf8f0]; | ||
| else if (wc >= 0xfe70 && wc < 0xff00) | ||
| c = cp1046_pagefe[wc-0xfe70]; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1124 | ||
| */ | ||
|
|
||
| static const unsigned short cp1124_2uni[96] = { | ||
| /* 0xa0 */ | ||
| 0x00a0, 0x0401, 0x0402, 0x0490, 0x0404, 0x0405, 0x0406, 0x0407, | ||
| 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, | ||
| /* 0xb0 */ | ||
| 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, | ||
| 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, | ||
| /* 0xc0 */ | ||
| 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, | ||
| 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, | ||
| /* 0xd0 */ | ||
| 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, | ||
| 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, | ||
| /* 0xe0 */ | ||
| 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, | ||
| 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, | ||
| /* 0xf0 */ | ||
| 0x2116, 0x0451, 0x0452, 0x0491, 0x0454, 0x0455, 0x0456, 0x0457, | ||
| 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, | ||
| }; | ||
|
|
||
| static int | ||
| cp1124_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0xa0) | ||
| *pwc = (ucs4_t) c; | ||
| else | ||
| *pwc = (ucs4_t) cp1124_2uni[c-0xa0]; | ||
| return 1; | ||
| } | ||
|
|
||
| static const unsigned char cp1124_page00[16] = { | ||
| 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, /* 0xa0-0xa7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ | ||
| }; | ||
| static const unsigned char cp1124_page04[152] = { | ||
| 0x00, 0xa1, 0xa2, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ | ||
| 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */ | ||
| 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ | ||
| 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ | ||
| 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ | ||
| 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ | ||
| 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ | ||
| 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x38-0x3f */ | ||
| 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ | ||
| 0x00, 0xf1, 0xf2, 0x00, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ | ||
| 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0xa3, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1124_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x00a0) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x00b0) | ||
| c = cp1124_page00[wc-0x00a0]; | ||
| else if (wc >= 0x0400 && wc < 0x0498) | ||
| c = cp1124_page04[wc-0x0400]; | ||
| else if (wc == 0x2116) | ||
| c = 0xf0; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1125 | ||
| */ | ||
|
|
||
| static const unsigned short cp1125_2uni[80] = { | ||
| /* 0xb0 */ | ||
| 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, | ||
| 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, | ||
| /* 0xc0 */ | ||
| 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, | ||
| 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, | ||
| /* 0xd0 */ | ||
| 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, | ||
| 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, | ||
| /* 0xe0 */ | ||
| 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, | ||
| 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, | ||
| /* 0xf0 */ | ||
| 0x0401, 0x0451, 0x0490, 0x0491, 0x0404, 0x0454, 0x0406, 0x0456, | ||
| 0x0407, 0x0457, 0x00b7, 0x221a, 0x2116, 0x00a4, 0x25a0, 0x00a0, | ||
| }; | ||
|
|
||
| static int | ||
| cp1125_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) | ||
| *pwc = (ucs4_t) c; | ||
| else if (c < 0xb0) | ||
| *pwc = (ucs4_t) c + 0x0390; | ||
| else | ||
| *pwc = (ucs4_t) cp1125_2uni[c-0xb0]; | ||
| return 1; | ||
| } | ||
|
|
||
| static const unsigned char cp1125_page00[24] = { | ||
| 0xff, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, /* 0xb0-0xb7 */ | ||
| }; | ||
| static const unsigned char cp1125_page04[152] = { | ||
| 0x00, 0xf0, 0x00, 0x00, 0xf4, 0x00, 0xf6, 0xf8, /* 0x00-0x07 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ | ||
| 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x10-0x17 */ | ||
| 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x18-0x1f */ | ||
| 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x20-0x27 */ | ||
| 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x28-0x2f */ | ||
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x30-0x37 */ | ||
| 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x38-0x3f */ | ||
| 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ | ||
| 0x00, 0xf1, 0x00, 0x00, 0xf5, 0x00, 0xf7, 0xf9, /* 0x50-0x57 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0xf2, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| }; | ||
| static const unsigned char cp1125_page25[168] = { | ||
| 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ | ||
| 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0xd9, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, /* 0x18-0x1f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ | ||
| 0xcd, 0xba, 0xd5, 0xd6, 0xc9, 0xb8, 0xb7, 0xbb, /* 0x50-0x57 */ | ||
| 0xd4, 0xd3, 0xc8, 0xbe, 0xbd, 0xbc, 0xc6, 0xc7, /* 0x58-0x5f */ | ||
| 0xcc, 0xb5, 0xb6, 0xb9, 0xd1, 0xd2, 0xcb, 0xcf, /* 0x60-0x67 */ | ||
| 0xd0, 0xca, 0xd8, 0xd7, 0xce, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ | ||
| 0xdf, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0xdb, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0xde, 0xb0, 0xb1, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ | ||
| 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1125_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x00b8) | ||
| c = cp1125_page00[wc-0x00a0]; | ||
| else if (wc >= 0x0400 && wc < 0x0498) | ||
| c = cp1125_page04[wc-0x0400]; | ||
| else if (wc == 0x2116) | ||
| c = 0xfc; | ||
| else if (wc == 0x221a) | ||
| c = 0xfb; | ||
| else if (wc >= 0x2500 && wc < 0x25a8) | ||
| c = cp1125_page25[wc-0x2500]; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1129 | ||
| */ | ||
|
|
||
| static const unsigned short cp1129_2uni[96] = { | ||
| /* 0xa0 */ | ||
| 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, | ||
| 0x0153, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, | ||
| /* 0xb0 */ | ||
| 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0178, 0x00b5, 0x00b6, 0x00b7, | ||
| 0x0152, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, | ||
| /* 0xc0 */ | ||
| 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x00c5, 0x00c6, 0x00c7, | ||
| 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x0300, 0x00cd, 0x00ce, 0x00cf, | ||
| /* 0xd0 */ | ||
| 0x0110, 0x00d1, 0x0309, 0x00d3, 0x00d4, 0x01a0, 0x00d6, 0x00d7, | ||
| 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x01af, 0x0303, 0x00df, | ||
| /* 0xe0 */ | ||
| 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x00e5, 0x00e6, 0x00e7, | ||
| 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0301, 0x00ed, 0x00ee, 0x00ef, | ||
| /* 0xf0 */ | ||
| 0x0111, 0x00f1, 0x0323, 0x00f3, 0x00f4, 0x01a1, 0x00f6, 0x00f7, | ||
| 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x01b0, 0x20ab, 0x00ff, | ||
| }; | ||
|
|
||
| static int | ||
| cp1129_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0xa0) | ||
| *pwc = (ucs4_t) c; | ||
| else | ||
| *pwc = (ucs4_t) cp1129_2uni[c-0xa0]; | ||
| return 1; | ||
| } | ||
|
|
||
| static const unsigned char cp1129_page00[272] = { | ||
| 0x00, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ | ||
| 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ | ||
| 0x00, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ | ||
| 0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ | ||
| 0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ | ||
| 0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ | ||
| 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ | ||
| 0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */ | ||
| 0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ | ||
| 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ | ||
| /* 0x0100 */ | ||
| 0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ | ||
| 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ | ||
| 0x00, 0x00, 0xb8, 0xa8, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ | ||
| 0xd5, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdd, /* 0xa8-0xaf */ | ||
| 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ | ||
| }; | ||
| static const unsigned char cp1129_page03[40] = { | ||
| 0xcc, 0xec, 0x00, 0xde, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ | ||
| 0x00, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ | ||
| 0x00, 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1129_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x00a8) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a8 && wc < 0x01b8) | ||
| c = cp1129_page00[wc-0x00a8]; | ||
| else if (wc >= 0x0300 && wc < 0x0328) | ||
| c = cp1129_page03[wc-0x0300]; | ||
| else if (wc == 0x20ab) | ||
| c = 0xfe; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| /* | ||
| * Copyright (C) 1999-2002 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1131 | ||
| */ | ||
|
|
||
| static const unsigned short cp1131_2uni[128] = { | ||
| /* 0x80 */ | ||
| 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, | ||
| 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, | ||
| /* 0x90 */ | ||
| 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, | ||
| 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, | ||
| /* 0xa0 */ | ||
| 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, | ||
| 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, | ||
| /* 0xb0 */ | ||
| 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, | ||
| 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510, | ||
| /* 0xc0 */ | ||
| 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, | ||
| 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567, | ||
| /* 0xd0 */ | ||
| 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, | ||
| 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580, | ||
| /* 0xe0 */ | ||
| 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, | ||
| 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, | ||
| /* 0xf0 */ | ||
| 0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040e, 0x045e, | ||
| 0x0406, 0x0456, 0x00b7, 0x00a4, 0x0490, 0x0491, 0x2219, 0x00a0, | ||
| }; | ||
|
|
||
| static int | ||
| cp1131_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) | ||
| *pwc = (ucs4_t) c; | ||
| else | ||
| *pwc = (ucs4_t) cp1131_2uni[c-0x80]; | ||
| return 1; | ||
| } | ||
|
|
||
| static const unsigned char cp1131_page00[24] = { | ||
| 0xff, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, /* 0xb0-0xb7 */ | ||
| }; | ||
| static const unsigned char cp1131_page04[152] = { | ||
| 0x00, 0xf0, 0x00, 0x00, 0xf2, 0x00, 0xf8, 0xf4, /* 0x00-0x07 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x00, /* 0x08-0x0f */ | ||
| 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x10-0x17 */ | ||
| 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x18-0x1f */ | ||
| 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x20-0x27 */ | ||
| 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x28-0x2f */ | ||
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x30-0x37 */ | ||
| 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x38-0x3f */ | ||
| 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ | ||
| 0x00, 0xf1, 0x00, 0x00, 0xf3, 0x00, 0xf9, 0xf5, /* 0x50-0x57 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, /* 0x58-0x5f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0xfc, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| }; | ||
| static const unsigned char cp1131_page25[152] = { | ||
| 0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */ | ||
| 0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0xd9, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, /* 0x18-0x1f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ | ||
| 0xcd, 0xba, 0xd5, 0xd6, 0xc9, 0xb8, 0xb7, 0xbb, /* 0x50-0x57 */ | ||
| 0xd4, 0xd3, 0xc8, 0xbe, 0xbd, 0xbc, 0xc6, 0xc7, /* 0x58-0x5f */ | ||
| 0xcc, 0xb5, 0xb6, 0xb9, 0xd1, 0xd2, 0xcb, 0xcf, /* 0x60-0x67 */ | ||
| 0xd0, 0xca, 0xd8, 0xd7, 0xce, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ | ||
| 0xdf, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0xdb, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0xde, 0xb0, 0xb1, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1131_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x00b8) | ||
| c = cp1131_page00[wc-0x00a0]; | ||
| else if (wc >= 0x0400 && wc < 0x0498) | ||
| c = cp1131_page04[wc-0x0400]; | ||
| else if (wc == 0x2219) | ||
| c = 0xfe; | ||
| else if (wc >= 0x2500 && wc < 0x2598) | ||
| c = cp1131_page25[wc-0x2500]; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * IBM-CP1133 | ||
| */ | ||
|
|
||
| static const unsigned short cp1133_2uni_1[64] = { | ||
| /* 0xa0 */ | ||
| 0x00a0, 0x0e81, 0x0e82, 0x0e84, 0x0e87, 0x0e88, 0x0eaa, 0x0e8a, | ||
| 0x0e8d, 0x0e94, 0x0e95, 0x0e96, 0x0e97, 0x0e99, 0x0e9a, 0x0e9b, | ||
| /* 0xb0 */ | ||
| 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, 0x0ea1, 0x0ea2, 0x0ea3, 0x0ea5, | ||
| 0x0ea7, 0x0eab, 0x0ead, 0x0eae, 0xfffd, 0xfffd, 0xfffd, 0x0eaf, | ||
| /* 0xc0 */ | ||
| 0x0eb0, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, 0x0eb8, | ||
| 0x0eb9, 0x0ebc, 0x0eb1, 0x0ebb, 0x0ebd, 0xfffd, 0xfffd, 0xfffd, | ||
| /* 0xd0 */ | ||
| 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0x0ec8, 0x0ec9, 0x0eca, | ||
| 0x0ecb, 0x0ecc, 0x0ecd, 0x0ec6, 0xfffd, 0x0edc, 0x0edd, 0x20ad, | ||
| }; | ||
| static const unsigned short cp1133_2uni_2[16] = { | ||
| /* 0xf0 */ | ||
| 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, | ||
| 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x00a2, 0x00ac, 0x00a6, 0xfffd, | ||
| }; | ||
|
|
||
| static int | ||
| cp1133_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0xa0) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else if (c < 0xe0) { | ||
| unsigned short wc = cp1133_2uni_1[c-0xa0]; | ||
| if (wc != 0xfffd) { | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| } | ||
| else if (c < 0xf0) { | ||
| } | ||
| else { | ||
| unsigned short wc = cp1133_2uni_2[c-0xf0]; | ||
| if (wc != 0xfffd) { | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
|
|
||
| static const unsigned char cp1133_page00[16] = { | ||
| 0xa0, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfe, 0x00, /* 0xa0-0xa7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ | ||
| }; | ||
| static const unsigned char cp1133_page0e[96] = { | ||
| 0x00, 0xa1, 0xa2, 0x00, 0xa3, 0x00, 0x00, 0xa4, /* 0x80-0x87 */ | ||
| 0xa5, 0x00, 0xa7, 0x00, 0x00, 0xa8, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xa9, 0xaa, 0xab, 0xac, /* 0x90-0x97 */ | ||
| 0x00, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, /* 0x98-0x9f */ | ||
| 0x00, 0xb4, 0xb5, 0xb6, 0x00, 0xb7, 0x00, 0xb8, /* 0xa0-0xa7 */ | ||
| 0x00, 0x00, 0xa6, 0xb9, 0x00, 0xba, 0xbb, 0xbf, /* 0xa8-0xaf */ | ||
| 0xc0, 0xca, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, /* 0xb0-0xb7 */ | ||
| 0xc7, 0xc8, 0x00, 0xcb, 0xc9, 0xcc, 0x00, 0x00, /* 0xb8-0xbf */ | ||
| 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xdb, 0x00, /* 0xc0-0xc7 */ | ||
| 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ | ||
| 0xf8, 0xf9, 0x00, 0x00, 0xdd, 0xde, 0x00, 0x00, /* 0xd8-0xdf */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1133_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x00a0) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x00b0) | ||
| c = cp1133_page00[wc-0x00a0]; | ||
| else if (wc >= 0x0e80 && wc < 0x0ee0) | ||
| c = cp1133_page0e[wc-0x0e80]; | ||
| else if (wc == 0x20ad) | ||
| c = 0xdf; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /* | ||
| * Copyright (C) 1999-2002 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1161 | ||
| */ | ||
|
|
||
| static const unsigned short cp1161_2uni[96] = { | ||
| /* 0xa0 */ | ||
| 0x0e48, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, | ||
| 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, | ||
| /* 0xb0 */ | ||
| 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, | ||
| 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, | ||
| /* 0xc0 */ | ||
| 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, | ||
| 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, | ||
| /* 0xd0 */ | ||
| 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, | ||
| 0x0e38, 0x0e39, 0x0e3a, 0x0e49, 0x0e4a, 0x0e4b, 0x20ac, 0x0e3f, | ||
| /* 0xe0 */ | ||
| 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, | ||
| 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, | ||
| /* 0xf0 */ | ||
| 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, | ||
| 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x00a2, 0x00ac, 0x00a6, 0x00a0, | ||
| }; | ||
|
|
||
| static int | ||
| cp1161_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else if (c < 0xa0) { | ||
| } | ||
| else { | ||
| *pwc = (ucs4_t) cp1161_2uni[c-0xa0]; | ||
| return 1; | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
|
|
||
| static const unsigned char cp1161_page00[16] = { | ||
| 0xff, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfe, 0x00, /* 0xa0-0xa7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1161_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x00b0) | ||
| c = cp1161_page00[wc-0x00a0]; | ||
| else if (wc >= 0x0e48 && wc < 0x0e4c) | ||
| c = wc-0x0d60; | ||
| else if (wc >= 0x0e00 && wc < 0x0e60) | ||
| c = cp874_page0e[wc-0x0e00]; | ||
| else if (wc == 0x20ac) | ||
| c = 0xde; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * Copyright (C) 1999-2002 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1162 | ||
| */ | ||
|
|
||
| static int | ||
| cp1162_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else { | ||
| unsigned short wc = cp874_2uni[c-0x80]; | ||
| if (wc != 0xfffd) { | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| if (c < 0xa0) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
|
|
||
| static int | ||
| cp1162_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x0080 && wc < 0x00a0 && cp874_2uni[wc-0x0080] == 0xfffd) | ||
| c = wc; | ||
| else if (wc == 0x00a0) | ||
| c = 0xa0; | ||
| else if (wc >= 0x0e00 && wc < 0x0e60) | ||
| c = cp874_page0e[wc-0x0e00]; | ||
| else if (wc >= 0x2010 && wc < 0x2028) | ||
| c = cp874_page20[wc-0x2010]; | ||
| else if (wc == 0x20ac) | ||
| c = 0x80; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * Copyright (C) 1999-2002 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1163 | ||
| */ | ||
|
|
||
| static int | ||
| cp1163_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0xa0) | ||
| *pwc = (ucs4_t) c; | ||
| else if (c == 0xa4) | ||
| *pwc = 0x20ac; | ||
| else | ||
| *pwc = (ucs4_t) cp1129_2uni[c-0xa0]; | ||
| return 1; | ||
| } | ||
|
|
||
| static const unsigned char cp1163_page20[8] = { | ||
| 0x00, 0x00, 0x00, 0xfe, 0xa4, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1163_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x00a0 || (wc < 0x00a8 && wc != 0x00a4) || wc == 0x00d0) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a8 && wc < 0x01b8) | ||
| c = cp1129_page00[wc-0x00a8]; | ||
| else if (wc >= 0x0300 && wc < 0x0328) | ||
| c = cp1129_page03[wc-0x0300]; | ||
| else if (wc == 0x203e) | ||
| c = 0xaf; | ||
| else if (wc >= 0x20a8 && wc < 0x20b0) | ||
| c = cp1163_page20[wc-0x20a8]; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1250 | ||
| */ | ||
|
|
||
| static const unsigned short cp1250_2uni[128] = { | ||
| /* 0x80 */ | ||
| 0x20ac, 0xfffd, 0x201a, 0xfffd, 0x201e, 0x2026, 0x2020, 0x2021, | ||
| 0xfffd, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179, | ||
| /* 0x90 */ | ||
| 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, | ||
| 0xfffd, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a, | ||
| /* 0xa0 */ | ||
| 0x00a0, 0x02c7, 0x02d8, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, | ||
| 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b, | ||
| /* 0xb0 */ | ||
| 0x00b0, 0x00b1, 0x02db, 0x0142, 0x00b4, 0x00b5, 0x00b6, 0x00b7, | ||
| 0x00b8, 0x0105, 0x015f, 0x00bb, 0x013d, 0x02dd, 0x013e, 0x017c, | ||
| /* 0xc0 */ | ||
| 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, | ||
| 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, | ||
| /* 0xd0 */ | ||
| 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, | ||
| 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, | ||
| /* 0xe0 */ | ||
| 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, | ||
| 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, | ||
| /* 0xf0 */ | ||
| 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, | ||
| 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, | ||
| }; | ||
|
|
||
| static int | ||
| cp1250_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else { | ||
| unsigned short wc = cp1250_2uni[c-0x80]; | ||
| if (wc != 0xfffd) { | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
|
|
||
| static const unsigned char cp1250_page00[224] = { | ||
| 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ | ||
| 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ | ||
| 0xb0, 0xb1, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ | ||
| 0xb8, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ | ||
| 0x00, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */ | ||
| 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */ | ||
| 0x00, 0x00, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ | ||
| 0x00, 0x00, 0xda, 0x00, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ | ||
| 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ | ||
| 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */ | ||
| 0x00, 0x00, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ | ||
| 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ | ||
| /* 0x0100 */ | ||
| 0x00, 0x00, 0xc3, 0xe3, 0xa5, 0xb9, 0xc6, 0xe6, /* 0x00-0x07 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */ | ||
| 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0xca, 0xea, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0xc5, 0xe5, 0x00, 0x00, 0xbc, 0xbe, 0x00, /* 0x38-0x3f */ | ||
| 0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0xd2, /* 0x40-0x47 */ | ||
| 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ | ||
| 0xd5, 0xf5, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, /* 0x50-0x57 */ | ||
| 0xd8, 0xf8, 0x8c, 0x9c, 0x00, 0x00, 0xaa, 0xba, /* 0x58-0x5f */ | ||
| 0x8a, 0x9a, 0xde, 0xfe, 0x8d, 0x9d, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd9, 0xf9, /* 0x68-0x6f */ | ||
| 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x00, 0x8f, 0x9f, 0xaf, 0xbf, 0x8e, 0x9e, 0x00, /* 0x78-0x7f */ | ||
| }; | ||
| static const unsigned char cp1250_page02[32] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ | ||
| 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */ | ||
| }; | ||
| static const unsigned char cp1250_page20[48] = { | ||
| 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ | ||
| 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1250_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x0180) | ||
| c = cp1250_page00[wc-0x00a0]; | ||
| else if (wc >= 0x02c0 && wc < 0x02e0) | ||
| c = cp1250_page02[wc-0x02c0]; | ||
| else if (wc >= 0x2010 && wc < 0x2040) | ||
| c = cp1250_page20[wc-0x2010]; | ||
| else if (wc == 0x20ac) | ||
| c = 0x80; | ||
| else if (wc == 0x2122) | ||
| c = 0x99; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1251 | ||
| */ | ||
|
|
||
| static const unsigned short cp1251_2uni[128] = { | ||
| /* 0x80 */ | ||
| 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, | ||
| 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, | ||
| /* 0x90 */ | ||
| 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, | ||
| 0xfffd, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, | ||
| /* 0xa0 */ | ||
| 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, | ||
| 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, | ||
| /* 0xb0 */ | ||
| 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, | ||
| 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, | ||
| /* 0xc0 */ | ||
| 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, | ||
| 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, | ||
| /* 0xd0 */ | ||
| 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, | ||
| 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, | ||
| /* 0xe0 */ | ||
| 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, | ||
| 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, | ||
| /* 0xf0 */ | ||
| 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, | ||
| 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, | ||
| }; | ||
|
|
||
| static int | ||
| cp1251_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else { | ||
| unsigned short wc = cp1251_2uni[c-0x80]; | ||
| if (wc != 0xfffd) { | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
|
|
||
| static const unsigned char cp1251_page00[32] = { | ||
| 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ | ||
| 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ | ||
| 0xb0, 0xb1, 0x00, 0x00, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ | ||
| 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ | ||
| }; | ||
| static const unsigned char cp1251_page04[152] = { | ||
| 0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */ | ||
| 0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f, /* 0x08-0x0f */ | ||
| 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */ | ||
| 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x18-0x1f */ | ||
| 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x20-0x27 */ | ||
| 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x28-0x2f */ | ||
| 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x30-0x37 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x38-0x3f */ | ||
| 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x40-0x47 */ | ||
| 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0x48-0x4f */ | ||
| 0x00, 0xb8, 0x90, 0x83, 0xba, 0xbe, 0xb3, 0xbf, /* 0x50-0x57 */ | ||
| 0xbc, 0x9a, 0x9c, 0x9e, 0x9d, 0x00, 0xa2, 0x9f, /* 0x58-0x5f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| }; | ||
| static const unsigned char cp1251_page20[48] = { | ||
| 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ | ||
| 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1251_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x00c0) | ||
| c = cp1251_page00[wc-0x00a0]; | ||
| else if (wc >= 0x0400 && wc < 0x0498) | ||
| c = cp1251_page04[wc-0x0400]; | ||
| else if (wc >= 0x2010 && wc < 0x2040) | ||
| c = cp1251_page20[wc-0x2010]; | ||
| else if (wc == 0x20ac) | ||
| c = 0x88; | ||
| else if (wc == 0x2116) | ||
| c = 0xb9; | ||
| else if (wc == 0x2122) | ||
| c = 0x99; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1252 | ||
| */ | ||
|
|
||
| static const unsigned short cp1252_2uni[32] = { | ||
| /* 0x80 */ | ||
| 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, | ||
| 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0xfffd, 0x017d, 0xfffd, | ||
| /* 0x90 */ | ||
| 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, | ||
| 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0xfffd, 0x017e, 0x0178, | ||
| }; | ||
|
|
||
| static int | ||
| cp1252_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80 || c >= 0xa0) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else { | ||
| unsigned short wc = cp1252_2uni[c-0x80]; | ||
| if (wc != 0xfffd) { | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
|
|
||
| static const unsigned char cp1252_page01[72] = { | ||
| 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ | ||
| 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x9f, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x9e, 0x00, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| }; | ||
| static const unsigned char cp1252_page02[32] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ | ||
| }; | ||
| static const unsigned char cp1252_page20[48] = { | ||
| 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ | ||
| 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1252_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x0100) | ||
| c = wc; | ||
| else if (wc >= 0x0150 && wc < 0x0198) | ||
| c = cp1252_page01[wc-0x0150]; | ||
| else if (wc >= 0x02c0 && wc < 0x02e0) | ||
| c = cp1252_page02[wc-0x02c0]; | ||
| else if (wc >= 0x2010 && wc < 0x2040) | ||
| c = cp1252_page20[wc-0x2010]; | ||
| else if (wc == 0x20ac) | ||
| c = 0x80; | ||
| else if (wc == 0x2122) | ||
| c = 0x99; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1253 | ||
| */ | ||
|
|
||
| static const unsigned short cp1253_2uni[128] = { | ||
| /* 0x80 */ | ||
| 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, | ||
| 0xfffd, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, | ||
| /* 0x90 */ | ||
| 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, | ||
| 0xfffd, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, | ||
| /* 0xa0 */ | ||
| 0x00a0, 0x0385, 0x0386, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, | ||
| 0x00a8, 0x00a9, 0xfffd, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x2015, | ||
| /* 0xb0 */ | ||
| 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x00b5, 0x00b6, 0x00b7, | ||
| 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, | ||
| /* 0xc0 */ | ||
| 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, | ||
| 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, | ||
| /* 0xd0 */ | ||
| 0x03a0, 0x03a1, 0xfffd, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, | ||
| 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, | ||
| /* 0xe0 */ | ||
| 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, | ||
| 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, | ||
| /* 0xf0 */ | ||
| 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, | ||
| 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0xfffd, | ||
| }; | ||
|
|
||
| static int | ||
| cp1253_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else { | ||
| unsigned short wc = cp1253_2uni[c-0x80]; | ||
| if (wc != 0xfffd) { | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
|
|
||
| static const unsigned char cp1253_page00[32] = { | ||
| 0xa0, 0x00, 0x00, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ | ||
| 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ | ||
| 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ | ||
| 0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ | ||
| }; | ||
| static const unsigned char cp1253_page03[80] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0xb4, 0xa1, 0xa2, 0x00, /* 0x80-0x87 */ | ||
| 0xb8, 0xb9, 0xba, 0x00, 0xbc, 0x00, 0xbe, 0xbf, /* 0x88-0x8f */ | ||
| 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x90-0x97 */ | ||
| 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x98-0x9f */ | ||
| 0xd0, 0xd1, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xa0-0xa7 */ | ||
| 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xa8-0xaf */ | ||
| 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xb0-0xb7 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xb8-0xbf */ | ||
| 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xc0-0xc7 */ | ||
| 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xc8-0xcf */ | ||
| }; | ||
| static const unsigned char cp1253_page20[48] = { | ||
| 0x00, 0x00, 0x00, 0x96, 0x97, 0xaf, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ | ||
| 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1253_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x00c0) | ||
| c = cp1253_page00[wc-0x00a0]; | ||
| else if (wc == 0x0192) | ||
| c = 0x83; | ||
| else if (wc >= 0x0380 && wc < 0x03d0) | ||
| c = cp1253_page03[wc-0x0380]; | ||
| else if (wc >= 0x2010 && wc < 0x2040) | ||
| c = cp1253_page20[wc-0x2010]; | ||
| else if (wc == 0x20ac) | ||
| c = 0x80; | ||
| else if (wc == 0x2122) | ||
| c = 0x99; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1254 | ||
| */ | ||
|
|
||
| static const unsigned short cp1254_2uni_1[32] = { | ||
| /* 0x80 */ | ||
| 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, | ||
| 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0xfffd, 0xfffd, 0xfffd, | ||
| /* 0x90 */ | ||
| 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, | ||
| 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0xfffd, 0xfffd, 0x0178, | ||
| }; | ||
| static const unsigned short cp1254_2uni_2[16] = { | ||
| /* 0xd0 */ | ||
| 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, | ||
| 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, | ||
| }; | ||
| static const unsigned short cp1254_2uni_3[16] = { | ||
| /* 0xf0 */ | ||
| 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, | ||
| 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, | ||
| }; | ||
|
|
||
| static int | ||
| cp1254_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else if (c < 0xa0) { | ||
| unsigned short wc = cp1254_2uni_1[c-0x80]; | ||
| if (wc != 0xfffd) { | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| } | ||
| else if (c < 0xd0) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else if (c < 0xe0) { | ||
| *pwc = (ucs4_t) cp1254_2uni_2[c-0xd0]; | ||
| return 1; | ||
| } | ||
| else if (c < 0xf0) { | ||
| *pwc = (ucs4_t) c; | ||
| return 1; | ||
| } | ||
| else { | ||
| *pwc = (ucs4_t) cp1254_2uni_3[c-0xf0]; | ||
| return 1; | ||
| } | ||
| return RET_ILSEQ; | ||
| } | ||
|
|
||
| static const unsigned char cp1254_page00[48] = { | ||
| 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ | ||
| 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ | ||
| 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ | ||
| 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ | ||
| 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ | ||
| }; | ||
| static const unsigned char cp1254_page01[128] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, /* 0x18-0x1f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ | ||
| 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */ | ||
| 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| }; | ||
| static const unsigned char cp1254_page02[32] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ | ||
| }; | ||
| static const unsigned char cp1254_page20[48] = { | ||
| 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ | ||
| 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1254_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x00d0) | ||
| c = wc; | ||
| else if (wc >= 0x00d0 && wc < 0x0100) | ||
| c = cp1254_page00[wc-0x00d0]; | ||
| else if (wc >= 0x0118 && wc < 0x0198) | ||
| c = cp1254_page01[wc-0x0118]; | ||
| else if (wc >= 0x02c0 && wc < 0x02e0) | ||
| c = cp1254_page02[wc-0x02c0]; | ||
| else if (wc >= 0x2010 && wc < 0x2040) | ||
| c = cp1254_page20[wc-0x2010]; | ||
| else if (wc == 0x20ac) | ||
| c = 0x80; | ||
| else if (wc == 0x2122) | ||
| c = 0x99; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,380 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001, 2004 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1255 | ||
| */ | ||
|
|
||
| #include "flushwc.h" | ||
|
|
||
| /* Combining characters used in Hebrew encoding CP1255. */ | ||
|
|
||
| /* Relevant combining characters: | ||
| 0x05b4, 0x05b7, 0x05b8, 0x05b9, 0x05bc, 0x05bf, 0x05c1, 0x05c2. */ | ||
|
|
||
| /* Composition tables for each of the relevant combining characters. */ | ||
| static const struct { unsigned short base; unsigned short composed; } cp1255_comp_table_data[] = { | ||
| #define cp1255_comp_table05b4_idx 0 | ||
| #define cp1255_comp_table05b4_len 1 | ||
| { 0x05D9, 0xFB1D }, | ||
| #define cp1255_comp_table05b7_idx (cp1255_comp_table05b4_idx+cp1255_comp_table05b4_len) | ||
| #define cp1255_comp_table05b7_len 2 | ||
| { 0x05D0, 0xFB2E }, | ||
| { 0x05F2, 0xFB1F }, | ||
| #define cp1255_comp_table05b8_idx (cp1255_comp_table05b7_idx+cp1255_comp_table05b7_len) | ||
| #define cp1255_comp_table05b8_len 1 | ||
| { 0x05D0, 0xFB2F }, | ||
| #define cp1255_comp_table05b9_idx (cp1255_comp_table05b8_idx+cp1255_comp_table05b8_len) | ||
| #define cp1255_comp_table05b9_len 1 | ||
| { 0x05D5, 0xFB4B }, | ||
| #define cp1255_comp_table05bc_idx (cp1255_comp_table05b9_idx+cp1255_comp_table05b9_len) | ||
| #define cp1255_comp_table05bc_len 24 | ||
| { 0x05D0, 0xFB30 }, | ||
| { 0x05D1, 0xFB31 }, | ||
| { 0x05D2, 0xFB32 }, | ||
| { 0x05D3, 0xFB33 }, | ||
| { 0x05D4, 0xFB34 }, | ||
| { 0x05D5, 0xFB35 }, | ||
| { 0x05D6, 0xFB36 }, | ||
| { 0x05D8, 0xFB38 }, | ||
| { 0x05D9, 0xFB39 }, | ||
| { 0x05DA, 0xFB3A }, | ||
| { 0x05DB, 0xFB3B }, | ||
| { 0x05DC, 0xFB3C }, | ||
| { 0x05DE, 0xFB3E }, | ||
| { 0x05E0, 0xFB40 }, | ||
| { 0x05E1, 0xFB41 }, | ||
| { 0x05E3, 0xFB43 }, | ||
| { 0x05E4, 0xFB44 }, | ||
| { 0x05E6, 0xFB46 }, | ||
| { 0x05E7, 0xFB47 }, | ||
| { 0x05E8, 0xFB48 }, | ||
| { 0x05E9, 0xFB49 }, | ||
| { 0x05EA, 0xFB4A }, | ||
| { 0xFB2A, 0xFB2C }, | ||
| { 0xFB2B, 0xFB2D }, | ||
| #define cp1255_comp_table05bf_idx (cp1255_comp_table05bc_idx+cp1255_comp_table05bc_len) | ||
| #define cp1255_comp_table05bf_len 3 | ||
| { 0x05D1, 0xFB4C }, | ||
| { 0x05DB, 0xFB4D }, | ||
| { 0x05E4, 0xFB4E }, | ||
| #define cp1255_comp_table05c1_idx (cp1255_comp_table05bf_idx+cp1255_comp_table05bf_len) | ||
| #define cp1255_comp_table05c1_len 2 | ||
| { 0x05E9, 0xFB2A }, | ||
| { 0xFB49, 0xFB2C }, | ||
| #define cp1255_comp_table05c2_idx (cp1255_comp_table05c1_idx+cp1255_comp_table05c1_len) | ||
| #define cp1255_comp_table05c2_len 2 | ||
| { 0x05E9, 0xFB2B }, | ||
| { 0xFB49, 0xFB2D }, | ||
| }; | ||
| static const struct { unsigned int len; unsigned int idx; } cp1255_comp_table[] = { | ||
| { cp1255_comp_table05b4_len, cp1255_comp_table05b4_idx }, | ||
| { cp1255_comp_table05b7_len, cp1255_comp_table05b7_idx }, | ||
| { cp1255_comp_table05b8_len, cp1255_comp_table05b8_idx }, | ||
| { cp1255_comp_table05b9_len, cp1255_comp_table05b9_idx }, | ||
| { cp1255_comp_table05bc_len, cp1255_comp_table05bc_idx }, | ||
| { cp1255_comp_table05bf_len, cp1255_comp_table05bf_idx }, | ||
| { cp1255_comp_table05c1_len, cp1255_comp_table05c1_idx }, | ||
| { cp1255_comp_table05c2_len, cp1255_comp_table05c2_idx }, | ||
| }; | ||
|
|
||
| /* Decomposition table for the relevant Unicode characters. */ | ||
| struct cp1255_decomp { unsigned short composed; unsigned short base; int comb1 : 8; signed int comb2 : 8; }; | ||
| static const struct cp1255_decomp cp1255_decomp_table[] = { | ||
| { 0xFB1D, 0x05D9, 0, -1 }, | ||
| { 0xFB1F, 0x05F2, 1, -1 }, | ||
| { 0xFB2A, 0x05E9, 6, -1 }, | ||
| { 0xFB2B, 0x05E9, 7, -1 }, | ||
| { 0xFB2C, 0x05E9, 4, 6 }, | ||
| { 0xFB2D, 0x05E9, 4, 7 }, | ||
| { 0xFB2E, 0x05D0, 1, -1 }, | ||
| { 0xFB2F, 0x05D0, 2, -1 }, | ||
| { 0xFB30, 0x05D0, 4, -1 }, | ||
| { 0xFB31, 0x05D1, 4, -1 }, | ||
| { 0xFB32, 0x05D2, 4, -1 }, | ||
| { 0xFB33, 0x05D3, 4, -1 }, | ||
| { 0xFB34, 0x05D4, 4, -1 }, | ||
| { 0xFB35, 0x05D5, 4, -1 }, | ||
| { 0xFB36, 0x05D6, 4, -1 }, | ||
| { 0xFB38, 0x05D8, 4, -1 }, | ||
| { 0xFB39, 0x05D9, 4, -1 }, | ||
| { 0xFB3A, 0x05DA, 4, -1 }, | ||
| { 0xFB3B, 0x05DB, 4, -1 }, | ||
| { 0xFB3C, 0x05DC, 4, -1 }, | ||
| { 0xFB3E, 0x05DE, 4, -1 }, | ||
| { 0xFB40, 0x05E0, 4, -1 }, | ||
| { 0xFB41, 0x05E1, 4, -1 }, | ||
| { 0xFB43, 0x05E3, 4, -1 }, | ||
| { 0xFB44, 0x05E4, 4, -1 }, | ||
| { 0xFB46, 0x05E6, 4, -1 }, | ||
| { 0xFB47, 0x05E7, 4, -1 }, | ||
| { 0xFB48, 0x05E8, 4, -1 }, | ||
| { 0xFB49, 0x05E9, 4, -1 }, | ||
| { 0xFB4A, 0x05EA, 4, -1 }, | ||
| { 0xFB4B, 0x05D5, 3, -1 }, | ||
| { 0xFB4C, 0x05D1, 5, -1 }, | ||
| { 0xFB4D, 0x05DB, 5, -1 }, | ||
| { 0xFB4E, 0x05E4, 5, -1 }, | ||
| }; | ||
|
|
||
| static const unsigned char cp1255_comb_table[] = { | ||
| 0xc4, 0xc7, 0xc8, 0xc9, 0xcc, 0xcf, 0xd1, 0xd2, | ||
| }; | ||
|
|
||
| static const unsigned short cp1255_2uni[128] = { | ||
| /* 0x80 */ | ||
| 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, | ||
| 0x02c6, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, | ||
| /* 0x90 */ | ||
| 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, | ||
| 0x02dc, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, | ||
| /* 0xa0 */ | ||
| 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20aa, 0x00a5, 0x00a6, 0x00a7, | ||
| 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, | ||
| /* 0xb0 */ | ||
| 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, | ||
| 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, | ||
| /* 0xc0 */ | ||
| 0x05b0, 0x05b1, 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, | ||
| 0x05b8, 0x05b9, 0xfffd, 0x05bb, 0x05bc, 0x05bd, 0x05be, 0x05bf, | ||
| /* 0xd0 */ | ||
| 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f0, 0x05f1, 0x05f2, 0x05f3, | ||
| 0x05f4, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, | ||
| /* 0xe0 */ | ||
| 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, | ||
| 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, | ||
| /* 0xf0 */ | ||
| 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, | ||
| 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, | ||
| }; | ||
|
|
||
| /* In the CP1255 to Unicode direction, the state contains a buffered | ||
| character, or 0 if none. */ | ||
|
|
||
| static int | ||
| cp1255_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| unsigned short wc; | ||
| unsigned short last_wc; | ||
| if (c < 0x80) { | ||
| wc = c; | ||
| } else { | ||
| wc = cp1255_2uni[c-0x80]; | ||
| if (wc == 0xfffd) | ||
| return RET_ILSEQ; | ||
| } | ||
| last_wc = conv->istate; | ||
| if (last_wc) { | ||
| if (wc >= 0x05b0 && wc < 0x05c5) { | ||
| /* See whether last_wc and wc can be combined. */ | ||
| unsigned int k; | ||
| unsigned int i1, i2; | ||
| switch (wc) { | ||
| case 0x05b4: k = 0; break; | ||
| case 0x05b7: k = 1; break; | ||
| case 0x05b8: k = 2; break; | ||
| case 0x05b9: k = 3; break; | ||
| case 0x05bc: k = 4; break; | ||
| case 0x05bf: k = 5; break; | ||
| case 0x05c1: k = 6; break; | ||
| case 0x05c2: k = 7; break; | ||
| default: goto not_combining; | ||
| } | ||
| i1 = cp1255_comp_table[k].idx; | ||
| i2 = i1 + cp1255_comp_table[k].len-1; | ||
| if (last_wc >= cp1255_comp_table_data[i1].base | ||
| && last_wc <= cp1255_comp_table_data[i2].base) { | ||
| unsigned int i; | ||
| for (;;) { | ||
| i = (i1+i2)>>1; | ||
| if (last_wc == cp1255_comp_table_data[i].base) | ||
| break; | ||
| if (last_wc < cp1255_comp_table_data[i].base) { | ||
| if (i1 == i) | ||
| goto not_combining; | ||
| i2 = i; | ||
| } else { | ||
| if (i1 != i) | ||
| i1 = i; | ||
| else { | ||
| i = i2; | ||
| if (last_wc == cp1255_comp_table_data[i].base) | ||
| break; | ||
| goto not_combining; | ||
| } | ||
| } | ||
| } | ||
| last_wc = cp1255_comp_table_data[i].composed; | ||
| if (last_wc == 0xfb2a || last_wc == 0xfb2b || last_wc == 0xfb49) { | ||
| /* Buffer the combined character. */ | ||
| conv->istate = last_wc; | ||
| return RET_TOOFEW(1); | ||
| } else { | ||
| /* Output the combined character. */ | ||
| conv->istate = 0; | ||
| *pwc = (ucs4_t) last_wc; | ||
| return 1; | ||
| } | ||
| } | ||
| } | ||
| not_combining: | ||
| /* Output the buffered character. */ | ||
| conv->istate = 0; | ||
| *pwc = (ucs4_t) last_wc; | ||
| return 0; /* Don't advance the input pointer. */ | ||
| } | ||
| if ((wc >= 0x05d0 && wc <= 0x05ea && ((0x07db5f7f >> (wc - 0x05d0)) & 1)) | ||
| || wc == 0x05f2) { | ||
| /* wc is a possible match in cp1255_comp_table_data. Buffer it. */ | ||
| conv->istate = wc; | ||
| return RET_TOOFEW(1); | ||
| } else { | ||
| /* Output wc immediately. */ | ||
| *pwc = (ucs4_t) wc; | ||
| return 1; | ||
| } | ||
| } | ||
|
|
||
| #define cp1255_flushwc normal_flushwc | ||
|
|
||
| static const unsigned char cp1255_page00[88] = { | ||
| 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ | ||
| 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ | ||
| 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ | ||
| 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ | ||
| }; | ||
| static const unsigned char cp1255_page02[32] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ | ||
| }; | ||
| static const unsigned char cp1255_page05[72] = { | ||
| 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xb0-0xb7 */ | ||
| 0xc8, 0xc9, 0x00, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xb8-0xbf */ | ||
| 0xd0, 0xd1, 0xd2, 0xd3, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */ | ||
| 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */ | ||
| 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ | ||
| 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ | ||
| }; | ||
| static const unsigned char cp1255_page20[56] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ | ||
| 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ | ||
| 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1255_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x00f8) | ||
| c = cp1255_page00[wc-0x00a0]; | ||
| else if (wc == 0x0192) | ||
| c = 0x83; | ||
| else if (wc >= 0x02c0 && wc < 0x02e0) | ||
| c = cp1255_page02[wc-0x02c0]; | ||
| else if (wc >= 0x05b0 && wc < 0x05f8) | ||
| c = cp1255_page05[wc-0x05b0]; | ||
| else if (wc >= 0x2008 && wc < 0x2040) | ||
| c = cp1255_page20[wc-0x2008]; | ||
| else if (wc == 0x20aa) | ||
| c = 0xa4; | ||
| else if (wc == 0x20ac) | ||
| c = 0x80; | ||
| else if (wc == 0x2122) | ||
| c = 0x99; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| /* Try canonical decomposition. */ | ||
| { | ||
| /* Binary search through cp1255_decomp_table. */ | ||
| unsigned int i1 = 0; | ||
| unsigned int i2 = sizeof(cp1255_decomp_table)/sizeof(cp1255_decomp_table[0])-1; | ||
| if (wc >= cp1255_decomp_table[i1].composed | ||
| && wc <= cp1255_decomp_table[i2].composed) { | ||
| unsigned int i; | ||
| for (;;) { | ||
| /* Here i2 - i1 > 0. */ | ||
| i = (i1+i2)>>1; | ||
| if (wc == cp1255_decomp_table[i].composed) | ||
| break; | ||
| if (wc < cp1255_decomp_table[i].composed) { | ||
| if (i1 == i) | ||
| return RET_ILUNI; | ||
| /* Here i1 < i < i2. */ | ||
| i2 = i; | ||
| } else { | ||
| /* Here i1 <= i < i2. */ | ||
| if (i1 != i) | ||
| i1 = i; | ||
| else { | ||
| /* Here i2 - i1 = 1. */ | ||
| i = i2; | ||
| if (wc == cp1255_decomp_table[i].composed) | ||
| break; | ||
| else | ||
| return RET_ILUNI; | ||
| } | ||
| } | ||
| } | ||
| /* Found a canonical decomposition. */ | ||
| wc = cp1255_decomp_table[i].base; | ||
| /* wc is one of 0x05d0..0x05d6, 0x05d8..0x05dc, 0x05de, 0x05e0..0x05e1, | ||
| 0x05e3..0x05e4, 0x05e6..0x05ea, 0x05f2. */ | ||
| c = cp1255_page05[wc-0x05b0]; | ||
| if (cp1255_decomp_table[i].comb2 < 0) { | ||
| if (n < 2) | ||
| return RET_TOOSMALL; | ||
| r[0] = c; | ||
| r[1] = cp1255_comb_table[cp1255_decomp_table[i].comb1]; | ||
| return 2; | ||
| } else { | ||
| if (n < 3) | ||
| return RET_TOOSMALL; | ||
| r[0] = c; | ||
| r[1] = cp1255_comb_table[cp1255_decomp_table[i].comb1]; | ||
| r[2] = cp1255_comb_table[cp1255_decomp_table[i].comb2]; | ||
| return 3; | ||
| } | ||
| } | ||
| } | ||
| return RET_ILUNI; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| /* | ||
| * Copyright (C) 1999-2001 Free Software Foundation, Inc. | ||
| * This file is part of the GNU LIBICONV Library. | ||
| * | ||
| * The GNU LIBICONV Library is free software; you can redistribute it | ||
| * and/or modify it under the terms of the GNU Library General Public | ||
| * License as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * The GNU LIBICONV Library is distributed in the hope that it will be | ||
| * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Library General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Library General Public | ||
| * License along with the GNU LIBICONV Library; see the file COPYING.LIB. | ||
| * If not, write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
| * Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /* | ||
| * CP1256 | ||
| */ | ||
|
|
||
| static const unsigned short cp1256_2uni[128] = { | ||
| /* 0x80 */ | ||
| 0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, | ||
| 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, | ||
| /* 0x90 */ | ||
| 0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, | ||
| 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba, | ||
| /* 0xa0 */ | ||
| 0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, | ||
| 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, | ||
| /* 0xb0 */ | ||
| 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, | ||
| 0x00b8, 0x00b9, 0x061b, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x061f, | ||
| /* 0xc0 */ | ||
| 0x06c1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, | ||
| 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, | ||
| /* 0xd0 */ | ||
| 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00d7, | ||
| 0x0637, 0x0638, 0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643, | ||
| /* 0xe0 */ | ||
| 0x00e0, 0x0644, 0x00e2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00e7, | ||
| 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0649, 0x064a, 0x00ee, 0x00ef, | ||
| /* 0xf0 */ | ||
| 0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, | ||
| 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2, | ||
| }; | ||
|
|
||
| static int | ||
| cp1256_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) | ||
| { | ||
| unsigned char c = *s; | ||
| if (c < 0x80) | ||
| *pwc = (ucs4_t) c; | ||
| else | ||
| *pwc = (ucs4_t) cp1256_2uni[c-0x80]; | ||
| return 1; | ||
| } | ||
|
|
||
| static const unsigned char cp1256_page00[96] = { | ||
| 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ | ||
| 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ | ||
| 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ | ||
| 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, /* 0xd0-0xd7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ | ||
| 0xe0, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ | ||
| 0xe8, 0xe9, 0xea, 0xeb, 0x00, 0x00, 0xee, 0xef, /* 0xe8-0xef */ | ||
| 0x00, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ | ||
| 0x00, 0xf9, 0x00, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ | ||
| }; | ||
| static const unsigned char cp1256_page01[72] = { | ||
| 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| }; | ||
| static const unsigned char cp1256_page06[208] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, /* 0x08-0x0f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ | ||
| 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ | ||
| 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ | ||
| 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, /* 0x30-0x37 */ | ||
| 0xd9, 0xda, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| 0xdc, 0xdd, 0xde, 0xdf, 0xe1, 0xe3, 0xe4, 0xe5, /* 0x40-0x47 */ | ||
| 0xe6, 0xec, 0xed, 0xf0, 0xf1, 0xf2, 0xf3, 0xf5, /* 0x48-0x4f */ | ||
| 0xf6, 0xf8, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ | ||
| 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, /* 0x78-0x7f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, /* 0x80-0x87 */ | ||
| 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ | ||
| 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ | ||
| 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ | ||
| 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0xa8-0xaf */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ | ||
| 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xaa, 0x00, /* 0xb8-0xbf */ | ||
| 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ | ||
| 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ | ||
| }; | ||
| static const unsigned char cp1256_page20[56] = { | ||
| 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0xfd, 0xfe, /* 0x08-0x0f */ | ||
| 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ | ||
| 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ | ||
| 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ | ||
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ | ||
| 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ | ||
| 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ | ||
| }; | ||
|
|
||
| static int | ||
| cp1256_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) | ||
| { | ||
| unsigned char c = 0; | ||
| if (wc < 0x0080) { | ||
| *r = wc; | ||
| return 1; | ||
| } | ||
| else if (wc >= 0x00a0 && wc < 0x0100) | ||
| c = cp1256_page00[wc-0x00a0]; | ||
| else if (wc >= 0x0150 && wc < 0x0198) | ||
| c = cp1256_page01[wc-0x0150]; | ||
| else if (wc == 0x02c6) | ||
| c = 0x88; | ||
| else if (wc >= 0x0608 && wc < 0x06d8) | ||
| c = cp1256_page06[wc-0x0608]; | ||
| else if (wc >= 0x2008 && wc < 0x2040) | ||
| c = cp1256_page20[wc-0x2008]; | ||
| else if (wc == 0x20ac) | ||
| c = 0x80; | ||
| else if (wc == 0x2122) | ||
| c = 0x99; | ||
| if (c != 0) { | ||
| *r = c; | ||
| return 1; | ||
| } | ||
| return RET_ILUNI; | ||
| } |