#!/bin/sh
srcdir="$1"
charset="$2"
set -e
./table-from "$charset" > tmp-"$charset".TXT
./table-to "$charset" | sort > tmp-"$charset".INVERSE.TXT
cmp "${srcdir}"/"$charset".TXT tmp-"$charset".TXT 2> /dev/null
sed -e '/ .* 0x/d' < "${srcdir}"/"$charset".TXT > tmp-noprecomposed-"$charset".TXT
if test -f "${srcdir}"/"$charset".IRREVERSIBLE.TXT; then
cat tmp-noprecomposed-"$charset".TXT "${srcdir}"/"$charset".IRREVERSIBLE.TXT | sort | uniq -u > tmp-orig-"$charset".INVERSE.TXT
else
cp tmp-noprecomposed-"$charset".TXT tmp-orig-"$charset".INVERSE.TXT
fi
cmp tmp-orig-"$charset".INVERSE.TXT tmp-"$charset".INVERSE.TXT 2> /dev/null
rm -f tmp-"$charset".TXT tmp-"$charset".INVERSE.TXT tmp-noprecomposed-"$charset".TXT tmp-orig-"$charset".INVERSE.TXT
exit 0