blob: ea3afebc09496658f57592fb5170006354ac081f (
plain)
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
74
75
76
77
78
79
80
|
#!/bin/bash
set -e
set -o pipefail
rm -f rules/foundries
rm -f rules/*.rules rules/foundries.new
chars () {
for c in $rest; do
case " $c " in
" "?" ")
ord=`perl -e 'print ord($ARGV[0]),"\n" or die $!' "$c"`
;;
" "d?*" ")
ord="${c#d}"
c=`perl -e 'printf "%c", $ARGV[0]' "$ord"`
;;
*)
echo >&2 "??? $c"
exit 1
;;
esac
./printrule >&3 "$bad" "$good" $height \
"^ENCODING $ord$" $partial "$c"
done
}
while read keyword rest; do
case "$keyword" in
'#'|'') continue ;;
pcf)
pcf=$rest
for f in good bad; do
out=$f/$pcf.bdf
zcat $f/$pcf.pcf.gz | pcf2bdf >$out
eval "$f=\$out"
done
;;
rules)
newfoundry=$rest
eval `perl -ne '
next unless s/^BBX\s+//;
s/\s+$//;
s/\s+/,/g;
s/[-+]?\b\d+\b/ sprintf "%d", $& /ge;
m/^\d+\,(\d+)\b/ or die;
print "key=$_; height=$1\n" or die $!;
exit;
' <$good`
oldfoundry=`perl -ne '
next unless s/^FOUNDRY\s+\"?//;
s/\"?\s+$//;
print or die $!;
exit;
' <$good`
printf "%s %s" "$oldfoundry" "$newfoundry" >>rules/foundries.new
exec 3>rules/$newfoundry,$key.rules
echo >&3 '# -*- perl -*-'
echo >&3 '# autogenerated by mkrules'
echo >&3 'sub {'
;;
endrules)
echo >&3 '}'
exec 3</dev/null
;;
entire)
partial=0
chars
;;
partial)
partial=1
chars
;;
*)
echo >&2 "??? $keyword"
exit 1
;;
esac
done
mv rules/foundries.new rules/foundries
|