1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/chardet/tools/gensjis.pl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +#!/usr/local/bin/perl 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 +use strict; 1.10 +require "genverifier.pm"; 1.11 +use genverifier; 1.12 + 1.13 + 1.14 +my(@sjis_cls); 1.15 +my(@sjis_st); 1.16 +my($sjis_ver); 1.17 + 1.18 +@sjis_cls = ( 1.19 + [ 0x00 , 0x00 , 0 ], 1.20 + [ 0x0e , 0x0f , 0 ], 1.21 + [ 0x1b , 0x1b , 0 ], 1.22 + [ 0xfd , 0xff , 0 ], 1.23 + [ 0x85 , 0x86 , 3 ], 1.24 + [ 0xeb , 0xec , 5 ], 1.25 + [ 0x01 , 0x1a , 1 ], 1.26 + [ 0x1c , 0x3f , 1 ], 1.27 + [ 0x7f , 0x7f , 1 ], 1.28 + [ 0x40 , 0x7e , 2 ], 1.29 + [ 0xa1 , 0xdf , 2 ], 1.30 + [ 0x80 , 0x9f , 3 ], 1.31 + [ 0xa0 , 0xa0 , 4 ], 1.32 + [ 0xe0 , 0xea , 3 ], 1.33 + [ 0xed , 0xfc , 4 ], 1.34 +); 1.35 + 1.36 +package genverifier; 1.37 +@sjis_st = ( 1.38 +# 0 1 2 3 4 5 1.39 + 1, 0, 0, 3, 1, 1, # Start State - 0 1.40 + 1, 1, 1, 1, 1, 1, # Error State - 1 1.41 + 2, 2, 2, 2, 2, 2, # ItsMe State - 2 1.42 + 1, 1, 0, 0, 0, 0, # State - 3 1.43 +); 1.44 + 1.45 +$sjis_ver = genverifier::GenVerifier("SJIS", "Shift_JIS", \@sjis_cls, 6, \@sjis_st); 1.46 +print $sjis_ver; 1.47 + 1.48 + 1.49 +