line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package String::Multibyte::GBK; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
228
|
|
4
|
|
|
|
|
|
|
$VERSION = '1.02'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
+{ |
7
|
|
|
|
|
|
|
charset => 'GBK', |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
regexp => '(?:[\x00-\x80]|[\x81-\xFE][\x40-\x7E\x80-\xFE])', |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
cmpchar => sub { $_[0] cmp $_[1] }, |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
nextchar => sub { |
14
|
|
|
|
|
|
|
my $ch = shift; |
15
|
|
|
|
|
|
|
my $len = length $ch; |
16
|
|
|
|
|
|
|
if ($len == 1) { |
17
|
|
|
|
|
|
|
return $ch eq "\x80" |
18
|
|
|
|
|
|
|
? "\x81\x40" |
19
|
|
|
|
|
|
|
: chr(ord($ch)+1); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
elsif ($len == 2) { |
22
|
|
|
|
|
|
|
my($c, $d) = unpack('CC', $ch); |
23
|
|
|
|
|
|
|
return $ch eq "\xFE\xFE" |
24
|
|
|
|
|
|
|
? undef |
25
|
|
|
|
|
|
|
: $d == 0xFE |
26
|
|
|
|
|
|
|
? chr($c+1)."\x40" |
27
|
|
|
|
|
|
|
: $d == 0x7E |
28
|
|
|
|
|
|
|
? chr($c) ."\x80" |
29
|
|
|
|
|
|
|
: pack('CC', $c, $d+1); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
|
|
|
|
|
|
return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |