]> git.saurik.com Git - wxWidgets.git/blob - misc/unictabl/mk_fallbacks.sh
fixed HTML parsing in regard to spaces between tags
[wxWidgets.git] / misc / unictabl / mk_fallbacks.sh
1 #!/bin/sh
2 # CVS-ID: $Id$
3
4
5 add_fallback()
6 {
7 echo " - for $3..."
8 cat _tmp3 | grep "$1" | while read i ; do
9 code=`echo $i | cut -c1-6`
10 echo "$code $2" >> _tmp5
11 done
12 }
13
14
15 echo " * getting list of needed unicode characters..."
16
17 cat mappings/*.TXT | sed -n '/^0x../p' | \
18 cut -f2,4 | sort | uniq | sed -n '/^0x/p' > _tmp1
19 cat _tmp1 | cut -f1 | sort | uniq > _tmp2
20
21
22 echo " * making unique list of unicode characters meanings..."
23
24 rm -f _tmp3
25 cat _tmp2 | while read i ; do
26 sed -n "/^$i/p" _tmp1 | (read t ; echo "$t" >> _tmp3)
27 done
28
29 cp _tmp3 UnicodeChars
30
31 echo " * creating one-byte fallback tables..."
32
33 rm -f Fallbacks _tmp5
34
35 echo " - for latin capital letters..."
36
37 cat _tmp3 | grep 'LATIN CAPITAL LETTER [A-Z]$' > _tmp6
38 cat _tmp3 | grep 'LATIN CAPITAL LETTER [A-Z] WITH' >> _tmp6
39 cat _tmp6 | sort +2 > _tmp4
40
41 cat _tmp4 | while read i ; do
42 code=`echo $i | cut -c1-6`
43 fallb=`echo $i | cut -c8-29`
44 cat _tmp4 | fgrep "$fallb" | cut -c1-6 | (read i ;
45 echo "$code $i" >> _tmp5)
46 done
47
48
49 echo " - for latin small letters..."
50
51 cat _tmp3 | grep 'LATIN SMALL LETTER [A-Z]$' > _tmp6
52 cat _tmp3 | grep 'LATIN SMALL LETTER [A-Z] WITH' >> _tmp6
53 cat _tmp6 | sort +2 > _tmp4
54
55 cat _tmp4 | while read i ; do
56 code=`echo $i | cut -c1-6`
57 fallb=`echo $i | cut -c8-27`
58 cat _tmp4 | fgrep "$fallb" | cut -c1-6 | (read i ;
59 echo "$code $i" >> _tmp5)
60 done
61
62
63 add_fallback "DOUBLE .*QUOTATION MARK" "0x0022" "double quotations"
64 add_fallback "SINGLE .*QUOTATION MARK" "0x0027" "single quotations"
65 add_fallback "DASH" "0x002D" "dashes"
66
67
68
69 echo " * removing infinite loops from fallback tables..."
70
71 cat _tmp5 | grep -v '\(0x....\) \1' | sort > Fallbacks
72
73 rm -f _tmp1 _tmp2 _tmp3 _tmp4 _tmp5 _tmp6
74