forked from mintty/mintty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkbidiclasses
executable file
·37 lines (32 loc) · 922 Bytes
/
mkbidiclasses
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
#! /bin/sh
unidata=UnicodeData.txt
make $unidata >&2
(
cat <<\/EOS
first=
item () {
if [ -z "$first" ]
then first=$1
val=$2
fi
last=$1
}
range () {
echo " {0x$first, 0x$last, $val},"
first=
}
/EOS
sed -e "s,^\([^;]*\);[^;]*;[^;]*;[^;]*;\([^;]*\);.*,\1 \2," "$unidata" |
uniq -f1 --group=append | sed -e "s,^$,range," -e t -e "s,^,item ,"
) | sh | grep -v ", ON}"
exit
According to minibidi.c, this should have worked:
perl -ne 'split ";"; $num = hex $_[0]; $type = $_[4];' \
-e '$fl = ($_[1] =~ /First/ ? 1 : $_[1] =~ /Last/ ? 2 : 0);' \
-e 'if ($type eq $runtype and ($runend == $num-1 or ' \
-e ' ($fl==2 and $pfl==1))) {$runend = $num;} else { &reset; }' \
-e '$pfl=$fl; END { &reset }; sub reset {' \
-e 'printf" {0x%04x, 0x%04x, %s},\n",$runstart,$runend,$runtype' \
-e ' if defined $runstart and $runtype ne "ON";' \
-e '$runstart=$runend=$num; $runtype=$type;}' \
UnicodeData.txt