line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "EXTERN.h" |
2
|
|
|
|
|
|
|
#include "perl.h" |
3
|
|
|
|
|
|
|
#include "XSUB.h" |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
MODULE = Sub::Boolean PACKAGE = Sub::Boolean |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
void |
8
|
|
|
|
|
|
|
falsey (...) |
9
|
|
|
|
|
|
|
CODE: |
10
|
3
|
|
|
|
|
|
XSRETURN_NO; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
void |
13
|
|
|
|
|
|
|
truthy (...) |
14
|
|
|
|
|
|
|
CODE: |
15
|
3
|
|
|
|
|
|
XSRETURN_YES; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
void |
18
|
|
|
|
|
|
|
undef (...) |
19
|
|
|
|
|
|
|
CODE: |
20
|
2
|
|
|
|
|
|
XSRETURN_UNDEF; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
void |
23
|
|
|
|
|
|
|
empty (...) |
24
|
|
|
|
|
|
|
CODE: |
25
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
SV* |
28
|
|
|
|
|
|
|
make_false (...) |
29
|
|
|
|
|
|
|
ALIAS: |
30
|
|
|
|
|
|
|
make_true = 1 |
31
|
|
|
|
|
|
|
make_undef = 2 |
32
|
|
|
|
|
|
|
make_empty = 3 |
33
|
|
|
|
|
|
|
CODE: |
34
|
|
|
|
|
|
|
CV* cv; |
35
|
11
|
100
|
|
|
|
|
if ( items == 0 ) { |
36
|
6
|
|
|
|
|
|
switch (ix) { |
37
|
|
|
|
|
|
|
case 0: |
38
|
1
|
|
|
|
|
|
cv = newXS(NULL, XS_Sub__Boolean_falsey, __FILE__); |
39
|
1
|
|
|
|
|
|
break; |
40
|
|
|
|
|
|
|
case 1: |
41
|
1
|
|
|
|
|
|
cv = newXS(NULL, XS_Sub__Boolean_truthy, __FILE__); |
42
|
1
|
|
|
|
|
|
break; |
43
|
|
|
|
|
|
|
case 2: |
44
|
1
|
|
|
|
|
|
cv = newXS(NULL, XS_Sub__Boolean_undef, __FILE__); |
45
|
1
|
|
|
|
|
|
break; |
46
|
|
|
|
|
|
|
case 3: |
47
|
3
|
|
|
|
|
|
cv = newXS(NULL, XS_Sub__Boolean_empty, __FILE__); |
48
|
3
|
|
|
|
|
|
break; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
5
|
50
|
|
|
|
|
char* name = (char *)SvPVbyte_nolen(ST(0)); |
53
|
5
|
|
|
|
|
|
switch (ix) { |
54
|
|
|
|
|
|
|
case 0: |
55
|
2
|
|
|
|
|
|
cv = newXS(name, XS_Sub__Boolean_falsey, __FILE__); |
56
|
2
|
|
|
|
|
|
break; |
57
|
|
|
|
|
|
|
case 1: |
58
|
1
|
|
|
|
|
|
cv = newXS(name, XS_Sub__Boolean_truthy, __FILE__); |
59
|
1
|
|
|
|
|
|
break; |
60
|
|
|
|
|
|
|
case 2: |
61
|
1
|
|
|
|
|
|
cv = newXS(name, XS_Sub__Boolean_undef, __FILE__); |
62
|
1
|
|
|
|
|
|
break; |
63
|
|
|
|
|
|
|
case 3: |
64
|
1
|
|
|
|
|
|
cv = newXS(name, XS_Sub__Boolean_empty, __FILE__); |
65
|
1
|
|
|
|
|
|
break; |
66
|
|
|
|
|
|
|
} |
67
|
5
|
|
|
|
|
|
XSRETURN_EMPTY; |
68
|
|
|
|
|
|
|
} |
69
|
6
|
|
|
|
|
|
RETVAL = newRV((SV*)cv); |
70
|
|
|
|
|
|
|
OUTPUT: |
71
|
|
|
|
|
|
|
RETVAL |