blob: 628c0e3e3c9a957057205c0df0e35aaa638c895a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/bin/sh
LC_ALL=C
export LC_ALL
echo
echo Generating code page translation tables.
codepages=`cat index.txt|sed 's/
//g'`
if [ -n "$codepages" ]; then
(
n=0
echo '/* Automatically generated by gen-cp */'
for i in $codepages; do
echo -n $i' ' 1>&2
echo
echo 'static struct table_entry table_'$i' [] = {'
tail -n +3 $i.cp | sed 's/#.*$//' | grep '^0x[89a-zA-Z]' | sed 's/[ ][ ]*/ /g' | sed 's/[ ]*$/ },/' | sed 's/ /, /' | sed 's/^[ ]*/ { /' | grep '.*,.*,'
echo ' { 0, 0 }'
echo '};'
echo
echo 'static unsigned char *aliases_'$i' [] = {'`head -2 $i.cp | tail -n +2`', NULL };'
n=`expr $n + 1`
done
echo
echo 'static struct codepage_desc codepages [] = {'
for i in $codepages; do
echo ' { "'`head -1 $i.cp`'", aliases_'$i', table_'$i' },'
done
echo ' { NULL, NULL, NULL }'
echo '};'
echo '#define N_CODEPAGES '$n | sed 's/
//g' > ../codepage.h
) | sed 's/
//g' > ../codepage.inc
echo
echo Done.
fi
echo
|