1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/chardet/tools/gencyrillic.pl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +#!/usr/local/bin/perl 1.5 + 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 +use StatKoi '.' ; 1.11 + 1.12 +open(FILE, "> ../src/nsCyrillicProb.h") or die "cannot open nsCyrillicDetector.h"; 1.13 + 1.14 +print FILE <<EOF; 1.15 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.16 + 1.17 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.18 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.19 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.20 + 1.21 +#ifndef nsCyrillicDetector_h__ 1.22 +#define nsCyrillicDetector_h__ 1.23 +/* 1.24 + DO NOT EDIT THIS FILE !!! 1.25 + This file is generated by the perl script in 1.26 + mozilla/intl/chardet/tools/gencyrillic.pl 1.27 + 1.28 + To ues that script, you need to grab StatKoi.pm file from 1.29 + the "Cyrillic Software Suite" written by John Neystdt. 1.30 + http://www.neystadt.org/cyrillic (You can also find it from CPAN) 1.31 + */ 1.32 +EOF 1.33 +$table = \%Lingua::DetectCharset::StatKoi::StatsTableKoi; 1.34 +print FILE "const uint16_t gCyrillicProb[33][33] = {"; 1.35 + print FILE "{ \n"; 1.36 + print FILE "0,\n"; 1.37 + for($j = 0xc0; $j < 0xe0; $j++) 1.38 + { 1.39 + print FILE "0, \t"; 1.40 + if( 7 == ( $j % 8) ) 1.41 + { 1.42 + print FILE "\n"; 1.43 + } 1.44 + } 1.45 + print FILE "\n}, \n"; 1.46 +for($i = 0xc0; $i < 0xe0; $i++) 1.47 +{ 1.48 + print FILE "{ \n"; 1.49 + print FILE "0,\n"; 1.50 + for($j = 0xc0; $j < 0xe0; $j++) 1.51 + { 1.52 + $key = chr($i) . chr($j); 1.53 + if(exists($table->{$key})) 1.54 + { 1.55 + $v = $table->{$key}; 1.56 + } else { 1.57 + $v = 0; 1.58 + } 1.59 + print FILE $v . ", \t"; 1.60 + if( 7 == ( $j % 8) ) 1.61 + { 1.62 + print FILE "\n"; 1.63 + } 1.64 + } 1.65 + print FILE "\n}, \n"; 1.66 +} 1.67 +print FILE "};\n"; 1.68 +print FILE "#endif\n";