File: mk_ucs_case_map.pl

package info (click to toggle)
w3m 0.5.3%2Bgit20230121-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,520 kB
  • sloc: ansic: 59,204; sh: 4,331; perl: 4,217; javascript: 2,315; makefile: 913; cpp: 869; ruby: 776; awk: 78; sed: 16
file content (48 lines) | stat: -rw-r--r-- 692 bytes parent folder | download | duplicates (8)
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

open(MAP, "> ucs_case.map");
print MAP <<EOF;
/*
   File generated from UnicodeData-4.1.0.txt.
*/

EOF

for (<DATA>) {
  chop;
  ($name, $col) = split;
  
  @cp = ();
  
  open(UCD, "< private/UnicodeData-4.1.0.txt");
  while(<UCD>) {
    chop;
    @entry = split(';');
    last if $entry[0] =~ m/.{5,}/;
    if ($entry[$col] ne '') {
      push (@cp, $entry[0]);
      $map{$entry[0]} = $entry[$col];
    }
  }
  close UCD;

  $nocp = @cp;
  
  print MAP <<EOF;

#define N_ucs_${name}_map ${nocp}

static wc_map ucs_${name}_map[ N_ucs_${name}_map ] = {
EOF
  
  for (@cp) {
    print MAP "  { 0x$_, 0x$map{$_} },\n";
  }
  print MAP <<EOF
};
EOF
}

__END__
toupper	12
tolower	13
totitle	14