line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package String::Multibyte::UTF16LE; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
75
|
use vars qw($VERSION); |
|
11
|
|
|
1
|
|
24
|
|
|
11
|
|
|
|
|
3256
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
281
|
|
4
|
|
|
|
|
|
|
$VERSION = '1.12'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
+{ |
7
|
|
|
|
|
|
|
charset => 'UTF-16LE', |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
regexp => '(?:[\x00-\xFF][\xD8-\xDB][\x00-\xFF][\xDC-\xDF]|' . |
10
|
|
|
|
|
|
|
'[\x00-\xFF][\x00-\xD7\xE0-\xFF])', |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
cmpchar => sub { |
13
|
|
|
|
|
|
|
length($_[0]) <=> length($_[1]) || |
14
|
|
|
|
|
|
|
unpack('v', $_[0]) <=> unpack('v', $_[1]) || |
15
|
|
|
|
|
|
|
reverse($_[0]) cmp reverse($_[1]) |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
nextchar => sub { |
19
|
|
|
|
|
|
|
my $ch = shift; |
20
|
|
|
|
|
|
|
my $len = length $ch; |
21
|
|
|
|
|
|
|
if ($len == 2) { |
22
|
|
|
|
|
|
|
return $ch eq "\xFF\xD7" |
23
|
|
|
|
|
|
|
? "\x00\xE0" |
24
|
|
|
|
|
|
|
: $ch eq "\xFF\xFF" |
25
|
|
|
|
|
|
|
? "\x00\xD8\x00\xDC" |
26
|
|
|
|
|
|
|
: pack('v', 1 + unpack 'v', $ch); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
elsif ($len == 4) { |
29
|
|
|
|
|
|
|
my($hi,$lo) = unpack('vv', $ch); |
30
|
|
|
|
|
|
|
return $ch eq "\xFF\xDB\xFF\xDF" |
31
|
|
|
|
|
|
|
? undef |
32
|
|
|
|
|
|
|
: $lo == 0xDFFF |
33
|
|
|
|
|
|
|
? pack('vv', $hi+1, 0xDC00) |
34
|
|
|
|
|
|
|
: pack('vv', $hi, $lo+1); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
return undef; |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
hyphen => "-\x00", |
40
|
|
|
|
|
|
|
escape => "\\\x00", |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |