forked from mintty/mintty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmknames
executable file
·40 lines (33 loc) · 1.03 KB
/
mknames
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
#! /bin/sh -f
test -f UnicodeData.txt || make UnicodeData.txt
test -f NameAliases.txt || make NameAliases.txt
LC_ALL=C
export LC_ALL
scanunames() {
# modify UnicodeData.txt according to NameAliases.txt
sed -e "/;abbreviation/ d" \
-e "s,^\([0-9A-F]*\);\([^;]*\).*,/^\1;/ s/.*/\1;\2;;;;;;;;;;;;;/," \
-e t -e d NameAliases.txt > mknames.sed
# scan UnicodeData.txt:
# 0153;LATIN SMALL LIGATURE OE;...
# 0000;<control>;Cc;0;BN;;;;;N;NULL;...
# generate lines:
# {0x0153, "LATIN SMALL LIGATURE OE"},
# {0x0000, "NULL"},
# and give precedence to NameAliases.txt:
sed -f mknames.sed UnicodeData.txt |
sed -e 's/^\([^;]*\);<control>;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;\([^;]*\);.*/\1;\2;/' \
-e t \
-e '/^[^;]*;</ d'
}
if false
then scanunames |
sed -e 's/^\([^;][^;][^;][^;];\)/00\1/' \
-e 's/^\([^;][^;][^;][^;][^;];\)/0\1/' \
-e 's/^\([^;][^;]\)\([^;][^;]\)\([^;][^;]\);\([^;]*\);.*/ "\\x\1\\x\2\\x\3 \4",/' \
> charnames.t
else scanunames |
sed -e 's/^\([^;]*\);\([^;]*\);.*/\1 \2/' \
> charnames.txt
fi
rm -f mknames.sed