|
1 #!/usr/local/bin/perl |
|
2 # This Source Code Form is subject to the terms of the Mozilla Public |
|
3 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
5 |
|
6 use strict; |
|
7 require "genverifier.pm"; |
|
8 use genverifier; |
|
9 |
|
10 |
|
11 my(@gb18030_cls); |
|
12 my(@gb18030_st); |
|
13 my($gb18030_ver); |
|
14 |
|
15 |
|
16 @gb18030_cls = ( |
|
17 [ 0x0e , 0x0f , 0 ], |
|
18 [ 0x1b , 0x1b , 0 ], |
|
19 [ 0x30 , 0x39 , 3 ], |
|
20 [ 0x00 , 0x3f , 1 ], |
|
21 [ 0x40 , 0x7e , 2 ], |
|
22 [ 0x7f , 0x7f , 4 ], |
|
23 [ 0x80 , 0x80 , 5 ], |
|
24 [ 0x81 , 0xfe , 6 ], |
|
25 [ 0xff , 0xff , 0 ], |
|
26 ); |
|
27 |
|
28 package genverifier; |
|
29 @gb18030_st = ( |
|
30 # 0 1 2 3 4 5 6 |
|
31 1, 0, 0, 0, 0, 0, 3, # state 0 |
|
32 1, 1, 1, 1, 1, 1, 1, # Error State - 1 |
|
33 2, 2, 2, 2, 2, 2, 2, # ItsMe State - 2 |
|
34 1, 1, 0, 4, 1, 0, 0, # state 3, multibytes, 1st byte identified |
|
35 1, 1, 1, 1, 1, 1, 5, # state 4, multibytes, 2nd byte identified |
|
36 1, 1, 1, 2, 1, 1, 1, # state 5, multibytes, 3rd byte identified |
|
37 ); |
|
38 |
|
39 |
|
40 $gb18030_ver = genverifier::GenVerifier("gb18030", "gb18030", \@gb18030_cls, 7, \@gb18030_st); |
|
41 print $gb18030_ver; |
|
42 |
|
43 |
|
44 |