|
1 #!/usr/local/bin/perl |
|
2 |
|
3 # This Source Code Form is subject to the terms of the Mozilla Public |
|
4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
6 |
|
7 use StatKoi '.' ; |
|
8 |
|
9 open(FILE, "> ../src/nsCyrillicProb.h") or die "cannot open nsCyrillicDetector.h"; |
|
10 |
|
11 print FILE <<EOF; |
|
12 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
13 |
|
14 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
15 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
16 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
17 |
|
18 #ifndef nsCyrillicDetector_h__ |
|
19 #define nsCyrillicDetector_h__ |
|
20 /* |
|
21 DO NOT EDIT THIS FILE !!! |
|
22 This file is generated by the perl script in |
|
23 mozilla/intl/chardet/tools/gencyrillic.pl |
|
24 |
|
25 To ues that script, you need to grab StatKoi.pm file from |
|
26 the "Cyrillic Software Suite" written by John Neystdt. |
|
27 http://www.neystadt.org/cyrillic (You can also find it from CPAN) |
|
28 */ |
|
29 EOF |
|
30 $table = \%Lingua::DetectCharset::StatKoi::StatsTableKoi; |
|
31 print FILE "const uint16_t gCyrillicProb[33][33] = {"; |
|
32 print FILE "{ \n"; |
|
33 print FILE "0,\n"; |
|
34 for($j = 0xc0; $j < 0xe0; $j++) |
|
35 { |
|
36 print FILE "0, \t"; |
|
37 if( 7 == ( $j % 8) ) |
|
38 { |
|
39 print FILE "\n"; |
|
40 } |
|
41 } |
|
42 print FILE "\n}, \n"; |
|
43 for($i = 0xc0; $i < 0xe0; $i++) |
|
44 { |
|
45 print FILE "{ \n"; |
|
46 print FILE "0,\n"; |
|
47 for($j = 0xc0; $j < 0xe0; $j++) |
|
48 { |
|
49 $key = chr($i) . chr($j); |
|
50 if(exists($table->{$key})) |
|
51 { |
|
52 $v = $table->{$key}; |
|
53 } else { |
|
54 $v = 0; |
|
55 } |
|
56 print FILE $v . ", \t"; |
|
57 if( 7 == ( $j % 8) ) |
|
58 { |
|
59 print FILE "\n"; |
|
60 } |
|
61 } |
|
62 print FILE "\n}, \n"; |
|
63 } |
|
64 print FILE "};\n"; |
|
65 print FILE "#endif\n"; |