diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kexi/kexiutils/generate_transliteration_table.sh | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/kexiutils/generate_transliteration_table.sh')
-rwxr-xr-x | kexi/kexiutils/generate_transliteration_table.sh | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/kexi/kexiutils/generate_transliteration_table.sh b/kexi/kexiutils/generate_transliteration_table.sh new file mode 100755 index 00000000..05470772 --- /dev/null +++ b/kexi/kexiutils/generate_transliteration_table.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# +# Copyright (C) 2006-2007 Jaroslaw Staniek <[email protected]> +# +# Based on the original script by Michal Svec <[email protected]> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This program 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +# +# Generates a transliteration_table.{h|cpp} files using recode's "flat" character set +# + +out_cpp="transliteration_table.cpp" +out_h="transliteration_table.h" +max=65534 + +decl="const char *const transliteration_table[TRANSLITERATION_TABLE_SIZE + 1]" + +header=\ +"/* Transliteration table of `expr $max + 1` unicode characters + Do not edit this file, it is generated + by $0 script. */ + +" +echo "$header +#define TRANSLITERATION_TABLE_SIZE `expr $max + 1` +extern $decl; +" > $out_h + +echo "$header +#include \"$out_h\" +$decl = { +" > $out_cpp + +for i in `seq 0 $max` ; do + f=`printf "%04x" $i` + if [ "$i" -lt 16 -o "$i" -eq 92 ] ; then + printf "$i\n/*$f*/\n_\n" $i + elif [ "$i" -lt 128 ] ; then + ch=`printf "%03o" $i` + printf "$i\n/*$f*/\n\\"$ch"\n" + else + { /usr/bin/printf "${i}\n/*${f}*/\n\u${f}\n" 2>&- || echo "_"; } + fi +done | \ +while read i && read f && read ch; do + if ! expr "$i" % 8 > /dev/null ; then + expr "$i" % 320 > /dev/null || echo -n ..`expr "$i" \* 100 / $max `% >&2 #progress + echo + else + f= # <-- comment to add /*numbers*/ everywhere + fi + r=`echo -n "$ch" | recode -f utf-8..flat | \ + sed -r -e 's/[^[:alnum:]]//g;s/_+/_/g'` + if [ -z "$r" -o "$r" == "_" ] ; then + echo -n "${f}0/*${ch}*/," + else + echo -n "${f}\"$r\"/*${ch}*/," + fi +done >> $out_cpp + +echo "0};" >> $out_cpp; |