intl/chardet/tools/gencyrillic.pl

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial