diff options
36 files changed, 695 insertions, 215 deletions
@@ -1,5 +1,36 @@ 2001-11-28 Ulrich Drepper <drepper@redhat.com> + * iconvdata/ibm1163.c: New file. + * iconvdata/ibm1163.h: New file. + * iconvdata/ibm1164.c: New file. + * iconvdata/ibm1164.h: New file. + * iconvdata/TESTS: Add entries for IBM1163 and IBM1164. + * iconvdata/Makefile: Likewise. + * iconvdata/testdata/IBM1163: New file. + * iconvdata/testdata/IBM1163..UTF8: New file. + * iconvdata/testdata/IBM1164: New file. + * iconvdata/testdata/IBM1164..UTF8: New file. + Patch by Masahide Washizawa <WASHI@jp.ibm.com>. + + * iconvdata/ibm1046.h: Optimize. Remove duplicate mappings. + * iconvdata/ibm1124.h: Likewise. + * iconvdata/ibm1132.h: Likewise. + * iconvdata/ibm1133.h: Likewise. + * iconvdata/ibm1160.h: Likewise. + * iconvdata/ibm1161.h: Likewise. + * iconvdata/ibm1162.h: Likewise. + * iconvdata/ibm856.h: Likewise. + * iconvdata/ibm922.h: Likewise. + * iconvdata/ibm930.h: Likewise. + * iconvdata/ibm932.h: Likewise. + * iconvdata/ibm933.h: Likewise. + * iconvdata/ibm935.h: Likewise. + * iconvdata/ibm937.h: Likewise. + * iconvdata/ibm939.h: Likewise. + * iconvdata/ibm943.h: Likewise. + * iconvdata/ibm930.c: Pretty printing. + * iconvdata/ibm937.c: Avoid access accross array boundary. + * iconv/gconv_open.c (__gconv_open): Empty codeset name now means using the current locale's codeset. * iconv/iconv_open.c (iconv_open): Don't strip out everything for @@ -1,4 +1,4 @@ -GNU C Library NEWS -- history of user-visible changes. 2001-10-31 +GNU C Library NEWS -- history of user-visible changes. 2001-11-28 Copyright (C) 1992-2000, 2001 Free Software Foundation, Inc. See the end for copying conditions. @@ -6,6 +6,13 @@ Please send GNU C library bug reports using the `glibcbug' script to <bugs@gnu.org>. Questions and suggestions should be send to <bug-glibc@gnu.org>. +Version 2.3 +* Masahide Washizawa contributed iconv modules for IBM1163 and IBM1164 + charsets. + +* iconv (the program and the interface) now accepts empty names (excluding + options like //TRANSLIT) to mean "use charset of current locale". + Version 2.2.5 * Stephen Moshier implemented log2, log10, powl and cbrtl for the diff --git a/iconvdata/Makefile b/iconvdata/Makefile index 8cfd25e918..2070391af8 100644 --- a/iconvdata/Makefile +++ b/iconvdata/Makefile @@ -39,7 +39,7 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \ IBM862 IBM863 IBM864 IBM865 IBM868 IBM869 IBM875 IBM880 \ IBM866 CP1258 IBM922 IBM1124 IBM1129 IBM932 IBM943 \ IBM856 IBM930 IBM933 IBM935 IBM937 IBM939 IBM1046 \ - IBM1132 IBM1133 IBM1162 \ + IBM1132 IBM1133 IBM1160 IBM1161 IBM1162 IBM1163 IBM1164 \ IBM918 IBM1004 IBM1026 CP1250 CP1251 CP1252 CP1253 CP1254 \ CP1255 CP1256 CP1257 ISO-2022-JP MACINTOSH IEC_P27-1 \ ASMO_449 ANSI_X3.110 CSN_369103 CWI DEC-MCS ECMA-CYRILLIC \ @@ -49,8 +49,7 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \ SAMI-WS2 ISO-IR-197 TIS-620 KOI8-U GBK ISIRI-3342 GBGBK \ ISO-2022-CN libISOIR165 UTF-16 UNICODE UTF-32 UTF-7 BIG5HKSCS \ GB18030 ISO-2022-CN-EXT VISCII GBBIG5 CP10007 KOI8-T \ - GEORGIAN-PS GEORGIAN-ACADEMY ISO-IR-209 MAC-SAMI IBM1160 \ - IBM1161 + GEORGIAN-PS GEORGIAN-ACADEMY ISO-IR-209 MAC-SAMI modules.so := $(addsuffix .so, $(modules)) @@ -143,7 +142,8 @@ distribute := gconv-modules extra-module.mk gap.awk gaptab.awk \ iso-ir-165.c iso-ir-165.h gb18030.c iso-2022-cn-ext.c \ ibm932.c ibm932.h ibm943.c ibm943.h gbbig5.c cp10007.c \ koi8-t.c georgian-ps.c georgian-academy.c iso-ir-209.c \ - mac-sami.c ibm1160.c ibm1160.h ibm1161.c ibm1161.h + mac-sami.c ibm1160.c ibm1160.h ibm1161.c ibm1161.h \ + ibm1163.c ibm1163.h ibm1164.c ibm1164.h # We build the transformation modules only when we build shared libs. ifeq (yes,$(build-shared)) diff --git a/iconvdata/TESTS b/iconvdata/TESTS index 807b1bc837..c2a7cff628 100644 --- a/iconvdata/TESTS +++ b/iconvdata/TESTS @@ -109,3 +109,5 @@ IBM1161 IBM1161 Y UTF8 IBM1132 IBM1132 N UTF8 IBM1133 IBM1133 Y UTF8 IBM1162 IBM1162 Y UTF8 +IBM1163 IBM1163 Y UTF8 +IBM1164 IBM1164 N UTF8 diff --git a/iconvdata/ibm1046.h b/iconvdata/ibm1046.h index b5cc0ea476..fe7d1f0033 100644 --- a/iconvdata/ibm1046.h +++ b/iconvdata/ibm1046.h @@ -1,5 +1,5 @@ /* Tables for conversion from and to IBM1046. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000. @@ -112,9 +112,6 @@ static const struct gap from_idx[] = { start: 0xfe70, end: 0xfe72, idx: -64932 }, { start: 0xfe74, end: 0xfe74, idx: -64933 }, { start: 0xfe76, end: 0xfefc, idx: -64934 }, - { start: 0xff01, end: 0xff5e, idx: -64938 }, - { start: 0xffe8, end: 0xffe8, idx: -65075 }, - { start: 0xffed, end: 0xffed, idx: -65079 }, { start: 0xffff, end: 0xffff, idx: 0 } }; @@ -158,15 +155,5 @@ static const char from_ucs4[] = '\xe5', '\xe5', '\xfb', '\xfb', '\xe6', '\xe6', '\xfc', '\xfc', '\xfe', '\xfe', '\xe7', '\xfd', '\xe8', '\xe8', '\xe9', '\x96', '\xea', '\x98', '\x97', '\x97', '\xf7', '\x9c', '\xf8', '\x9d', '\xf9', '\x9e', '\xfa', - '\x9f', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', - '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', '\x30', '\x31', - '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', - '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', '\x40', '\x41', '\x42', '\x43', - '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', - '\x4d', '\x4e', '\x4f', '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', - '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', - '\x5f', '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', - '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', '\x70', - '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', - '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x8a', '\x89' + '\x9f' }; diff --git a/iconvdata/ibm1124.h b/iconvdata/ibm1124.h index 2d646f0f8f..d3f0b842dc 100644 --- a/iconvdata/ibm1124.h +++ b/iconvdata/ibm1124.h @@ -1,5 +1,5 @@ /* Conversion from and to IBM1124. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2000. @@ -93,7 +93,6 @@ static const struct gap from_idx[] = { start: 0x0401, end: 0x045f, idx: -857 }, { start: 0x0490, end: 0x0491, idx: -905 }, { start: 0x2116, end: 0x2116, idx: -8205 }, - { start: 0xff01, end: 0xff5e, idx: -65015 }, { start: 0xffff, end: 0xffff, idx: 0 } }; @@ -132,16 +131,5 @@ static const char from_ucs4[] = '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef', '\x00', '\xf1', '\xf2', '\x00', '\xf4', '\xf5', '\xf6', '\xf7', '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\x00', '\xfe', '\xff', '\xa3', - '\xf3', '\xf0', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', - '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', - '\x2f', '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', - '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', - '\x3f', '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', - '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', - '\x4f', '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', - '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', - '\x5f', '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', - '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', - '\x6f', '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', - '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', + '\xf3', '\xf0' }; diff --git a/iconvdata/ibm1132.h b/iconvdata/ibm1132.h index 27e59d81cf..b95e4beb55 100644 --- a/iconvdata/ibm1132.h +++ b/iconvdata/ibm1132.h @@ -85,7 +85,6 @@ static const struct gap from_idx[] = { start: 0x0000, end: 0x00ac, idx: 0 }, { start: 0x0e81, end: 0x0e8d, idx: -3540 }, { start: 0x0e94, end: 0x0edd, idx: -3546 }, - { start: 0xff01, end: 0xff5e, idx: -65021 }, { start: 0xffff, end: 0xffff, idx: 0 } }; @@ -123,17 +122,5 @@ static const char from_ucs4[] = '\xbd', '\xbe', '\xbf', '\x00', '\xdb', '\x00', '\xcb', '\xcc', '\xcd', '\xce', '\xcf', '\xda', '\x00', '\x00', '\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7', '\xb8', '\xb9', - '\x00', '\x00', '\xdd', '\xde', '\x5a', '\x7f', '\x7b', '\x5b', - '\x6c', '\x50', '\x7d', '\x4d', '\x5d', '\x5c', '\x4e', '\x6b', - '\x60', '\x4b', '\x61', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', - '\xf5', '\xf6', '\xf7', '\xf8', '\xf9', '\x7a', '\x5e', '\x4c', - '\x7e', '\x6e', '\x6f', '\x7c', '\xc1', '\xc2', '\xc3', '\xc4', - '\xc5', '\xc6', '\xc7', '\xc8', '\xc9', '\xd1', '\xd2', '\xd3', - '\xd4', '\xd5', '\xd6', '\xd7', '\xd8', '\xd9', '\xe2', '\xe3', - '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', '\xe9', '\x49', '\xe0', - '\x59', '\x69', '\x6d', '\x79', '\x81', '\x82', '\x83', '\x84', - '\x85', '\x86', '\x87', '\x88', '\x89', '\x91', '\x92', '\x93', - '\x94', '\x95', '\x96', '\x97', '\x98', '\x99', '\xa2', '\xa3', - '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xa9', '\xc0', '\x4f', - '\xd0', '\xa1' + '\x00', '\x00', '\xdd', '\xde' }; diff --git a/iconvdata/ibm1133.h b/iconvdata/ibm1133.h index 34ba3a7d06..7939ecfb72 100644 --- a/iconvdata/ibm1133.h +++ b/iconvdata/ibm1133.h @@ -85,7 +85,6 @@ static const struct gap from_idx[] = { start: 0x0000, end: 0x00ac, idx: 0 }, { start: 0x0e81, end: 0x0e8d, idx: -3540 }, { start: 0x0e94, end: 0x0edd, idx: -3546 }, - { start: 0xff01, end: 0xff5e, idx: -65021 }, { start: 0xffff, end: 0xffff, idx: 0 } }; @@ -123,17 +122,5 @@ static const char from_ucs4[] = '\xd2', '\xd3', '\xd4', '\x00', '\xdb', '\x00', '\xd5', '\xd6', '\xd7', '\xd8', '\xd9', '\xda', '\x00', '\x00', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7', '\xf8', '\xf9', - '\x00', '\x00', '\xdd', '\xde', '\x21', '\x22', '\x23', '\x24', - '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', - '\x2d', '\x2e', '\x2f', '\x30', '\x31', '\x32', '\x33', '\x34', - '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', - '\x3d', '\x3e', '\x3f', '\x40', '\x41', '\x42', '\x43', '\x44', - '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', - '\x4d', '\x4e', '\x4f', '\x50', '\x51', '\x52', '\x53', '\x54', - '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', - '\x5d', '\x5e', '\x5f', '\x60', '\x61', '\x62', '\x63', '\x64', - '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', - '\x6d', '\x6e', '\x6f', '\x70', '\x71', '\x72', '\x73', '\x74', - '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', - '\x7d', '\x7e' + '\x00', '\x00', '\xdd', '\xde' }; diff --git a/iconvdata/ibm1160.h b/iconvdata/ibm1160.h index 700ad84776..7bc8934875 100644 --- a/iconvdata/ibm1160.h +++ b/iconvdata/ibm1160.h @@ -91,7 +91,6 @@ static const struct gap from_idx[] = { start: 0x0000, end: 0x00ac, idx: 0 }, { start: 0x0e01, end: 0x0e5b, idx: -3412 }, { start: 0x20ac, end: 0x20ac, idx: -8100 }, - { start: 0xff01, end: 0xff5e, idx: -65016 }, { start: 0xffff, end: 0xffff, idx: 0 } }; @@ -130,16 +129,5 @@ static const char from_ucs4[] = '\xdf', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef', '\xfa', '\xfb', '\xfc', '\x71', '\x80', '\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7', '\xb8', '\xb9', '\x90', '\xa0', - '\xfe', '\x5a', '\x7f', '\x7b', '\x5b', '\x6c', '\x50', '\x7d', - '\x4d', '\x5d', '\x5c', '\x4e', '\x6b', '\x60', '\x4b', '\x61', - '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7', - '\xf8', '\xf9', '\x7a', '\x5e', '\x4c', '\x7e', '\x6e', '\x6f', - '\x7c', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', - '\xc8', '\xc9', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', - '\xd7', '\xd8', '\xd9', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', - '\xe7', '\xe8', '\xe9', '\x49', '\xe0', '\x59', '\x69', '\x6d', - '\x79', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87', - '\x88', '\x89', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', - '\x97', '\x98', '\x99', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', - '\xa7', '\xa8', '\xa9', '\xc0', '\x4f', '\xd0', '\xa1' + '\xfe' }; diff --git a/iconvdata/ibm1161.h b/iconvdata/ibm1161.h index ef7dfe5713..b29f5c4939 100644 --- a/iconvdata/ibm1161.h +++ b/iconvdata/ibm1161.h @@ -84,7 +84,6 @@ static const struct gap from_idx[] = { start: 0x00a0, end: 0x00ac, idx: -32 }, { start: 0x0e01, end: 0x0e5b, idx: -3444 }, { start: 0x20ac, end: 0x20ac, idx: -8132 }, - { start: 0xff01, end: 0xff5e, idx: -65048 }, { start: 0xffff, end: 0xffff, idx: 0 } }; @@ -119,16 +118,5 @@ static const char from_ucs4[] = '\xe4', '\xe5', '\xe6', '\xe7', '\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef', '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7', '\xf8', '\xf9', '\xfa', '\xfb', - '\xde', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', - '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', - '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', - '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', - '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', - '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', - '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', - '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', - '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', - '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', - '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', - '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e' + '\xde' }; diff --git a/iconvdata/ibm1162.h b/iconvdata/ibm1162.h index 73c832190d..833cada24d 100644 --- a/iconvdata/ibm1162.h +++ b/iconvdata/ibm1162.h @@ -91,7 +91,6 @@ static const struct gap from_idx[] = { start: 0x0e01, end: 0x0e5b, idx: -3431 }, { start: 0x2013, end: 0x2026, idx: -7966 }, { start: 0x20ac, end: 0x20ac, idx: -8099 }, - { start: 0xff01, end: 0xff5e, idx: -65015 }, { start: 0xffff, end: 0xffff, idx: 0 } }; @@ -130,16 +129,5 @@ static const char from_ucs4[] = '\xf7', '\xf8', '\xf9', '\xfa', '\xfb', '\x96', '\x97', '\x00', '\x00', '\x00', '\x91', '\x92', '\x00', '\x00', '\x93', '\x94', '\x00', '\x00', '\x00', '\x00', '\x95', '\x00', '\x00', '\x00', - '\x85', '\x80', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', - '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', - '\x2f', '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', - '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', - '\x3f', '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', - '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', - '\x4f', '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', - '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', - '\x5f', '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', - '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', - '\x6f', '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', - '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e' + '\x85', '\x80' }; diff --git a/iconvdata/ibm1163.c b/iconvdata/ibm1163.c new file mode 100644 index 0000000000..35c4eaf318 --- /dev/null +++ b/iconvdata/ibm1163.c @@ -0,0 +1,29 @@ +/* Conversion from and to IBM1163. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdint.h> + +/* Get the conversion table. */ +#define TABLES <ibm1163.h> + +#define CHARSET_NAME "IBM1163//" +#define HAS_HOLES 0 /* All 256 character are defined. */ + +#include <8bit-gap.c> diff --git a/iconvdata/ibm1163.h b/iconvdata/ibm1163.h new file mode 100644 index 0000000000..adb031abc0 --- /dev/null +++ b/iconvdata/ibm1163.h @@ -0,0 +1,142 @@ +/* Mapping table for IBM1163. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +static const uint32_t to_ucs4[256] = +{ + [0x00] = 0x0000, [0x01] = 0x0001, [0x02] = 0x0002, [0x03] = 0x0003, + [0x04] = 0x0004, [0x05] = 0x0005, [0x06] = 0x0006, [0x07] = 0x0007, + [0x08] = 0x0008, [0x09] = 0x0009, [0x0a] = 0x000a, [0x0b] = 0x000b, + [0x0c] = 0x000c, [0x0d] = 0x000d, [0x0e] = 0x000e, [0x0f] = 0x000f, + [0x10] = 0x0010, [0x11] = 0x0011, [0x12] = 0x0012, [0x13] = 0x0013, + [0x14] = 0x0014, [0x15] = 0x0015, [0x16] = 0x0016, [0x17] = 0x0017, + [0x18] = 0x0018, [0x19] = 0x0019, [0x1a] = 0x001a, [0x1b] = 0x001b, + [0x1c] = 0x001c, [0x1d] = 0x001d, [0x1e] = 0x001e, [0x1f] = 0x001f, + [0x20] = 0x0020, [0x21] = 0x0021, [0x22] = 0x0022, [0x23] = 0x0023, + [0x24] = 0x0024, [0x25] = 0x0025, [0x26] = 0x0026, [0x27] = 0x0027, + [0x28] = 0x0028, [0x29] = 0x0029, [0x2a] = 0x002a, [0x2b] = 0x002b, + [0x2c] = 0x002c, [0x2d] = 0x002d, [0x2e] = 0x002e, [0x2f] = 0x002f, + [0x30] = 0x0030, [0x31] = 0x0031, [0x32] = 0x0032, [0x33] = 0x0033, + [0x34] = 0x0034, [0x35] = 0x0035, [0x36] = 0x0036, [0x37] = 0x0037, + [0x38] = 0x0038, [0x39] = 0x0039, [0x3a] = 0x003a, [0x3b] = 0x003b, + [0x3c] = 0x003c, [0x3d] = 0x003d, [0x3e] = 0x003e, [0x3f] = 0x003f, + [0x40] = 0x0040, [0x41] = 0x0041, [0x42] = 0x0042, [0x43] = 0x0043, + [0x44] = 0x0044, [0x45] = 0x0045, [0x46] = 0x0046, [0x47] = 0x0047, + [0x48] = 0x0048, [0x49] = 0x0049, [0x4a] = 0x004a, [0x4b] = 0x004b, + [0x4c] = 0x004c, [0x4d] = 0x004d, [0x4e] = 0x004e, [0x4f] = 0x004f, + [0x50] = 0x0050, [0x51] = 0x0051, [0x52] = 0x0052, [0x53] = 0x0053, + [0x54] = 0x0054, [0x55] = 0x0055, [0x56] = 0x0056, [0x57] = 0x0057, + [0x58] = 0x0058, [0x59] = 0x0059, [0x5a] = 0x005a, [0x5b] = 0x005b, + [0x5c] = 0x005c, [0x5d] = 0x005d, [0x5e] = 0x005e, [0x5f] = 0x005f, + [0x60] = 0x0060, [0x61] = 0x0061, [0x62] = 0x0062, [0x63] = 0x0063, + [0x64] = 0x0064, [0x65] = 0x0065, [0x66] = 0x0066, [0x67] = 0x0067, + [0x68] = 0x0068, [0x69] = 0x0069, [0x6a] = 0x006a, [0x6b] = 0x006b, + [0x6c] = 0x006c, [0x6d] = 0x006d, [0x6e] = 0x006e, [0x6f] = 0x006f, + [0x70] = 0x0070, [0x71] = 0x0071, [0x72] = 0x0072, [0x73] = 0x0073, + [0x74] = 0x0074, [0x75] = 0x0075, [0x76] = 0x0076, [0x77] = 0x0077, + [0x78] = 0x0078, [0x79] = 0x0079, [0x7a] = 0x007a, [0x7b] = 0x007b, + [0x7c] = 0x007c, [0x7d] = 0x007d, [0x7e] = 0x007e, [0x7f] = 0x007f, + [0x80] = 0x0080, [0x81] = 0x0081, [0x82] = 0x0082, [0x83] = 0x0083, + [0x84] = 0x0084, [0x85] = 0x0085, [0x86] = 0x0086, [0x87] = 0x0087, + [0x88] = 0x0088, [0x89] = 0x0089, [0x8a] = 0x008a, [0x8b] = 0x008b, + [0x8c] = 0x008c, [0x8d] = 0x008d, [0x8e] = 0x008e, [0x8f] = 0x008f, + [0x90] = 0x0090, [0x91] = 0x0091, [0x92] = 0x0092, [0x93] = 0x0093, + [0x94] = 0x0094, [0x95] = 0x0095, [0x96] = 0x0096, [0x97] = 0x0097, + [0x98] = 0x0098, [0x99] = 0x0099, [0x9a] = 0x009a, [0x9b] = 0x009b, + [0x9c] = 0x009c, [0x9d] = 0x009d, [0x9e] = 0x009e, [0x9f] = 0x009f, + [0xa0] = 0x00a0, [0xa1] = 0x00a1, [0xa2] = 0x00a2, [0xa3] = 0x00a3, + [0xa4] = 0x20ac, [0xa5] = 0x00a5, [0xa6] = 0x00a6, [0xa7] = 0x00a7, + [0xa8] = 0x0153, [0xa9] = 0x00a9, [0xaa] = 0x00aa, [0xab] = 0x00ab, + [0xac] = 0x00ac, [0xad] = 0x00ad, [0xae] = 0x00ae, [0xaf] = 0x00af, + [0xb0] = 0x00b0, [0xb1] = 0x00b1, [0xb2] = 0x00b2, [0xb3] = 0x00b3, + [0xb4] = 0x0178, [0xb5] = 0x00b5, [0xb6] = 0x00b6, [0xb7] = 0x00b7, + [0xb8] = 0x0152, [0xb9] = 0x00b9, [0xba] = 0x00ba, [0xbb] = 0x00bb, + [0xbc] = 0x00bc, [0xbd] = 0x00bd, [0xbe] = 0x00be, [0xbf] = 0x00bf, + [0xc0] = 0x00c0, [0xc1] = 0x00c1, [0xc2] = 0x00c2, [0xc3] = 0x0102, + [0xc4] = 0x00c4, [0xc5] = 0x00c5, [0xc6] = 0x00c6, [0xc7] = 0x00c7, + [0xc8] = 0x00c8, [0xc9] = 0x00c9, [0xca] = 0x00ca, [0xcb] = 0x00cb, + [0xcc] = 0x0300, [0xcd] = 0x00cd, [0xce] = 0x00ce, [0xcf] = 0x00cf, + [0xd0] = 0x0110, [0xd1] = 0x00d1, [0xd2] = 0x0309, [0xd3] = 0x00d3, + [0xd4] = 0x00d4, [0xd5] = 0x01a0, [0xd6] = 0x00d6, [0xd7] = 0x00d7, + [0xd8] = 0x00d8, [0xd9] = 0x00d9, [0xda] = 0x00da, [0xdb] = 0x00db, + [0xdc] = 0x00dc, [0xdd] = 0x01af, [0xde] = 0x0303, [0xdf] = 0x00df, + [0xe0] = 0x00e0, [0xe1] = 0x00e1, [0xe2] = 0x00e2, [0xe3] = 0x0103, + [0xe4] = 0x00e4, [0xe5] = 0x00e5, [0xe6] = 0x00e6, [0xe7] = 0x00e7, + [0xe8] = 0x00e8, [0xe9] = 0x00e9, [0xea] = 0x00ea, [0xeb] = 0x00eb, + [0xec] = 0x0301, [0xed] = 0x00ed, [0xee] = 0x00ee, [0xef] = 0x00ef, + [0xf0] = 0x0111, [0xf1] = 0x00f1, [0xf2] = 0x0323, [0xf3] = 0x00f3, + [0xf4] = 0x00f4, [0xf5] = 0x01a1, [0xf6] = 0x00f6, [0xf7] = 0x00f7, + [0xf8] = 0x00f8, [0xf9] = 0x00f9, [0xfa] = 0x00fa, [0xfb] = 0x00fb, + [0xfc] = 0x00fc, [0xfd] = 0x01b0, [0xfe] = 0x20ab, [0xff] = 0x00ff +}; + +static const struct gap from_idx[] = +{ + { start: 0x0000, end: 0x0103, idx: 0 }, + { start: 0x0110, end: 0x0111, idx: -12 }, + { start: 0x0152, end: 0x0153, idx: -76 }, + { start: 0x0178, end: 0x0178, idx: -112 }, + { start: 0x01a0, end: 0x01a1, idx: -151 }, + { start: 0x01af, end: 0x01b0, idx: -164 }, + { start: 0x0300, end: 0x0309, idx: -499 }, + { start: 0x0323, end: 0x0323, idx: -524 }, + { start: 0x203e, end: 0x203e, idx: -7974 }, + { start: 0x20ab, end: 0x20ac, idx: -8082 }, + { start: 0xffff, end: 0xffff, idx: 0 } +}; + +static const char from_ucs4[] = +{ + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', + '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', + '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', + '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', + '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', + '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', + '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', + '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', + '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\x80', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87', + '\x88', '\x89', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f', + '\x90', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', '\x97', + '\x98', '\x99', '\x9a', '\x9b', '\x9c', '\x9d', '\x9e', '\x9f', + '\xa0', '\xa1', '\xa2', '\xa3', '\x00', '\xa5', '\xa6', '\xa7', + '\x00', '\xa9', '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf', + '\xb0', '\xb1', '\xb2', '\xb3', '\x00', '\xb5', '\xb6', '\xb7', + '\x00', '\xb9', '\xba', '\xbb', '\xbc', '\xbd', '\xbe', '\xbf', + '\xc0', '\xc1', '\xc2', '\x00', '\xc4', '\xc5', '\xc6', '\xc7', + '\xc8', '\xc9', '\xca', '\xcb', '\x00', '\xcd', '\xce', '\xcf', + '\xd0', '\xd1', '\x00', '\xd3', '\xd4', '\x00', '\xd6', '\xd7', + '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\x00', '\x00', '\xdf', + '\xe0', '\xe1', '\xe2', '\x00', '\xe4', '\xe5', '\xe6', '\xe7', + '\xe8', '\xe9', '\xea', '\xeb', '\x00', '\xed', '\xee', '\xef', + '\x00', '\xf1', '\x00', '\xf3', '\xf4', '\x00', '\xf6', '\xf7', + '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\x00', '\x00', '\xff', + '\x00', '\x00', '\xc3', '\xe3', '\xd0', '\xf0', '\xb8', '\xa8', + '\xb4', '\xd5', '\xf5', '\xdd', '\xfd', '\xcc', '\xec', '\x00', + '\xde', '\x00', '\x00', '\x00', '\x00', '\x00', '\xd2', '\xf2', + '\xaf', '\xfe', '\xa4' +}; diff --git a/iconvdata/ibm1164.c b/iconvdata/ibm1164.c new file mode 100644 index 0000000000..5ada460d99 --- /dev/null +++ b/iconvdata/ibm1164.c @@ -0,0 +1,29 @@ +/* Conversion from and to IBM1164. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdint.h> + +/* Get the conversion table. */ +#define TABLES <ibm1164.h> + +#define CHARSET_NAME "IBM1164//" +#define HAS_HOLES 0 /* All 256 character are defined. */ + +#include <8bit-gap.c> diff --git a/iconvdata/ibm1164.h b/iconvdata/ibm1164.h new file mode 100644 index 0000000000..e1dcb1ba2e --- /dev/null +++ b/iconvdata/ibm1164.h @@ -0,0 +1,142 @@ +/* Mapping table for IBM1164. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +static const uint32_t to_ucs4[256] = +{ + [0x00] = 0x0000, [0x01] = 0x0001, [0x02] = 0x0002, [0x03] = 0x0003, + [0x04] = 0x009c, [0x05] = 0x0009, [0x06] = 0x0086, [0x07] = 0x007f, + [0x08] = 0x0097, [0x09] = 0x008d, [0x0a] = 0x008e, [0x0b] = 0x000b, + [0x0c] = 0x000c, [0x0d] = 0x000d, [0x0e] = 0x000e, [0x0f] = 0x000f, + [0x10] = 0x0010, [0x11] = 0x0011, [0x12] = 0x0012, [0x13] = 0x0013, + [0x14] = 0x009d, [0x15] = 0x0085, [0x16] = 0x0008, [0x17] = 0x0087, + [0x18] = 0x0018, [0x19] = 0x0019, [0x1a] = 0x0092, [0x1b] = 0x008f, + [0x1c] = 0x001c, [0x1d] = 0x001d, [0x1e] = 0x001e, [0x1f] = 0x001f, + [0x20] = 0x0080, [0x21] = 0x0081, [0x22] = 0x0082, [0x23] = 0x0083, + [0x24] = 0x0084, [0x25] = 0x000a, [0x26] = 0x0017, [0x27] = 0x001b, + [0x28] = 0x0088, [0x29] = 0x0089, [0x2a] = 0x008a, [0x2b] = 0x008b, + [0x2c] = 0x008c, [0x2d] = 0x0005, [0x2e] = 0x0006, [0x2f] = 0x0007, + [0x30] = 0x0090, [0x31] = 0x0091, [0x32] = 0x0016, [0x33] = 0x0093, + [0x34] = 0x0094, [0x35] = 0x0095, [0x36] = 0x0096, [0x37] = 0x0004, + [0x38] = 0x0098, [0x39] = 0x0099, [0x3a] = 0x009a, [0x3b] = 0x009b, + [0x3c] = 0x0014, [0x3d] = 0x0015, [0x3e] = 0x009e, [0x3f] = 0x001a, + [0x40] = 0x0020, [0x41] = 0x00a0, [0x42] = 0x00e2, [0x43] = 0x00e4, + [0x44] = 0x00e0, [0x45] = 0x00e1, [0x46] = 0x0103, [0x47] = 0x00e5, + [0x48] = 0x00e7, [0x49] = 0x00f1, [0x4a] = 0x005b, [0x4b] = 0x002e, + [0x4c] = 0x003c, [0x4d] = 0x0028, [0x4e] = 0x002b, [0x4f] = 0x0021, + [0x50] = 0x0026, [0x51] = 0x00e9, [0x52] = 0x00ea, [0x53] = 0x00eb, + [0x54] = 0x00e8, [0x55] = 0x00ed, [0x56] = 0x00ee, [0x57] = 0x00ef, + [0x58] = 0x0303, [0x59] = 0x00df, [0x5a] = 0x005d, [0x5b] = 0x0024, + [0x5c] = 0x002a, [0x5d] = 0x0029, [0x5e] = 0x003b, [0x5f] = 0x005e, + [0x60] = 0x002d, [0x61] = 0x002f, [0x62] = 0x00c2, [0x63] = 0x00c4, + [0x64] = 0x00c0, [0x65] = 0x00c1, [0x66] = 0x0102, [0x67] = 0x00c5, + [0x68] = 0x00c7, [0x69] = 0x00d1, [0x6a] = 0x00a6, [0x6b] = 0x002c, + [0x6c] = 0x0025, [0x6d] = 0x005f, [0x6e] = 0x003e, [0x6f] = 0x003f, + [0x70] = 0x00f8, [0x71] = 0x00c9, [0x72] = 0x00ca, [0x73] = 0x00cb, + [0x74] = 0x00c8, [0x75] = 0x00cd, [0x76] = 0x00ce, [0x77] = 0x00cf, + [0x78] = 0x20ab, [0x79] = 0x0060, [0x7a] = 0x003a, [0x7b] = 0x0023, + [0x7c] = 0x0040, [0x7d] = 0x0027, [0x7e] = 0x003d, [0x7f] = 0x0022, + [0x80] = 0x00d8, [0x81] = 0x0061, [0x82] = 0x0062, [0x83] = 0x0063, + [0x84] = 0x0064, [0x85] = 0x0065, [0x86] = 0x0066, [0x87] = 0x0067, + [0x88] = 0x0068, [0x89] = 0x0069, [0x8a] = 0x00ab, [0x8b] = 0x00bb, + [0x8c] = 0x0111, [0x8d] = 0x0309, [0x8e] = 0x0300, [0x8f] = 0x00b1, + [0x90] = 0x00b0, [0x91] = 0x006a, [0x92] = 0x006b, [0x93] = 0x006c, + [0x94] = 0x006d, [0x95] = 0x006e, [0x96] = 0x006f, [0x97] = 0x0070, + [0x98] = 0x0071, [0x99] = 0x0072, [0x9a] = 0x00aa, [0x9b] = 0x00ba, + [0x9c] = 0x00e6, [0x9d] = 0x0152, [0x9e] = 0x00c6, [0x9f] = 0x20ac, + [0xa0] = 0x00b5, [0xa1] = 0x007e, [0xa2] = 0x0073, [0xa3] = 0x0074, + [0xa4] = 0x0075, [0xa5] = 0x0076, [0xa6] = 0x0077, [0xa7] = 0x0078, + [0xa8] = 0x0079, [0xa9] = 0x007a, [0xaa] = 0x00a1, [0xab] = 0x00bf, + [0xac] = 0x0110, [0xad] = 0x0323, [0xae] = 0x0301, [0xaf] = 0x00ae, + [0xb0] = 0x00a2, [0xb1] = 0x00a3, [0xb2] = 0x00a5, [0xb3] = 0x00b7, + [0xb4] = 0x00a9, [0xb5] = 0x00a7, [0xb6] = 0x00b6, [0xb7] = 0x00bc, + [0xb8] = 0x00bd, [0xb9] = 0x00be, [0xba] = 0x00ac, [0xbb] = 0x007c, + [0xbc] = 0x00af, [0xbd] = 0x0153, [0xbe] = 0x0178, [0xbf] = 0x00d7, + [0xc0] = 0x007b, [0xc1] = 0x0041, [0xc2] = 0x0042, [0xc3] = 0x0043, + [0xc4] = 0x0044, [0xc5] = 0x0045, [0xc6] = 0x0046, [0xc7] = 0x0047, + [0xc8] = 0x0048, [0xc9] = 0x0049, [0xca] = 0x00ad, [0xcb] = 0x00f4, + [0xcc] = 0x00f6, [0xcd] = 0x01b0, [0xce] = 0x00f3, [0xcf] = 0x01a1, + [0xd0] = 0x007d, [0xd1] = 0x004a, [0xd2] = 0x004b, [0xd3] = 0x004c, + [0xd4] = 0x004d, [0xd5] = 0x004e, [0xd6] = 0x004f, [0xd7] = 0x0050, + [0xd8] = 0x0051, [0xd9] = 0x0052, [0xda] = 0x00b9, [0xdb] = 0x00fb, + [0xdc] = 0x00fc, [0xdd] = 0x00f9, [0xde] = 0x00fa, [0xdf] = 0x00ff, + [0xe0] = 0x005c, [0xe1] = 0x00f7, [0xe2] = 0x0053, [0xe3] = 0x0054, + [0xe4] = 0x0055, [0xe5] = 0x0056, [0xe6] = 0x0057, [0xe7] = 0x0058, + [0xe8] = 0x0059, [0xe9] = 0x005a, [0xea] = 0x00b2, [0xeb] = 0x00d4, + [0xec] = 0x00d6, [0xed] = 0x01af, [0xee] = 0x00d3, [0xef] = 0x01a0, + [0xf0] = 0x0030, [0xf1] = 0x0031, [0xf2] = 0x0032, [0xf3] = 0x0033, + [0xf4] = 0x0034, [0xf5] = 0x0035, [0xf6] = 0x0036, [0xf7] = 0x0037, + [0xf8] = 0x0038, [0xf9] = 0x0039, [0xfa] = 0x00b3, [0xfb] = 0x00db, + [0xfc] = 0x00dc, [0xfd] = 0x00d9, [0xfe] = 0x00da, [0xff] = 0x009f +}; + +static const struct gap from_idx[] = +{ + { start: 0x0000, end: 0x0103, idx: 0 }, + { start: 0x0110, end: 0x0111, idx: -12 }, + { start: 0x0152, end: 0x0153, idx: -76 }, + { start: 0x0178, end: 0x0178, idx: -112 }, + { start: 0x01a0, end: 0x01a1, idx: -151 }, + { start: 0x01af, end: 0x01b0, idx: -164 }, + { start: 0x0300, end: 0x0309, idx: -499 }, + { start: 0x0323, end: 0x0323, idx: -524 }, + { start: 0x203e, end: 0x203e, idx: -7974 }, + { start: 0x20ab, end: 0x20ac, idx: -8082 }, + { start: 0xffff, end: 0xffff, idx: 0 } +}; + +static const char from_ucs4[] = +{ + '\x00', '\x01', '\x02', '\x03', '\x37', '\x2d', '\x2e', '\x2f', + '\x16', '\x05', '\x25', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x3c', '\x3d', '\x32', '\x26', + '\x18', '\x19', '\x3f', '\x27', '\x1c', '\x1d', '\x1e', '\x1f', + '\x40', '\x4f', '\x7f', '\x7b', '\x5b', '\x6c', '\x50', '\x7d', + '\x4d', '\x5d', '\x5c', '\x4e', '\x6b', '\x60', '\x4b', '\x61', + '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7', + '\xf8', '\xf9', '\x7a', '\x5e', '\x4c', '\x7e', '\x6e', '\x6f', + '\x7c', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7', + '\xc8', '\xc9', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', + '\xd7', '\xd8', '\xd9', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', + '\xe7', '\xe8', '\xe9', '\x4a', '\xe0', '\x5a', '\x5f', '\x6d', + '\x79', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87', + '\x88', '\x89', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', + '\x97', '\x98', '\x99', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', + '\xa7', '\xa8', '\xa9', '\xc0', '\xbb', '\xd0', '\xa1', '\x07', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x15', '\x06', '\x17', + '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x09', '\x0a', '\x1b', + '\x30', '\x31', '\x1a', '\x33', '\x34', '\x35', '\x36', '\x08', + '\x38', '\x39', '\x3a', '\x3b', '\x04', '\x14', '\x3e', '\xff', + '\x41', '\xaa', '\xb0', '\xb1', '\x00', '\xb2', '\x6a', '\xb5', + '\x00', '\xb4', '\x9a', '\x8a', '\xba', '\xca', '\xaf', '\xbc', + '\x90', '\x8f', '\xea', '\xfa', '\x00', '\xa0', '\xb6', '\xb3', + '\x00', '\xda', '\x9b', '\x8b', '\xb7', '\xb8', '\xb9', '\xab', + '\x64', '\x65', '\x62', '\x00', '\x63', '\x67', '\x9e', '\x68', + '\x74', '\x71', '\x72', '\x73', '\x00', '\x75', '\x76', '\x77', + '\xac', '\x69', '\x00', '\xee', '\xeb', '\x00', '\xec', '\xbf', + '\x80', '\xfd', '\xfe', '\xfb', '\xfc', '\x00', '\x00', '\x59', + '\x44', '\x45', '\x42', '\x00', '\x43', '\x47', '\x9c', '\x48', + '\x54', '\x51', '\x52', '\x53', '\x00', '\x55', '\x56', '\x57', + '\x00', '\x49', '\x00', '\xce', '\xcb', '\x00', '\xcc', '\xe1', + '\x70', '\xdd', '\xde', '\xdb', '\xdc', '\x00', '\x00', '\xdf', + '\x00', '\x00', '\x66', '\x46', '\xac', '\x8c', '\x9d', '\xbd', + '\xbe', '\xef', '\xcf', '\xed', '\xcd', '\x8e', '\xae', '\x00', + '\x58', '\x00', '\x00', '\x00', '\x00', '\x00', '\x8d', '\xad', + '\xbc', '\x78', '\x9f' +}; diff --git a/iconvdata/ibm856.h b/iconvdata/ibm856.h index f6b2968665..b98142329e 100644 --- a/iconvdata/ibm856.h +++ b/iconvdata/ibm856.h @@ -1,5 +1,5 @@ /* Tables for conversion from and to IBM856. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000. @@ -136,8 +136,7 @@ static const struct gap from_idx[] = { start: 0x2663, end: 0x2663, idx: -9588 }, { start: 0x2665, end: 0x2666, idx: -9589 }, { start: 0x266a, end: 0x266b, idx: -9592 }, - { start: 0xff01, end: 0xff5e, idx: -65037 }, - { start: 0xffe8, end: 0xffee, idx: -65174 }, + { start: 0xffe8, end: 0xffee, idx: -65268 }, { start: 0xffff, end: 0xffff, idx: 0 } }; @@ -170,16 +169,5 @@ static const char from_ucs4[] = '\xca', '\xce', '\xdf', '\xdc', '\xdb', '\xb0', '\xb1', '\xb2', '\xfe', '\x16', '\x1e', '\x10', '\x1f', '\x11', '\x09', '\x08', '\x0a', '\x01', '\x02', '\x0f', '\x0c', '\x0b', '\x06', '\x05', '\x03', '\x04', '\x0d', - '\x0e', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', - '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', '\x30', '\x31', - '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', - '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', '\x40', '\x41', '\x42', '\x43', - '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', - '\x4d', '\x4e', '\x4f', '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', - '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', - '\x5f', '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', - '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', '\x70', - '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', - '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\xb3', '\x1b', '\x18', '\x1a', - '\x19', '\xfe', '\x09' + '\x0e', '\xb3', '\x1b', '\x18', '\x1a', '\x19', '\xfe', '\x09' }; diff --git a/iconvdata/ibm922.h b/iconvdata/ibm922.h index fb945f1c29..2eb16fc622 100644 --- a/iconvdata/ibm922.h +++ b/iconvdata/ibm922.h @@ -1,5 +1,5 @@ /* Tables for conversion from and to IBM922. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2000. @@ -88,36 +88,35 @@ static const uint32_t to_ucs4[256] = static const struct gap from_idx[] = { - { start: 0x0000, end: 0x00ff, idx: 0 }, - { start: 0x0160, end: 0x0161, idx: -96 }, - { start: 0x017d, end: 0x017e, idx: -123 }, - { start: 0x2017, end: 0x2017, idx: -7955 }, - { start: 0x2022, end: 0x2022, idx: -7965 }, - { start: 0x203c, end: 0x203e, idx: -7990 }, - { start: 0x2190, end: 0x2195, idx: -8327 }, - { start: 0x21a8, end: 0x21a8, idx: -8345 }, - { start: 0x221f, end: 0x221f, idx: -8463 }, - { start: 0x2264, end: 0x2265, idx: -8531 }, - { start: 0x2500, end: 0x2502, idx: -9197 }, - { start: 0x250c, end: 0x251c, idx: -9206 }, - { start: 0x2524, end: 0x2524, idx: -9213 }, - { start: 0x252c, end: 0x252c, idx: -9220 }, - { start: 0x2534, end: 0x2534, idx: -9227 }, - { start: 0x253c, end: 0x253c, idx: -9234 }, - { start: 0x2550, end: 0x256c, idx: -9253 }, - { start: 0x2580, end: 0x2588, idx: -9272 }, - { start: 0x2591, end: 0x2593, idx: -9280 }, - { start: 0x25a0, end: 0x25a0, idx: -9292 }, - { start: 0x25ac, end: 0x25b2, idx: -9303 }, - { start: 0x25ba, end: 0x25bc, idx: -9310 }, - { start: 0x25c4, end: 0x25c4, idx: -9317 }, - { start: 0x25cb, end: 0x25cb, idx: -9323 }, - { start: 0x25d8, end: 0x25d9, idx: -9335 }, - { start: 0x263a, end: 0x2642, idx: -9431 }, - { start: 0x2660, end: 0x266c, idx: -9460 }, - { start: 0xff01, end: 0xff5e, idx: -64904 }, - { start: 0xffe8, end: 0xffee, idx: -65041 }, - { start: 0xffff, end: 0xffff, idx: 0 } + { start: 0x0000, end: 0x00ff, idx: 0 }, + { start: 0x0160, end: 0x0161, idx: -96 }, + { start: 0x017d, end: 0x017e, idx: -123 }, + { start: 0x2017, end: 0x2017, idx: -7955 }, + { start: 0x2022, end: 0x2022, idx: -7965 }, + { start: 0x203c, end: 0x203e, idx: -7990 }, + { start: 0x2190, end: 0x2195, idx: -8327 }, + { start: 0x21a8, end: 0x21a8, idx: -8345 }, + { start: 0x221f, end: 0x221f, idx: -8463 }, + { start: 0x2264, end: 0x2265, idx: -8531 }, + { start: 0x2500, end: 0x2502, idx: -9197 }, + { start: 0x250c, end: 0x251c, idx: -9206 }, + { start: 0x2524, end: 0x2524, idx: -9213 }, + { start: 0x252c, end: 0x252c, idx: -9220 }, + { start: 0x2534, end: 0x2534, idx: -9227 }, + { start: 0x253c, end: 0x253c, idx: -9234 }, + { start: 0x2550, end: 0x256c, idx: -9253 }, + { start: 0x2580, end: 0x2588, idx: -9272 }, + { start: 0x2591, end: 0x2593, idx: -9280 }, + { start: 0x25a0, end: 0x25a0, idx: -9292 }, + { start: 0x25ac, end: 0x25b2, idx: -9303 }, + { start: 0x25ba, end: 0x25bc, idx: -9310 }, + { start: 0x25c4, end: 0x25c4, idx: -9317 }, + { start: 0x25cb, end: 0x25cb, idx: -9323 }, + { start: 0x25d8, end: 0x25d9, idx: -9335 }, + { start: 0x263a, end: 0x2642, idx: -9431 }, + { start: 0x2660, end: 0x266c, idx: -9460 }, + { start: 0xffe8, end: 0xffee, idx: -65135 }, + { start: 0xffff, end: 0xffff, idx: 0 } }; static const char from_ucs4[] = @@ -169,17 +168,5 @@ static const char from_ucs4[] = '\x09', '\x08', '\x0a', '\x01', '\x02', '\x0f', '\x00', '\x00', '\x00', '\x0c', '\x00', '\x0b', '\x06', '\x00', '\x00', '\x05', '\x00', '\x03', '\x04', '\x00', '\x00', '\x00', '\x0d', '\x00', - '\x0e', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', - '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', - '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', - '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', - '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', - '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', - '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', - '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', - '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', - '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', - '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', - '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x83', - '\x1b', '\x18', '\x1a', '\x19', '\x96', '\x09', + '\x0e', '\x83', '\x1b', '\x18', '\x1a', '\x19', '\x96', '\x09' }; diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c index faadfffcf1..f511e48ae2 100644 --- a/iconvdata/ibm930.c +++ b/iconvdata/ibm930.c @@ -229,7 +229,7 @@ enum \ if (__builtin_expect (ch < rp2->start, 0) \ || (cp = __ucs4_to_ibm930db[ch + rp2->idx], \ - __builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0')) \ + __builtin_expect (cp[0], L'\1')== L'\0' && ch != '\0')) \ { \ /* This is an illegal character. */ \ if (! ignore_errors_p ()) \ diff --git a/iconvdata/ibm930.h b/iconvdata/ibm930.h index cdaec1602f..043e90974b 100644 --- a/iconvdata/ibm930.h +++ b/iconvdata/ibm930.h @@ -5785,7 +5785,7 @@ static const struct gap __ucs4_to_ibm930db_idx[] = { start: 0xffff, end: 0xffff, idx: 0 } }; -static const char * __ucs4_to_ibm930db[] = +static const char __ucs4_to_ibm930db[][2] = { "\x42\x6a", "\x44\x6a", "\x44\x60", "\x44\xed", "\x44\x4b", "\x44\x50", "\x43\x79", "\x44\x7a", "\x44\x7b", "\x41\x61", "\x41\x62", "\x41\x63", @@ -7733,7 +7733,7 @@ static const char * __ucs4_to_ibm930db[] = "\x42\x96", "\x42\x97", "\x42\x98", "\x42\x99", "\x42\xa2", "\x42\xa3", "\x42\xa4", "\x42\xa5", "\x42\xa6", "\x42\xa7", "\x42\xa8", "\x42\xa9", "\x42\xc0", "\x42\x4f", "\x42\xd0", "\x43\xa1", "\x43\x4a", "\x42\x4a", - "\x42\x5f", "\x42\xa1", "\x42\x6a", "\x42\x5b", + "\x42\x5f", "\x42\xa1", "\x00\x00", "\x42\x5b" }; #endif /* ibm930.h */ diff --git a/iconvdata/ibm932.h b/iconvdata/ibm932.h index d8acdf5171..500beb80e6 100644 --- a/iconvdata/ibm932.h +++ b/iconvdata/ibm932.h @@ -1,5 +1,5 @@ /* Tables for conversion from and to IBM932. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2000. @@ -1373,7 +1373,7 @@ static const char __ucs4_to_ibm932sb[] = '\x1f', '\x1c', '\x1e', '\x07', '\x0e', '\x09' }; -static unsigned short __ucs4_to_ibm932db[][2] = +static const unsigned short int __ucs4_to_ibm932db[][2] = { {0x00a6, 0xfa55}, {0x00a7, 0x8198}, {0x00a8, 0x814e}, {0x00b0, 0x818b}, {0x00b1, 0x817d}, {0x00b4, 0x814c}, {0x00b6, 0x81f7}, {0x00d7, 0x817e}, diff --git a/iconvdata/ibm933.h b/iconvdata/ibm933.h index 5c4f5b30dd..2d59db3156 100644 --- a/iconvdata/ibm933.h +++ b/iconvdata/ibm933.h @@ -8698,7 +8698,7 @@ static const struct gap __ucs4_to_ibm933db_idx[] = { start: 0xffff, end: 0xffff, idx: 0 } }; -static const char *__ucs4_to_ibm933db[] = +static const char __ucs4_to_ibm933db[][2] = { "\x49\x5c", "\x49\x62", "\x41\x76", "\x41\x46", "\x4b\x43", "\x41\x48", "\x41\x65", "\x41\x5d", "\x4b\xf6", "\x4b\xf7", "\x49\x53", "\x49\x80", diff --git a/iconvdata/ibm935.h b/iconvdata/ibm935.h index 09ba3777ee..49b63a883a 100644 --- a/iconvdata/ibm935.h +++ b/iconvdata/ibm935.h @@ -4955,7 +4955,7 @@ static const struct gap __ucs4_to_ibm935db_idx[] = { start: 0xffff, end: 0xffff, idx: 0 } }; -static const char *__ucs4_to_ibm935db[] = +static const char __ucs4_to_ibm935db[][2] = { "\x45\x88", "\x44\x6a", "\x44\x60", "\x44\xed", "\x44\x4b", "\x44\x50", "\x43\x45", "\x44\x7a", "\x46\x44", "\x46\x42", "\x46\x48", "\x46\x46", diff --git a/iconvdata/ibm937.c b/iconvdata/ibm937.c index edfbf6683c..39468aa0dd 100644 --- a/iconvdata/ibm937.c +++ b/iconvdata/ibm937.c @@ -184,10 +184,10 @@ enum const char *cp; \ \ /* Use the UCS4 table for single byte. */ \ - cp = __ucs4_to_ibm937sb[ch]; \ if (__builtin_expect (ch >= (sizeof (__ucs4_to_ibm937sb) \ / sizeof (__ucs4_to_ibm937sb[0])), 0) \ - || (__builtin_expect (cp[0], '\1') == '\0' && ch != 0)) \ + || (cp = __ucs4_to_ibm937sb[ch], \ + __builtin_expect (cp[0], '\1') == '\0' && ch != 0)) \ { \ /* Use the UCS4 table for double byte. */ \ cp = __ucs4_to_ibm937db[ch]; \ diff --git a/iconvdata/ibm937.h b/iconvdata/ibm937.h index 5e74bdfa79..02d94336db 100644 --- a/iconvdata/ibm937.h +++ b/iconvdata/ibm937.h @@ -1,5 +1,5 @@ /* Tables for conversion to and from IBM937. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000. @@ -5144,7 +5144,7 @@ static const char __ucs4_to_ibm937sb[][1] = [0x0000] = "\x00", [0x0001] = "\x01", [0x0002] = "\x02", [0x0003] = "\x03", [0x0004] = "\x37", [0x0005] = "\x2d", [0x0006] = "\x2e", [0x0007] = "\x2f", [0x0008] = "\x16", [0x0009] = "\x05", [0x000a] = "\x25", [0x000b] = "\x0b", - [0x000c] = "\x0c", [0x000d] = "\x0d", [0x000e] = "\x3f", [0x000f] = "\x3f", + [0x000c] = "\x0c", [0x000d] = "\x0d", [0x0010] = "\x10", [0x0011] = "\x11", [0x0012] = "\x12", [0x0013] = "\x13", [0x0014] = "\x3c", [0x0015] = "\x3d", [0x0016] = "\x32", [0x0017] = "\x26", [0x0018] = "\x18", [0x0019] = "\x19", [0x001a] = "\x3f", [0x001b] = "\x27", @@ -5181,28 +5181,7 @@ static const char __ucs4_to_ibm937sb[][1] = [0x0094] = "\x34", [0x0095] = "\x35", [0x0096] = "\x36", [0x0097] = "\x08", [0x0098] = "\x38", [0x0099] = "\x39", [0x009a] = "\x3a", [0x009b] = "\x3b", [0x009c] = "\x04", [0x009d] = "\x14", [0x009e] = "\x3e", [0x009f] = "\xff", - [0x00a0] = "\x3f", [0x00a1] = "\x3f", [0x00a2] = "\x4a", [0x00a3] = "\x3f", - [0x00a4] = "\x3f", [0x00a5] = "\x3f", [0x00a6] = "\x6a", [0x00a9] = "\x3f", - [0x00aa] = "\x3f", [0x00ab] = "\x3f", [0x00ac] = "\x5f", [0x00ad] = "\x3f", - [0x00ae] = "\x3f", [0x00b2] = "\x3f", [0x00b3] = "\x3f", [0x00b5] = "\x3f", - [0x00b8] = "\x3f", [0x00b9] = "\x3f", [0x00ba] = "\x3f", [0x00bb] = "\x3f", - [0x00bc] = "\x3f", [0x00bd] = "\x3f", [0x00be] = "\x3f", [0x00bf] = "\x3f", - [0x00c0] = "\x3f", [0x00c1] = "\x3f", [0x00c2] = "\x3f", [0x00c3] = "\x3f", - [0x00c4] = "\x3f", [0x00c5] = "\x3f", [0x00c6] = "\x3f", [0x00c7] = "\x3f", - [0x00c8] = "\x3f", [0x00c9] = "\x3f", [0x00ca] = "\x3f", [0x00cb] = "\x3f", - [0x00cc] = "\x3f", [0x00cd] = "\x3f", [0x00ce] = "\x3f", [0x00cf] = "\x3f", - [0x00d0] = "\x3f", [0x00d1] = "\x3f", [0x00d2] = "\x3f", [0x00d3] = "\x3f", - [0x00d4] = "\x3f", [0x00d5] = "\x3f", [0x00d6] = "\x3f", [0x00d8] = "\x3f", - [0x00d9] = "\x3f", [0x00da] = "\x3f", [0x00db] = "\x3f", [0x00dc] = "\x3f", - [0x00dd] = "\x3f", [0x00de] = "\x3f", [0x00df] = "\x3f", [0x00e0] = "\x3f", - [0x00e1] = "\x3f", [0x00e2] = "\x3f", [0x00e3] = "\x3f", [0x00e4] = "\x3f", - [0x00e5] = "\x3f", [0x00e6] = "\x3f", [0x00e7] = "\x3f", [0x00e8] = "\x3f", - [0x00e9] = "\x3f", [0x00ea] = "\x3f", [0x00eb] = "\x3f", [0x00ec] = "\x3f", - [0x00ed] = "\x3f", [0x00ee] = "\x3f", [0x00ef] = "\x3f", [0x00f0] = "\x3f", - [0x00f1] = "\x3f", [0x00f2] = "\x3f", [0x00f3] = "\x3f", [0x00f4] = "\x3f", - [0x00f5] = "\x3f", [0x00f6] = "\x3f", [0x00f8] = "\x3f", [0x00f9] = "\x3f", - [0x00fa] = "\x3f", [0x00fb] = "\x3f", [0x00fc] = "\x3f", [0x00fd] = "\x3f", - [0x00fe] = "\x3f", [0x00ff] = "\x3f" + [0x00a2] = "\x4a", [0x00a6] = "\x6a", [0x00ac] = "\x5f" }; static const char __ucs4_to_ibm937db[][2] = diff --git a/iconvdata/ibm939.h b/iconvdata/ibm939.h index e70bd31e8e..38270133ba 100644 --- a/iconvdata/ibm939.h +++ b/iconvdata/ibm939.h @@ -5785,7 +5785,7 @@ static const struct gap __ucs4_to_ibm939db_idx[] = { start: 0xffff, end: 0xffff, idx: 0 } }; -static const char * __ucs4_to_ibm939db[] = +static const char __ucs4_to_ibm939db[][2] = { "\x42\x6a", "\x44\x6a", "\x44\x60", "\x44\xed", "\x44\x4b", "\x44\x50", "\x43\x79", "\x44\x7a", "\x44\x7b", "\x41\x61", "\x41\x62", "\x41\x63", diff --git a/iconvdata/ibm943.h b/iconvdata/ibm943.h index c0efd34bef..09a3c8d905 100644 --- a/iconvdata/ibm943.h +++ b/iconvdata/ibm943.h @@ -1,5 +1,5 @@ /* Tables for conversion from and to IBM943. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Masahide Washizawa <washi@jp.ibm.com>, 2000. @@ -1412,7 +1412,7 @@ static const char __ucs4_to_ibm943sb[] = '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde', '\xdf' }; -static unsigned short __ucs4_to_ibm943db[][2] = +static const unsigned short int __ucs4_to_ibm943db[][2] = { {0x00a6, 0xfa55}, {0x00a7, 0x8198}, {0x00a8, 0x814e}, {0x00b0, 0x818b}, {0x00b1, 0x817d}, {0x00b4, 0x814c}, {0x00b6, 0x81f7}, {0x00d7, 0x817e}, diff --git a/iconvdata/testdata/IBM1163 b/iconvdata/testdata/IBM1163 new file mode 100644 index 0000000000..5dc8a2a301 --- /dev/null +++ b/iconvdata/testdata/IBM1163 @@ -0,0 +1,14 @@ + ! " # $ % & ' ( ) * + , - . / 0 +1 2 3 4 5 6 7 8 9 : ; < = > ? @ A +B C D E F G H I J K L M N O P Q R +S T U V W X Y Z [ \ ] ^ _ ` a b c +d e f g h i j k l m n o p q r s t +u v w x y z { | } ~ + + + + + + + + diff --git a/iconvdata/testdata/IBM1163..UTF8 b/iconvdata/testdata/IBM1163..UTF8 new file mode 100644 index 0000000000..8e7fa89a58 --- /dev/null +++ b/iconvdata/testdata/IBM1163..UTF8 @@ -0,0 +1,14 @@ + ! " # $ % & ' ( ) * + , - . / 0 +1 2 3 4 5 6 7 8 9 : ; < = > ? @ A +B C D E F G H I J K L M N O P Q R +S T U V W X Y Z [ \ ] ^ _ ` a b c +d e f g h i j k l m n o p q r s t +u v w x y z { | } ~
+ + ¡ ¢ £ € ¥ ¦ § +œ © ª « ¬ ® ¯ ° ± ² ³ Ÿ µ ¶ · Œ +¹ º » ¼ ½ ¾ ¿ À Á Â Ă Ä Å Æ Ç È É +Ê Ë ̀ Í Î Ï Đ Ñ ̉ Ó Ô Ơ Ö × Ø Ù Ú +Û Ü Ư ̃ ß à á â ă ä å æ ç è é ê ë +́ í î ï đ ñ ̣ ó ô ơ ö ÷ ø ù ú û ü +ư ₫ ÿ diff --git a/iconvdata/testdata/IBM1164 b/iconvdata/testdata/IBM1164 new file mode 100644 index 0000000000..5dc8a2a301 --- /dev/null +++ b/iconvdata/testdata/IBM1164 @@ -0,0 +1,14 @@ + ! " # $ % & ' ( ) * + , - . / 0 +1 2 3 4 5 6 7 8 9 : ; < = > ? @ A +B C D E F G H I J K L M N O P Q R +S T U V W X Y Z [ \ ] ^ _ ` a b c +d e f g h i j k l m n o p q r s t +u v w x y z { | } ~ + + + + + + + + diff --git a/iconvdata/testdata/IBM1164..UTF8 b/iconvdata/testdata/IBM1164..UTF8 new file mode 100644 index 0000000000..7568fb6c17 --- /dev/null +++ b/iconvdata/testdata/IBM1164..UTF8 @@ -0,0 +1,2 @@ + + âäàáăåçñ[.<(+!&éêëèíîï̃ß]$*);^-/ÂÄÀÁĂÅÇѦ,%_>?øÉÊËÈÍÎÏ₫`:#@'="Øabcdefghi«»đ̉̀±°jklmnopqrªºæŒÆ€µ~stuvwxyz¡¿Đ̣́®¢£¥·©§¶¼½¾¬|¯œŸ×{ABCDEFGHIôöưóơ}JKLMNOPQR¹ûüùúÿ\÷STUVWXYZ²ÔÖƯÓƠ0123456789³ÛÜÙÚ
\ No newline at end of file diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 307388b6f6..dcc18cc6e6 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,21 @@ +2001-11-28 Kaz Kylheku <kaz@ashi.footprints.net> + + Bugfix to pthread_key_delete. It was iterating over the thread + manager's linked list of threads, behind the thread manager's + back causing a race. The fix is to have the manager iterate over + the threads instead, using a new request type for doing so. + * internals.h (struct pthread_request): New manager request type + REQ_FOR_EACH_THREAD. + * manager.c (pthread_for_each_thread): New function. + (__pthread_manager): Handle new REQ_FOR_EACH_THREAD request. + * specific.c (struct pthread_key_delete_helper_args): New type. + (pthread_key_delete_helper): New static function. + (pthread_key_delete): Use the new thread manager + REQ_FOR_EACH_THREAD function to iterate over the threads and set + the delete key slot to a null value in each thread. + * Examples/ex18.c: New test. + * Makefile (tests): Add ex18. + 2001-11-22 Wolfram Gloger <wg@malloc.de> * pthread.c (pthread_onexit_process): Don't call free diff --git a/linuxthreads/Examples/ex18.c b/linuxthreads/Examples/ex18.c new file mode 100644 index 0000000000..642f6b44cd --- /dev/null +++ b/linuxthreads/Examples/ex18.c @@ -0,0 +1,112 @@ +/* + * Beat up the pthread_key_create and pthread_key_delete + * functions. + */ + +#if 0 +#define CHATTY +#endif + +#include <stdio.h> +#include <errno.h> +#include <stdlib.h> +#include <pthread.h> + +const int beatup_iterations = 10000; +const int num_threads = 30; +const int max_keys = 500; + +struct key_list { + struct key_list *next; + pthread_key_t key; +}; + +struct key_list *key_list; +pthread_mutex_t key_lock = PTHREAD_MUTEX_INITIALIZER; + +/* + * Create a new key and put it at the tail of a linked list. + * If the linked list grows to a certain length, delete a key from the + * head of * the list. + */ + +static void +beat_up(void) +{ + struct key_list *new = malloc(sizeof *new); + struct key_list **iter, *old_key = 0; + int key_count = 0; + + if (new == 0) { + fprintf(stderr, "malloc failed\n"); + abort(); + } + + new->next = 0; + + if (pthread_key_create(&new->key, 0) != 0) { + fprintf(stderr, "pthread_key_create failed\n"); + abort(); + } + + if (pthread_getspecific(new->key) != 0) { + fprintf(stderr, "new pthread_key_t resolves to non-null value\n"); + abort(); + } + + pthread_setspecific(new->key, (void *) 1); + +#ifdef CHATTY + printf("created key\n"); +#endif + + pthread_mutex_lock(&key_lock); + + for (iter = &key_list; *iter != 0; iter = &(*iter)->next) + key_count++; + + *iter = new; + + if (key_count > max_keys) { + old_key = key_list; + key_list = key_list->next; + } + + pthread_mutex_unlock(&key_lock); + + if (old_key != 0) { +#ifdef CHATTY + printf("deleting key\n"); +#endif + pthread_key_delete(old_key->key); + } +} + +static void * +thread(void *arg) +{ + int i; + for (i = 0; i < beatup_iterations; i++) + beat_up(); + return 0; +} + +int +main(void) +{ + int i; + pthread_attr_t detached_thread; + + pthread_attr_init(&detached_thread); + pthread_attr_setdetachstate(&detached_thread, PTHREAD_CREATE_DETACHED); + + for (i = 0; i < num_threads; i++) { + pthread_t thread_id; + while (pthread_create(&thread_id, &detached_thread, thread, 0) == EAGAIN) { + /* let some threads die, so system can breathe. :) */ + sleep(1); + } + } + + pthread_exit(0); +} diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile index b57abd13d3..cf01102db0 100644 --- a/linuxthreads/Makefile +++ b/linuxthreads/Makefile @@ -60,7 +60,7 @@ endif librt-tests = ex10 ex11 tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 $(librt-tests) ex12 ex13 joinrace \ tststack $(tests-nodelete-$(have-z-nodelete)) ecmutex ex14 ex15 ex16 \ - ex17 tst-cancel tst-context + ex17 ex18 tst-cancel tst-context ifeq (yes,$(build-shared)) tests-nodelete-yes = unload diff --git a/linuxthreads/internals.h b/linuxthreads/internals.h index ae49266278..8297c781c8 100644 --- a/linuxthreads/internals.h +++ b/linuxthreads/internals.h @@ -208,7 +208,7 @@ struct pthread_request { pthread_descr req_thread; /* Thread doing the request */ enum { /* Request kind */ REQ_CREATE, REQ_FREE, REQ_PROCESS_EXIT, REQ_MAIN_THREAD_EXIT, - REQ_POST, REQ_DEBUG, REQ_KICK + REQ_POST, REQ_DEBUG, REQ_KICK, REQ_FOR_EACH_THREAD } req_kind; union { /* Arguments for request */ struct { /* For REQ_CREATE: */ @@ -224,6 +224,10 @@ struct pthread_request { int code; /* exit status */ } exit; void * post; /* For REQ_POST: the semaphore */ + struct { /* For REQ_FOR_EACH_THREAD: callback */ + void (*fn)(void *, pthread_descr); + void *arg; + } for_each; } req_args; }; diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c index 0872146e3f..b1a4542d69 100644 --- a/linuxthreads/manager.c +++ b/linuxthreads/manager.c @@ -100,6 +100,8 @@ static void pthread_handle_exit(pthread_descr issuing_thread, int exitcode) __attribute__ ((noreturn)); static void pthread_reap_children(void); static void pthread_kill_all_threads(int sig, int main_thread_also); +static void pthread_for_each_thread(void *arg, + void (*fn)(void *, pthread_descr)); /* The server thread managing requests for thread creation and termination */ @@ -211,6 +213,11 @@ __pthread_manager(void *arg) /* This is just a prod to get the manager to reap some threads right away, avoiding a potential delay at shutdown. */ break; + case REQ_FOR_EACH_THREAD: + pthread_for_each_thread(request.req_args.for_each.arg, + request.req_args.for_each.fn); + restart(request.req_thread); + break; } } } @@ -902,6 +909,20 @@ static void pthread_kill_all_threads(int sig, int main_thread_also) } } +static void pthread_for_each_thread(void *arg, + void (*fn)(void *, pthread_descr)) +{ + pthread_descr th; + + for (th = __pthread_main_thread->p_nextlive; + th != __pthread_main_thread; + th = th->p_nextlive) { + fn(arg, th); + } + + fn(arg, __pthread_main_thread); +} + /* Process-wide exit() */ static void pthread_handle_exit(pthread_descr issuing_thread, int exitcode) diff --git a/linuxthreads/specific.c b/linuxthreads/specific.c index a7fa8ff5b7..1a0cab10b6 100644 --- a/linuxthreads/specific.c +++ b/linuxthreads/specific.c @@ -20,6 +20,7 @@ #include "pthread.h" #include "internals.h" #include "spinlock.h" +#include "restart.h" #include <bits/libc-lock.h> @@ -58,13 +59,38 @@ int __pthread_key_create(pthread_key_t * key, destr_function destr) } strong_alias (__pthread_key_create, pthread_key_create) -/* Delete a key */ +/* Reset deleted key's value to NULL in each live thread. + * NOTE: this executes in the context of the thread manager! */ + +struct pthread_key_delete_helper_args { + /* Damn, we need lexical closures in C! ;) */ + unsigned int idx1st, idx2nd; + pthread_descr self; +}; + +static void pthread_key_delete_helper(void *arg, pthread_descr th) +{ + struct pthread_key_delete_helper_args *args = arg; + unsigned int idx1st = args->idx1st; + unsigned int idx2nd = args->idx2nd; + pthread_descr self = args->self; + + if (self == 0) + self = args->self = thread_self(); + + if (!th->p_terminated) { + /* pthread_exit() may try to free th->p_specific[idx1st] concurrently. */ + __pthread_lock(THREAD_GETMEM(th, p_lock), self); + if (th->p_specific[idx1st] != NULL) + th->p_specific[idx1st][idx2nd] = NULL; + __pthread_unlock(THREAD_GETMEM(th, p_lock)); + } +} +/* Delete a key */ int pthread_key_delete(pthread_key_t key) { pthread_descr self = thread_self(); - pthread_descr th; - unsigned int idx1st, idx2nd; pthread_mutex_lock(&pthread_keys_mutex); if (key >= PTHREAD_KEYS_MAX || !pthread_keys[key].in_use) { @@ -73,23 +99,29 @@ int pthread_key_delete(pthread_key_t key) } pthread_keys[key].in_use = 0; pthread_keys[key].destr = NULL; + /* Set the value of the key to NULL in all running threads, so that if the key is reallocated later by pthread_key_create, its associated values will be NULL in all threads. */ - idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE; - idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE; - th = self; - do { - /* If the thread already is terminated don't modify the memory. */ - if (!th->p_terminated) { - /* pthread_exit() may try to free th->p_specific[idx1st] concurrently. */ - __pthread_lock(THREAD_GETMEM(th, p_lock), self); - if (th->p_specific[idx1st] != NULL) - th->p_specific[idx1st][idx2nd] = NULL; - __pthread_unlock(THREAD_GETMEM(th, p_lock)); - } - th = th->p_nextlive; - } while (th != self); + + { + struct pthread_key_delete_helper_args args; + struct pthread_request request; + + args.idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE; + args.idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE; + args.self = 0; + + request.req_thread = self; + request.req_kind = REQ_FOR_EACH_THREAD; + request.req_args.for_each.arg = &args; + request.req_args.for_each.fn = pthread_key_delete_helper; + + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); + suspend(self); + } + pthread_mutex_unlock(&pthread_keys_mutex); return 0; } |