3 # Generate UTF-8 case mapping tables
5 # (c) 2010 Steve Bennett <steveb@workware.net.au>
7 # See LICENCE for licence details.
10 # Parse the unicode data from: http://unicode.org/Public/UNIDATA/UnicodeData.txt
11 # to generate case mapping tables
16 set f
[open [lindex $argv 0]]
17 while {[gets $f buf
] >= 0} {
21 foreach {code name class x x x x x x x x x upper
lower title
} [split $buf ";"] break
22 set codex
[string tolower
0x
$code]
26 if {$codex > 0xffff} {
29 if {![string match L
* $class]} {
33 lappend map
(upper
) $codex [string tolower
0x
$upper]
36 lappend map
(lower) $codex [string tolower
0x
$lower]
38 if {$title ne
"" && $title ne
$upper} {
39 if {$title eq
$code} {
42 lappend map
(title
) $codex [string tolower
0x
$title]
47 foreach type
{upper
lower title
} {
48 puts "static const struct casemap unicode_case_mapping_$type\[\] = \{"
49 foreach {code alt
} $map($type) {
50 puts "\t{ $code, $alt },"