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