line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Unicode::Normalize::Mac; |
2
|
3
|
|
|
3
|
|
37186
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
133
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
79
|
|
4
|
3
|
|
|
3
|
|
3332
|
use Unicode::Normalize (); |
|
3
|
|
|
|
|
452551
|
|
|
3
|
|
|
|
|
142
|
|
5
|
3
|
|
|
3
|
|
34
|
use Exporter 'import'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1190
|
|
6
|
|
|
|
|
|
|
our @EXPORT_OK = qw( NFC_mac NFD_mac ); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# http://developer.apple.com/library/mac/#qa/qa2001/qa1173.html |
9
|
|
|
|
|
|
|
my $decompose = qr/([^\x{2000}-\x{2FFF}\x{F900}-\x{FAFF}\x{2F800}-\x{2FAFF}]*)/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub NFC_mac { |
12
|
12
|
|
|
12
|
1
|
933
|
my ($unicode) = @_; |
13
|
12
|
50
|
|
|
|
30
|
return unless defined $unicode; |
14
|
12
|
|
|
|
|
88
|
$unicode =~ s/$decompose/Unicode::Normalize::NFC($1)/eg; |
|
26
|
|
|
|
|
201
|
|
15
|
12
|
|
|
|
|
54
|
$unicode; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub NFD_mac { |
19
|
5387
|
|
|
5387
|
1
|
10310
|
my ($unicode) = @_; |
20
|
5387
|
50
|
|
|
|
9915
|
return unless defined $unicode; |
21
|
5387
|
|
|
|
|
42192
|
$unicode =~ s/$decompose/Unicode::Normalize::NFD($1)/eg; |
|
10774
|
|
|
|
|
60861
|
|
22
|
5387
|
|
|
|
|
18980
|
$unicode; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
{ |
26
|
3
|
|
|
3
|
|
17
|
no warnings 'once'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
282
|
|
27
|
|
|
|
|
|
|
*NFC = \&NFC_mac; |
28
|
|
|
|
|
|
|
*NFD = \&NFD_mac; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
__END__ |