4 echo Generating code page translation tables.
6 codepages
=`cat index.txt`
8 if [ -n "$codepages" ]; then
14 echo '/* Automatically generated by gen-cp */'
15 echo '/* DO NOT EDIT THIS FILE! EDIT Unicode/<whatever> INSTEAD! */'
18 for i
in $codepages; do
26 echo 'struct table_entry table_'$i' [] = {'
28 # TODO: Comments inside of the structure are ugliness in a pure clean
29 # form, and my aesthetical feeling shivers upon glancing at it. However
30 # we should handle commentless records. A loop with read inside would
31 # be ideal, I suppose. --pasky
32 tail -n +3 $i.
cp |
sed 's/# *\(.*\) *$/\/* \1 *\/ /' |
grep '^0x[89a-zA-Z]' \
33 |
sed 's/[ ][ ]*/ /g' |
sed 's/[ ]*$/ },/' |
sed 's/ /, /' \
34 |
sed 's/^[ ]*/ {/' |
grep '.*,.*,'
40 echo 'unsigned char *aliases_'$i' [] = {'
41 head -n 2 $i.
cp |
tail -n +2 |
sed 's/ \+/ /g; s/ $//; s/\", /\",£/g; s/$/,/' |
tr "£" "\n" \
42 |
sed 's/^/£/g' |
tr "£" "\t"
49 echo 'struct codepage_desc codepages [] = {'
51 for i
in $codepages; do
52 echo ' {"'`head -n 1 $i.cp`'", aliases_'$i', table_'$i'},'
55 echo ' {NULL, NULL, NULL}'
59 echo '#define N_CODEPAGES '$n |
sed 's/
//g'
61 ) |
sed 's/
//g' > ..
/src
/intl
/codepage.inc