1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/chardet/tools/geniso2022jp.pl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 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(@iso2022jp_cls); 1.15 +my(@iso2022jp_st); 1.16 +my($iso2022jp_ver); 1.17 + 1.18 +# 1:ESC 3:'(' 4:'B' 5:'J' 6:'@' 7:'$' 8:'D' 9:'I' 1.19 +@iso2022jp_cls = ( 1.20 + [ 0x0e , 0x0f , 2 ], 1.21 + [ 0x28 , 0x28 , 3 ], 1.22 + [ 0x42 , 0x42 , 4 ], 1.23 + [ 0x4a , 0x4a , 5 ], 1.24 + [ 0x40 , 0x40 , 6 ], 1.25 + [ 0x24 , 0x24 , 7 ], 1.26 + [ 0x44 , 0x44 , 8 ], 1.27 + [ 0x49 , 0x49 , 9 ], 1.28 + [ 0x01 , 0x1a , 0 ], 1.29 + [ 0x1c , 0x7f , 0 ], 1.30 + [ 0x1b , 0x1b , 1 ], 1.31 + [ 0x00 , 0x00 , 2 ], 1.32 + [ 0x80 , 0xff , 2 ] 1.33 +); 1.34 + 1.35 +package genverifier; 1.36 +@iso2022jp_st = ( 1.37 +# 0 1 2 3 4 5 6 7 8 9 1.38 + 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, # Start State - 0 1.39 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, # Error State - 1 1.40 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, # ItsMe State - 2 1.41 + 1, 1, 1, 5, 1, 1, 1, 4, 1, 1, # got ESC 1.42 + 1, 1, 1, 6, 2, 1, 2, 1, 1, 1, # got ESC $ 1.43 + 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, # got ESC ( 1.44 + 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, # got ESC $ ( 1.45 +); 1.46 + 1.47 +$iso2022jp_ver = genverifier::GenVerifier("ISO2022JP", "ISO-2022-JP", 1.48 + \@iso2022jp_cls, 10, \@iso2022jp_st); 1.49 +print $iso2022jp_ver; 1.50 + 1.51 + 1.52 +