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
|
|
|
|
|
|
|
#include "unicode_bidirule.c" |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
MODULE = Unicode::BiDiRule PACKAGE = Unicode::BiDiRule |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
char * |
12
|
|
|
|
|
|
|
UnicodeVersion() |
13
|
|
|
|
|
|
|
PROTOTYPE: |
14
|
|
|
|
|
|
|
CODE: |
15
|
3
|
|
|
|
|
|
RETVAL = BIDIRULE_UNICODE_VERSION; |
16
|
|
|
|
|
|
|
OUTPUT: |
17
|
|
|
|
|
|
|
RETVAL |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
int |
20
|
|
|
|
|
|
|
_propname() |
21
|
|
|
|
|
|
|
ALIAS: |
22
|
|
|
|
|
|
|
BIDIRULE_NOTBIDI = 0 |
23
|
|
|
|
|
|
|
BIDIRULE_LTR = BDR_LTR |
24
|
|
|
|
|
|
|
BIDIRULE_RTL = BDR_RTL |
25
|
|
|
|
|
|
|
BIDIRULE_INVALID = BDR_INVALID |
26
|
|
|
|
|
|
|
CODE: |
27
|
14
|
|
|
|
|
|
RETVAL = ix; |
28
|
|
|
|
|
|
|
OUTPUT: |
29
|
|
|
|
|
|
|
RETVAL |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
void |
32
|
|
|
|
|
|
|
check(string, strict = 1) |
33
|
|
|
|
|
|
|
SV *string |
34
|
|
|
|
|
|
|
int strict |
35
|
|
|
|
|
|
|
PROTOTYPE: $;$ |
36
|
|
|
|
|
|
|
PREINIT: |
37
|
|
|
|
|
|
|
char *buf; |
38
|
|
|
|
|
|
|
U8 *err; |
39
|
|
|
|
|
|
|
STRLEN buflen, errlen, errulen, idx; |
40
|
|
|
|
|
|
|
int retval; |
41
|
|
|
|
|
|
|
U32 cp; |
42
|
|
|
|
|
|
|
PPCODE: |
43
|
131
|
50
|
|
|
|
|
if (SvOK(string)) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
44
|
131
|
50
|
|
|
|
|
buf = SvPV(string, buflen); |
45
|
|
|
|
|
|
|
else |
46
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; |
47
|
|
|
|
|
|
|
|
48
|
131
|
50
|
|
|
|
|
switch (GIMME_V) { |
49
|
|
|
|
|
|
|
case G_SCALAR: |
50
|
103
|
|
|
|
|
|
retval = bidirule_check((U8 *)buf, buflen, |
51
|
|
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL, strict); |
52
|
103
|
100
|
|
|
|
|
switch (retval) { |
53
|
|
|
|
|
|
|
case BDR_AVOIDED: |
54
|
|
|
|
|
|
|
case BDR_INVALID: |
55
|
47
|
|
|
|
|
|
XSRETURN_EMPTY; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
default: |
58
|
56
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(retval))); |
59
|
56
|
|
|
|
|
|
XSRETURN(1); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
case G_ARRAY: |
63
|
28
|
|
|
|
|
|
retval = bidirule_check((U8 *)buf, buflen, |
64
|
|
|
|
|
|
|
&err, &errlen, &errulen, &idx, &cp, strict); |
65
|
28
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSVpv("result", 0))); |
66
|
28
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv( |
|
|
50
|
|
|
|
|
|
67
|
|
|
|
|
|
|
(retval == BDR_AVOIDED) ? BDR_INVALID : retval))); |
68
|
28
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSVpv("offset", 0))); |
69
|
28
|
100
|
|
|
|
|
if (SvUTF8(string)) |
70
|
14
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(idx))); |
71
|
|
|
|
|
|
|
else |
72
|
14
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(err - (U8 *)buf))); |
73
|
28
|
50
|
|
|
|
|
if (errlen == 0) |
74
|
0
|
|
|
|
|
|
XSRETURN(4); |
75
|
28
|
50
|
|
|
|
|
if (retval != BDR_INVALID && retval != BDR_AVOIDED) |
|
|
50
|
|
|
|
|
|
76
|
28
|
|
|
|
|
|
XSRETURN(4); |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSVpv("length", 0))); |
79
|
0
|
0
|
|
|
|
|
if (SvUTF8(string)) |
80
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(errulen))); |
81
|
|
|
|
|
|
|
else |
82
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(errlen))); |
83
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSVpv("ord", 0))); |
84
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(cp))); |
85
|
0
|
0
|
|
|
|
|
if (retval != BDR_AVOIDED) |
86
|
0
|
|
|
|
|
|
XSRETURN(8); |
87
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSVpv("unsafe", 0))); |
89
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(1))); |
90
|
0
|
|
|
|
|
|
XSRETURN(10); |
91
|
|
|
|
|
|
|
default: |
92
|
131
|
|
|
|
|
|
XSRETURN_EMPTY; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|