3 # generate a table for Unicode case conversion; entries:
4 # struct caseconv_entry defined in towctrans_l.c
6 if [ -r UnicodeData.txt
]
7 then UnicodeData
=UnicodeData.txt
8 elif [ -r /usr
/share
/unicode
/ucd
/UnicodeData.txt
]
9 then UnicodeData
=/usr
/share
/unicode
/ucd
/UnicodeData.txt
10 else echo UnicodeData.txt not found
>&2
19 #0041;LATIN CAPITAL LETTER A;Lu;0;L;;;;;N;;;;0061;
20 #0061;LATIN SMALL LETTER A;Ll;0;L;;;;;N;;;0041;;0041
21 #0130;LATIN CAPITAL LETTER I WITH DOT ABOVE;Lu;0;L;0049 0307;;;;N;LATIN CAPITAL LETTER I DOT;;;0069;
22 #01C4;LATIN CAPITAL LETTER DZ WITH CARON;Lu;0;L;<compat> 0044 017D;;;;N;LATIN CAPITAL LETTER D Z HACEK;;;01C6;01C5
23 #01C5;LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON;Lt;0;L;<compat> 0044 017E;;;;N;LATIN LETTER CAPITAL D SMALL Z HACEK;;01C4;01C6;01C5
24 #01C6;LATIN SMALL LETTER DZ WITH CARON;Ll;0;L;<compat> 0064 017E;;;;N;LATIN SMALL LETTER D Z HACEK;;01C4;;01C5
26 tr -d '\015' < $UnicodeData |
28 -e 's,^\([^;]*\);[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;\([^;][^;]*\);\([^;]*\);\([^;]*\)$,src \1 upper "\2" lower "\3" title "\4",' \
30 -e 's,^\([^;]*\);[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;\([^;]*\);\([^;][^;]*\);\([^;]*\)$,src \1 upper "\2" lower "\3" title "\4",' \
32 -e 's,^\([^;]*\);[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;\([^;]*\);\([^;]*\);\([^;][^;]*\)$,src \1 upper "\2" lower "\3" title "\4",' \
35 (#src 01C5 upper "01C4" lower "01C6" title "01C5"
42 then tohi
=$
(( 0x0$3 - 0x0$1 ))
46 then tolo
=$
(( 0x0$5 - 0x0$1 ))
53 *[02468ACE
].1) echo "'#error' U+$1 ODDSML";;
54 *[02468ACE
].
-1) echo " 0x$1 TO1 ODDCAP";;
55 *[13579BDF
].1) echo "'#error' U+$1 EVENSML";;
56 *[13579BDF
].
-1) echo " 0x$1 TO1 EVENCAP";;
57 *) echo " 0x$1 TOUP $tohi";;
61 *[02468ACE
].1) echo " 0x$1 TO1 EVENCAP";;
62 *[02468ACE
].
-1) echo "'#error' U+$1 EVENSML";;
63 *[13579BDF
].1) echo " 0x$1 TO1 ODDCAP";;
64 *[13579BDF
].
-1) echo "'#error' U+$1 ODDSML";;
65 *) echo " 0x$1 TOLO $tolo";;
67 *) case "$tolo.$tohi" in
68 1.
-1) echo " 0x$1 TOBOTH 0";;
69 *) echo "'#error' U+$1";;
76 uniq -f1 --group=append |
sed -e "s,^$,range," -e t
-e "s,^,item ," |
83 # $diff == $(($last - $first))
85 then # we have items at all
86 echo " {$first, $diff, $v2, $v3},"
92 if [ "$1" = "#error" ]
100 then if [ $
(( $1 )) -ne $
(( ${last-0} + 1 )) ]
112 diff=$
(( $diff + 1 ))
119 sed -e 's/src \([^ ]*\) upper "\([^ ]*\)" lower "\([^ ]*\)" title "\([^ ]*\)"/ {0x\1, 0x\2 - 0x\1, 0x\3 - 0x\1},/' \
120 -e 's/0x - 0x[^ ,}]*/0/g' -e 's/0x}/0}/' \
121 -e 's/\(0x[0-9A-F][0-9A-F]*\) - \(0x[0-9A-F][0-9A-F]*\)/$((`printf %d \1` - `printf %d \2`))/g' \
122 -e 's/^/echo "/' -e 's/$/"/' |
125 sed -e 's/src \([^ ]*\) upper "\([^ ]*\)" lower "\([^ ]*\)" title "\([^ ]*\)"/ {0x\1, 0x\2 - 0x\1, 0x\3 - 0x\1},/' \
126 -e 's/0x - 0x[^ ,}]*/0/g' -e 's/0x}/0}/'