line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "EXTERN.h" |
2
|
|
|
|
|
|
|
#include "perl.h" |
3
|
|
|
|
|
|
|
#include "XSUB.h" |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#include "ppport.h" |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
static UV |
8
|
52
|
|
|
|
|
|
octet_to_uvuni(const U8 *s, STRLEN *retlen) |
9
|
|
|
|
|
|
|
{ |
10
|
52
|
|
|
|
|
|
*retlen = 1; |
11
|
52
|
|
|
|
|
|
return (UV) *s; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
static UV |
15
|
49
|
|
|
|
|
|
f_utf8_to_uvuni(const U8 *s, STRLEN *retlen) |
16
|
|
|
|
|
|
|
{ |
17
|
49
|
|
|
|
|
|
return utf8_to_uvuni(s, retlen); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
MODULE = XML::Char PACKAGE = XML::Char |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
void |
23
|
|
|
|
|
|
|
_valid_xml_string(string) |
24
|
|
|
|
|
|
|
SV* string; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
PREINIT: |
27
|
|
|
|
|
|
|
STRLEN len; |
28
|
|
|
|
|
|
|
U8 * bytes; |
29
|
|
|
|
|
|
|
int in_range; |
30
|
|
|
|
|
|
|
int range_index; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
STRLEN ret_len; |
33
|
|
|
|
|
|
|
UV uniuv; |
34
|
|
|
|
|
|
|
UV (*next_chr)(const U8 *s, STRLEN *retlen); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
PPCODE: |
37
|
25
|
50
|
|
|
|
|
bytes = (U8*)SvPV(string, len); |
38
|
25
|
100
|
|
|
|
|
next_chr = SvUTF8(string) ? &f_utf8_to_uvuni : &octet_to_uvuni; |
39
|
|
|
|
|
|
|
|
40
|
121
|
100
|
|
|
|
|
while (len > 0) { |
41
|
101
|
|
|
|
|
|
uniuv = (*next_chr)(bytes, &ret_len); |
42
|
101
|
|
|
|
|
|
bytes += ret_len; |
43
|
101
|
|
|
|
|
|
len -= ret_len; |
44
|
|
|
|
|
|
|
|
45
|
101
|
100
|
|
|
|
|
if ( |
46
|
9
|
100
|
|
|
|
|
(uniuv < 0x20) && (uniuv != 0x9) && (uniuv != 0xA) && (uniuv != 0xD) |
47
|
97
|
50
|
|
|
|
|
|| (uniuv > 0xD7FF) && (uniuv < 0xE000) |
48
|
97
|
50
|
|
|
|
|
|| (uniuv > 0xFFFD) && (uniuv < 0x10000) |
49
|
97
|
100
|
|
|
|
|
|| (uniuv > 0x1FFFF) |
50
|
101
|
|
|
|
|
|
) XSRETURN_NO; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
20
|
|
|
|
|
|
XSRETURN_YES; |