File: mk_fallbacks.sh

package info (click to toggle)
wxwidgets3.0 3.0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120,464 kB
  • sloc: cpp: 896,633; makefile: 52,303; ansic: 21,971; sh: 5,713; python: 2,940; xml: 1,534; perl: 264; javascript: 33
file content (73 lines) | stat: -rwxr-xr-x 1,739 bytes parent folder | download | duplicates (9)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh


add_fallback()
{
    echo "      - for $3..."
    cat _tmp3 | grep "$1" | while read i ; do
        code=`echo $i | cut -c1-6`
        echo "$code	$2" >> _tmp5
    done
}


echo "  * getting list of needed unicode characters..."

cat mappings/*.TXT | sed -n '/^0x../p' | \
    cut -f2,4 | sort | uniq | sed -n '/^0x/p' > _tmp1
cat _tmp1 | cut -f1 | sort | uniq > _tmp2


echo "  * making unique list of unicode characters meanings..."

rm -f _tmp3
cat _tmp2 | while read i ; do
    sed -n "/^$i/p" _tmp1 | (read t ; echo "$t" >> _tmp3)
done

cp _tmp3 UnicodeChars

echo "  * creating one-byte fallback tables..."

rm -f Fallbacks _tmp5

echo "      - for latin capital letters..."

cat _tmp3 | grep 'LATIN CAPITAL LETTER [A-Z]$' > _tmp6
cat _tmp3 | grep 'LATIN CAPITAL LETTER [A-Z] WITH' >> _tmp6
cat _tmp6 | sort +2 > _tmp4

cat _tmp4 | while read i ; do
    code=`echo $i | cut -c1-6`
    fallb=`echo $i | cut -c8-29`
    cat _tmp4 | fgrep "$fallb" | cut -c1-6 | (read i ; 
        echo "$code	$i" >> _tmp5)
done


echo "      - for latin small letters..."

cat _tmp3 | grep 'LATIN SMALL LETTER [A-Z]$' > _tmp6
cat _tmp3 | grep 'LATIN SMALL LETTER [A-Z] WITH' >> _tmp6
cat _tmp6 | sort +2 > _tmp4

cat _tmp4 | while read i ; do
    code=`echo $i | cut -c1-6`
    fallb=`echo $i | cut -c8-27`
    cat _tmp4 | fgrep "$fallb" | cut -c1-6 | (read i ; 
        echo "$code	$i" >> _tmp5)
done


add_fallback "DOUBLE .*QUOTATION MARK" "0x0022" "double quotations"
add_fallback "SINGLE .*QUOTATION MARK" "0x0027" "single quotations"
add_fallback "DASH" "0x002D" "dashes"



echo "  * removing infinite loops from fallback tables..."

cat _tmp5 | grep -v '\(0x....\)	\1' | sort > Fallbacks

rm -f _tmp1 _tmp2 _tmp3 _tmp4 _tmp5 _tmp6