links/Unicode/gen-upc
2021-08-28 18:37:32 +03:00

22 lines
452 B
Bash
Executable file

#!/bin/sh
set -e
LC_ALL=C
export LC_ALL
echo
echo Generating Unicode upcase table.
for file in upcase locase; do
(
echo '/* Automatically generated by gen-upc */'
echo
echo "static_const struct { unsigned short o; unsigned short n; } unicode_$file [] = {"
(
if [ $file = upcase ]; then
echo '00A0 0020'
fi
cat $file.uni
) | sed 's/^\([0-9A-Z]*\) \([0-9A-Z]*\)$/ { 0x\1, 0x\2 },/' | sort
echo '};'
) > ../$file.inc
done
echo Done.
echo