line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Unicode::Property::XS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22696
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
40
|
|
6
|
1
|
|
|
1
|
|
5
|
use vars qw( $VERSION ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
72
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#require Exporter; |
9
|
|
|
|
|
|
|
#our @ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
# use Exporter::Lite; |
11
|
|
|
|
|
|
|
#our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); |
12
|
|
|
|
|
|
|
our $Prefix; |
13
|
|
|
|
|
|
|
BEGIN { |
14
|
1
|
|
|
1
|
|
853
|
$VERSION = '0.81'; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# This allows declaration use Unicode::Property::XS ':all'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our @general = ( |
21
|
|
|
|
|
|
|
'L', 'LC', 'Lu', 'Ll', |
22
|
|
|
|
|
|
|
'Lt', 'Lm', 'Lo', 'M', |
23
|
|
|
|
|
|
|
'Mn', 'Mc', 'Me', 'N', |
24
|
|
|
|
|
|
|
'Nd', 'Nl', 'No', 'P', |
25
|
|
|
|
|
|
|
'Pc', 'Pd', 'Ps', 'Pe', |
26
|
|
|
|
|
|
|
'Pi', 'Pf', 'Po', 'S', |
27
|
|
|
|
|
|
|
'Sm', 'Sc', 'Sk', 'So', |
28
|
|
|
|
|
|
|
'Z', 'Zs', 'Zl', 'Zp', |
29
|
|
|
|
|
|
|
'C', 'Cc', 'Cf', 'Cs', |
30
|
|
|
|
|
|
|
'Co', 'Cn' ); |
31
|
|
|
|
|
|
|
our @bidirectional = ( |
32
|
|
|
|
|
|
|
'BidiL', 'BidiLRE', 'BidiLRO', 'BidiR', |
33
|
|
|
|
|
|
|
'BidiAL', 'BidiRLE', 'BidiRLO', 'BidiPDF', |
34
|
|
|
|
|
|
|
'BidiEN', 'BidiES', 'BidiET', 'BidiAN', |
35
|
|
|
|
|
|
|
'BidiCS', 'BidiNSM', 'BidiBN', 'BidiB', |
36
|
|
|
|
|
|
|
'BidiS', 'BidiWS', 'BidiON' ); |
37
|
|
|
|
|
|
|
our @scripts = ( |
38
|
|
|
|
|
|
|
'Arabic', 'Armenian', 'Balinese', 'Bengali', |
39
|
|
|
|
|
|
|
'Bopomofo', 'Braille', 'Buginese', 'Buhid', |
40
|
|
|
|
|
|
|
'CanadianAboriginal', 'Cherokee', 'Coptic', 'Cuneiform', |
41
|
|
|
|
|
|
|
'Cypriot', 'Cyrillic', 'Deseret', 'Devanagari', |
42
|
|
|
|
|
|
|
'Ethiopic', 'Georgian', 'Glagolitic', 'Gothic', |
43
|
|
|
|
|
|
|
'Greek', 'Gujarati', 'Gurmukhi', 'Han', |
44
|
|
|
|
|
|
|
'Hangul', 'Hanunoo', 'Hebrew', 'Hiragana', |
45
|
|
|
|
|
|
|
'Inherited', 'Kannada', 'Katakana', 'Kharoshthi', |
46
|
|
|
|
|
|
|
'Khmer', 'Lao', 'Latin', 'Limbu', |
47
|
|
|
|
|
|
|
'LinearB', 'Malayalam', 'Mongolian', 'Myanmar', |
48
|
|
|
|
|
|
|
'NewTaiLue', 'Nko', 'Ogham', 'OldItalic', |
49
|
|
|
|
|
|
|
'OldPersian', 'Oriya', 'Osmanya', 'PhagsPa', |
50
|
|
|
|
|
|
|
'Phoenician', 'Runic', 'Shavian', 'Sinhala', |
51
|
|
|
|
|
|
|
'SylotiNagri', 'Syriac', 'Tagalog', 'Tagbanwa', |
52
|
|
|
|
|
|
|
'TaiLe', 'Tamil', 'Telugu', 'Thaana', |
53
|
|
|
|
|
|
|
'Thai', 'Tibetan', 'Tifinagh', 'Ugaritic', |
54
|
|
|
|
|
|
|
'Yi' ); |
55
|
|
|
|
|
|
|
our @extended = ( |
56
|
|
|
|
|
|
|
'ASCIIHexDigit', 'BidiControl', 'Dash', 'Deprecated', |
57
|
|
|
|
|
|
|
'Diacritic', 'Extender', 'HexDigit', 'Hyphen', |
58
|
|
|
|
|
|
|
'Ideographic', 'IDSBinaryOperator', 'IDSTrinaryOperator', 'JoinControl', |
59
|
|
|
|
|
|
|
'LogicalOrderException', 'NoncharacterCodePoint', 'OtherAlphabetic', 'OtherDefaultIgnorableCodePoint', |
60
|
|
|
|
|
|
|
'OtherGraphemeExtend', 'OtherIDStart', 'OtherIDContinue', 'OtherLowercase', |
61
|
|
|
|
|
|
|
'OtherMath', 'OtherUppercase', 'PatternSyntax', 'PatternWhiteSpace', |
62
|
|
|
|
|
|
|
'QuotationMark', 'Radical', 'SoftDotted', 'STerm', |
63
|
|
|
|
|
|
|
'TerminalPunctuation', 'UnifiedIdeograph', 'VariationSelector', 'WhiteSpace' ); |
64
|
|
|
|
|
|
|
our @derived = ( |
65
|
|
|
|
|
|
|
'Alphabetic', 'Lowercase', 'Uppercase', 'Math', |
66
|
|
|
|
|
|
|
'IDStart', 'IDContinue', 'Any', 'Assigned', |
67
|
|
|
|
|
|
|
'Unassigned', 'ASCII', 'Common' ); |
68
|
|
|
|
|
|
|
our @EastAsianWidth = ( |
69
|
|
|
|
|
|
|
'EaF', 'EaH', 'EaA', 'EaNa', |
70
|
|
|
|
|
|
|
'EaW', 'EaN', 'EaFullwidth0', 'EaFullwidth1', |
71
|
|
|
|
|
|
|
'EaHalfwidth0', 'EaHalfwidth1' ); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
74
|
|
|
|
|
|
|
'all' => [ 'Legal', |
75
|
|
|
|
|
|
|
@general,@bidirectional,@scripts,@extended, |
76
|
|
|
|
|
|
|
@derived,@EastAsianWidth ], |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
'general' => [ @general ], |
79
|
|
|
|
|
|
|
'bidirectional' => [ @bidirectional ], |
80
|
|
|
|
|
|
|
'scripts' => [ @scripts ], |
81
|
|
|
|
|
|
|
'extended' => [ @extended ], |
82
|
|
|
|
|
|
|
'derived' => [ @derived ], |
83
|
|
|
|
|
|
|
'EastAsianWidth' => [ @EastAsianWidth ], |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# ucs_InEastAsianFullwidth |
88
|
|
|
|
|
|
|
# ucs_InEastAsianHalfwidth |
89
|
|
|
|
|
|
|
# ucs_InEastAsianAmbiguous |
90
|
|
|
|
|
|
|
# ucs_InEastAsianNarrow |
91
|
|
|
|
|
|
|
# ucs_InEastAsianWide |
92
|
|
|
|
|
|
|
# ucs_InEastAsianNeutral |
93
|
|
|
|
|
|
|
# ucs_InFullwidth |
94
|
|
|
|
|
|
|
# ucs_InHalfwidth |
95
|
|
|
|
|
|
|
# for ucs_InFullwidth see context $Unicode::EastAsianWidth::EastAsian |
96
|
|
|
|
|
|
|
# for ucs_InHalfwidth see context $Unicode::EastAsianWidth::EastAsian |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
our @EXPORT = qw(); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub import { |
103
|
1
|
|
|
1
|
|
11
|
my ($pkg, @imports) = @_; |
104
|
1
|
|
|
|
|
4
|
my($caller, $file, $line) = caller; |
105
|
|
|
|
|
|
|
|
106
|
1
|
50
|
|
|
|
6
|
$Prefix = defined($Prefix) ? $Prefix : 'ucs_' ; |
107
|
1
|
|
|
|
|
4
|
$Prefix =~ s/[^A-Za-z0-9_]//g ; # strip possible weird chars in prefix |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# my @tags; |
110
|
1
|
|
|
|
|
2
|
my @items; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# adapted from Exporter::Lite |
113
|
1
|
50
|
|
|
|
5
|
if ( !@imports ) { # Default import. |
114
|
0
|
|
|
|
|
0
|
@imports = @EXPORT; |
115
|
|
|
|
|
|
|
} |
116
|
1
|
|
|
|
|
4
|
my %ok = map { s/^&//; $_ => 1; } @EXPORT_OK, @EXPORT; |
|
176
|
|
|
|
|
181
|
|
|
176
|
|
|
|
|
297
|
|
117
|
1
|
|
|
|
|
25
|
my %ok_tag = map { $_ => 1; } keys %EXPORT_TAGS; |
|
7
|
|
|
|
|
14
|
|
118
|
1
|
|
|
|
|
2
|
my $add; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
ITEM: |
121
|
1
|
|
|
|
|
3
|
foreach my $item (@imports) { |
122
|
1
|
50
|
|
|
|
3
|
$add = $item =~ s/^!// ? 1 : 2; |
123
|
|
|
|
|
|
|
|
124
|
1
|
50
|
|
|
|
4
|
if ($item eq ':DEFAULT') { |
125
|
0
|
|
|
|
|
0
|
map { $ok{$_}=$add; } @EXPORT ; |
|
0
|
|
|
|
|
0
|
|
126
|
0
|
|
|
|
|
0
|
next ITEM; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
1
|
50
|
|
|
|
6
|
if ($item =~ /^:(.*)/) { |
130
|
1
|
50
|
|
|
|
5
|
if (!$ok_tag{$1}) { |
131
|
0
|
|
|
|
|
0
|
_report_error($1); |
132
|
0
|
|
|
|
|
0
|
next ITEM; |
133
|
|
|
|
|
|
|
}; |
134
|
1
|
|
|
|
|
2
|
map { $ok{$_}=$add; } @{ $EXPORT_TAGS{$1} } ; |
|
176
|
|
|
|
|
205
|
|
|
1
|
|
|
|
|
3
|
|
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
else { |
137
|
0
|
0
|
|
|
|
0
|
if (!$ok{$item}) { |
138
|
0
|
|
|
|
|
0
|
_report_error($item); |
139
|
0
|
|
|
|
|
0
|
next ITEM; |
140
|
|
|
|
|
|
|
}; |
141
|
0
|
|
|
|
|
0
|
$ok{$item}=$add; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
}; |
144
|
|
|
|
|
|
|
|
145
|
1
|
|
|
|
|
24
|
foreach my $item (keys %ok) { |
146
|
176
|
50
|
|
|
|
369
|
next if $ok{ $item } != 2 ; |
147
|
|
|
|
|
|
|
|
148
|
1
|
|
|
1
|
|
7
|
do { no strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
192
|
|
|
176
|
|
|
|
|
154
|
|
149
|
176
|
|
|
|
|
152
|
*{ $caller.'::'.$Prefix.$item } = \&{ $item }; |
|
176
|
|
|
|
|
1062
|
|
|
176
|
|
|
|
|
290
|
|
150
|
|
|
|
|
|
|
}; |
151
|
|
|
|
|
|
|
}; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
}; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub _report_error { |
156
|
0
|
|
|
0
|
|
|
my $item = shift; |
157
|
0
|
|
|
|
|
|
do { require Carp; Carp::croak("Can't export symbol: $item") }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
}; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
require XSLoader; |
161
|
|
|
|
|
|
|
XSLoader::load('Unicode::Property::XS', $VERSION); |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
# Preloaded methods go here. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
1; |
166
|
|
|
|
|
|
|
__END__ |