about summary refs log tree commit diff
path: root/iconvdata/tst-table.sh
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-05 02:41:25 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-05 02:41:25 +0000
commitb79f74cd622578ce5eea1a3ed5840ac53d6b6d93 (patch)
tree2c0e56654a4df00616e8994f181434ddf3246549 /iconvdata/tst-table.sh
parentbcf6d602849db60d9651ffade87f18282c75ebd4 (diff)
downloadglibc-b79f74cd622578ce5eea1a3ed5840ac53d6b6d93.tar.gz
glibc-b79f74cd622578ce5eea1a3ed5840ac53d6b6d93.tar.xz
glibc-b79f74cd622578ce5eea1a3ed5840ac53d6b6d93.zip
Update.
2000-09-03  Bruno Haible  <haible@clisp.cons.org>

	* charmaps/EUC-TW: Add commented non-reversible mappings.

2000-09-03  Bruno Haible  <haible@clisp.cons.org>

	* charmaps/CP949: New file.

2000-09-03  Bruno Haible  <haible@clisp.cons.org>

	* charmaps/GB2312: Remove 0x80..0xA0, 0xAA..0xAF, 0xF8..FF.

2000-09-03  Bruno Haible  <haible@clisp.cons.org>

	* charmaps/EUC-JP: Nonreversibly map 0xA1C0 to U+005C and 0x8FA2B7 to
	U+007E.
Diffstat (limited to 'iconvdata/tst-table.sh')
-rwxr-xr-xiconvdata/tst-table.sh75
1 files changed, 75 insertions, 0 deletions
diff --git a/iconvdata/tst-table.sh b/iconvdata/tst-table.sh
new file mode 100755
index 0000000000..4cd2f6e29b
--- /dev/null
+++ b/iconvdata/tst-table.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+# Copyright (C) 2000 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+# Contributed by Bruno Haible <haible@clisp.cons.org>, 2000.
+#
+# The GNU C 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 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB.  If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Checks that the iconv() implementation (in both directions) for a
+# stateless encoding agrees with the charmap table.
+
+common_objpfx=$1
+objpfx=$2
+charset=$3
+charmap=$4
+
+GCONV_PATH=${common_objpfx}iconvdata
+export GCONV_PATH
+LC_ALL=C
+export LC_ALL
+
+set -e
+
+# Get the charmap.
+./tst-table-charmap.sh ${charmap:-$charset} \
+  < ../localedata/charmaps/${charmap:-$charset} \
+  > ${objpfx}tst-${charset}.charmap.table
+
+# Precompute expected differences between the two iconv directions.
+if test ${charset} = EUC-TW; then
+  irreversible=${objpfx}tst-${charset}.irreversible
+  grep '^0x8EA1' ${objpfx}tst-${charset}.charmap.table > ${irreversible}
+else
+  irreversible=${charset}.irreversible
+fi
+
+# iconv in one direction.
+${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${objpfx}tst-table-from ${charset} \
+  > ${objpfx}tst-${charset}.table
+
+# iconv in the other direction.
+${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${objpfx}tst-table-to ${charset} | sort \
+  > ${objpfx}tst-${charset}.inverse.table
+
+# Difference between the two iconv directions.
+diff ${objpfx}tst-${charset}.table ${objpfx}tst-${charset}.inverse.table | \
+  grep '^[<>]' | sed -e 's,^. ,,' > ${objpfx}tst-${charset}.irreversible.table
+
+# Check 1: charmap and iconv forward should be identical.
+cmp -s ${objpfx}tst-${charset}.charmap.table ${objpfx}tst-${charset}.table
+
+# Check 2: the difference between the two iconv directions.
+if test -f ${irreversible}; then
+  cat ${objpfx}tst-${charset}.charmap.table ${irreversible} | sort | uniq -u \
+    > ${objpfx}tst-${charset}.tmp.table
+  cmp -s ${objpfx}tst-${charset}.tmp.table ${objpfx}tst-${charset}.inverse.table
+else
+  cmp -s ${objpfx}tst-${charset}.table ${objpfx}tst-${charset}.inverse.table
+fi
+
+exit 0