mk_ucs_case_map.pl (692B)
1 2 open(MAP, "> ucs_case.map"); 3 print MAP <<EOF; 4 /* 5 File generated from UnicodeData-4.1.0.txt. 6 */ 7 8 EOF 9 10 for (<DATA>) { 11 chop; 12 ($name, $col) = split; 13 14 @cp = (); 15 16 open(UCD, "< private/UnicodeData-4.1.0.txt"); 17 while(<UCD>) { 18 chop; 19 @entry = split(';'); 20 last if $entry[0] =~ m/.{5,}/; 21 if ($entry[$col] ne '') { 22 push (@cp, $entry[0]); 23 $map{$entry[0]} = $entry[$col]; 24 } 25 } 26 close UCD; 27 28 $nocp = @cp; 29 30 print MAP <<EOF; 31 32 #define N_ucs_${name}_map ${nocp} 33 34 static wc_map ucs_${name}_map[ N_ucs_${name}_map ] = { 35 EOF 36 37 for (@cp) { 38 print MAP " { 0x$_, 0x$map{$_} },\n"; 39 } 40 print MAP <<EOF 41 }; 42 EOF 43 } 44 45 __END__ 46 toupper 12 47 tolower 13 48 totitle 14