| 1 |
|
| #include "EXTERN.h" |
| 2 |
|
| #include "perl.h" |
| 3 |
|
| #include "XSUB.h" |
| 4 |
|
| |
| 5 |
|
| /* Changes in 5.7 series mean that now IOK is only set if scalar is |
| 6 |
|
| precisely integer but in 5.6 and earlier we need to do a more |
| 7 |
|
| complex test */ |
| 8 |
|
| #if PERL_VERSION <= 6 |
| 9 |
|
| #define DD_is_integer(sv) (SvIOK(sv) && (SvIsUV(val) ? SvUV(sv) == SvNV(sv) : SvIV(sv) == SvNV(sv))) |
| 10 |
|
| #else |
| 11 |
|
| #define DD_is_integer(sv) SvIOK(sv) |
| 12 |
|
| #endif |
| 13 |
|
| |
| 14 |
|
| static int |
| 15 |
403 |
| is_string0( SV *sv ) |
| 16 |
|
| { |
| 17 |
403 |
| return SvFLAGS(sv) & (SVf_OK & ~SVf_ROK); |
| 18 |
|
| } |
| 19 |
|
| |
| 20 |
|
| static int |
| 21 |
130 |
| is_string( SV *sv ) |
| 22 |
|
| { |
| 23 |
130 |
| STRLEN len = 0; |
| 24 |
130 |
▶ | if( is_string0(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( is_string0(sv) ) |
102 |
28 |
130 |
|
| 25 |
|
| { |
| 26 |
102 |
| const char *pv = SvPV(sv, len); |
| 27 |
|
| } |
| 28 |
130 |
| return len; |
| 29 |
|
| } |
| 30 |
|
| |
| 31 |
|
| static int |
| 32 |
86 |
| is_array( SV *sv ) |
| 33 |
|
| { |
| 34 |
86 |
▶ | return SvROK(sv) && ( SVt_PVAV == SvTYPE(SvRV(sv) ) ); |
Branch: 2 branches
| Branch | True | False | Total |
| return SvROK(sv) && ( SVt_PVAV == SvTYPE(SvRV(sv) ) ); |
70 |
16 |
86 |
| return SvROK(sv) && ( SVt_PVAV == SvTYPE(SvRV(sv) ) ); |
40 |
30 |
70 |
|
| 35 |
|
| } |
| 36 |
|
| |
| 37 |
|
| static int |
| 38 |
82 |
| is_hash( SV *sv ) |
| 39 |
|
| { |
| 40 |
82 |
▶ | return SvROK(sv) && ( SVt_PVHV == SvTYPE(SvRV(sv) ) ); |
Branch: 2 branches
| Branch | True | False | Total |
| return SvROK(sv) && ( SVt_PVHV == SvTYPE(SvRV(sv) ) ); |
66 |
16 |
82 |
| return SvROK(sv) && ( SVt_PVHV == SvTYPE(SvRV(sv) ) ); |
36 |
30 |
66 |
|
| 41 |
|
| } |
| 42 |
|
| |
| 43 |
|
| static int |
| 44 |
43 |
| is_like( SV *sv, const char *like ) |
| 45 |
|
| { |
| 46 |
43 |
| int likely = 0; |
| 47 |
43 |
▶ | if( sv_isobject( sv ) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( sv_isobject( sv ) ) |
37 |
6 |
43 |
|
| 48 |
|
| { |
| 49 |
37 |
| dSP; |
| 50 |
|
| int count; |
| 51 |
|
| |
| 52 |
37 |
| ENTER; |
| 53 |
37 |
| SAVETMPS; |
| 54 |
37 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
37 |
37 |
|
| 55 |
37 |
▶ | XPUSHs( sv_2mortal( newSVsv( sv ) ) ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( sv_2mortal( newSVsv( sv ) ) ); |
0 |
37 |
37 |
|
| 56 |
37 |
▶ | XPUSHs( sv_2mortal( newSVpv( like, strlen(like) ) ) ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( sv_2mortal( newSVpv( like, strlen(like) ) ) ); |
0 |
37 |
37 |
|
| 57 |
37 |
| PUTBACK; |
| 58 |
|
| |
| 59 |
37 |
▶ | if( ( count = call_pv("overload::Method", G_SCALAR) ) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ( count = call_pv("overload::Method", G_SCALAR) ) ) |
37 |
0 |
37 |
|
| 60 |
|
| { |
| 61 |
|
| I32 ax; |
| 62 |
37 |
| SPAGAIN; |
| 63 |
|
| |
| 64 |
37 |
| SP -= count; |
| 65 |
37 |
| ax = (SP - PL_stack_base) + 1; |
| 66 |
37 |
▶ | if( SvTRUE(ST(0)) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvTRUE(ST(0)) ) |
26 |
11 |
37 |
|
| 67 |
26 |
| ++likely; |
| 68 |
|
| } |
| 69 |
|
| |
| 70 |
37 |
| PUTBACK; |
| 71 |
37 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
37 |
0 |
37 |
|
| 72 |
37 |
| LEAVE; |
| 73 |
|
| } |
| 74 |
|
| |
| 75 |
43 |
| return likely; |
| 76 |
|
| } |
| 77 |
|
| |
| 78 |
|
| /* Validate that pv/len is a valid Perl identifier (no ::) */ |
| 79 |
|
| static int |
| 80 |
28 |
| is_identifier( const char *pv, STRLEN len ) |
| 81 |
|
| { |
| 82 |
|
| STRLEN i; |
| 83 |
28 |
▶ | if( len == 0 || !isALPHA(*pv) && *pv != '_' ) |
Branch: 3 branches
| Branch | True | False | Total |
| if( len == 0 || !isALPHA(*pv) && *pv != '_' ) |
28 |
0 |
28 |
| if( len == 0 || !isALPHA(*pv) && *pv != '_' ) |
14 |
14 |
28 |
| if( len == 0 || !isALPHA(*pv) && *pv != '_' ) |
6 |
8 |
14 |
|
| 84 |
6 |
| return 0; |
| 85 |
90 |
▶ | for( i = 1; i < len; i++ ) |
Branch: 1 branch
| Branch | True | False | Total |
| for( i = 1; i < len; i++ ) |
72 |
18 |
90 |
|
| 86 |
|
| { |
| 87 |
72 |
▶ | if( !isALNUM(pv[i]) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( !isALNUM(pv[i]) ) |
4 |
68 |
72 |
|
| 88 |
4 |
| return 0; |
| 89 |
|
| } |
| 90 |
18 |
| return 1; |
| 91 |
|
| } |
| 92 |
|
| |
| 93 |
|
| /* Validate that pv/len is a valid Perl class name (identifiers joined by ::) */ |
| 94 |
|
| static int |
| 95 |
117 |
| is_class( const char *pv, STRLEN len ) |
| 96 |
|
| { |
| 97 |
|
| STRLEN i; |
| 98 |
117 |
▶ | if( len == 0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( len == 0 ) |
0 |
117 |
117 |
|
| 99 |
0 |
| return 0; |
| 100 |
|
| /* first char must be alpha or underscore */ |
| 101 |
117 |
▶ | if( !isALPHA(*pv) && *pv != '_' ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( !isALPHA(*pv) && *pv != '_' ) |
36 |
81 |
117 |
| if( !isALPHA(*pv) && *pv != '_' ) |
24 |
12 |
36 |
|
| 102 |
24 |
| return 0; |
| 103 |
440 |
▶ | for( i = 1; i < len; i++ ) |
Branch: 1 branch
| Branch | True | False | Total |
| for( i = 1; i < len; i++ ) |
351 |
89 |
440 |
|
| 104 |
|
| { |
| 105 |
351 |
▶ | if( pv[i] == ':' ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( pv[i] == ':' ) |
46 |
305 |
351 |
|
| 106 |
|
| { |
| 107 |
|
| /* must be :: followed by \w */ |
| 108 |
46 |
▶ | if( i + 2 >= len || pv[i+1] != ':' ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( i + 2 >= len || pv[i+1] != ':' ) |
46 |
0 |
46 |
| if( i + 2 >= len || pv[i+1] != ':' ) |
0 |
46 |
46 |
|
| 109 |
0 |
| return 0; |
| 110 |
46 |
| i += 2; |
| 111 |
46 |
▶ | if( !isALNUM(pv[i]) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( !isALNUM(pv[i]) ) |
0 |
46 |
46 |
|
| 112 |
0 |
| return 0; |
| 113 |
|
| } |
| 114 |
305 |
▶ | else if( !isALNUM(pv[i]) ) |
Branch: 1 branch
| Branch | True | False | Total |
| else if( !isALNUM(pv[i]) ) |
4 |
301 |
305 |
|
| 115 |
|
| { |
| 116 |
4 |
| return 0; |
| 117 |
|
| } |
| 118 |
|
| } |
| 119 |
89 |
| return 1; |
| 120 |
|
| } |
| 121 |
|
| |
| 122 |
|
| MODULE = Params::Util PACKAGE = Params::Util |
| 123 |
|
| |
| 124 |
|
| void |
| 125 |
|
| _STRING(sv) |
| 126 |
|
| SV *sv |
| 127 |
|
| PROTOTYPE: $ |
| 128 |
|
| CODE: |
| 129 |
|
| { |
| 130 |
54 |
▶ | if( SvMAGICAL(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(sv) ) |
18 |
36 |
54 |
|
| 131 |
18 |
| mg_get(sv); |
| 132 |
54 |
▶ | if( is_string( sv ) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( is_string( sv ) ) |
38 |
16 |
54 |
|
| 133 |
|
| { |
| 134 |
38 |
| ST(0) = sv; |
| 135 |
38 |
| XSRETURN(1); |
| 136 |
|
| } |
| 137 |
16 |
| XSRETURN_UNDEF; |
| 138 |
|
| } |
| 139 |
|
| |
| 140 |
|
| void |
| 141 |
|
| _NUMBER(sv) |
| 142 |
|
| SV *sv; |
| 143 |
|
| PROTOTYPE: $ |
| 144 |
|
| CODE: |
| 145 |
|
| { |
| 146 |
66 |
▶ | if( SvMAGICAL(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(sv) ) |
22 |
44 |
66 |
|
| 147 |
22 |
| mg_get(sv); |
| 148 |
66 |
▶ | if( ( SvIOK(sv) ) || ( SvNOK(sv) ) || ( is_string( sv ) && looks_like_number( sv ) ) ) |
Branch: 4 branches
| Branch | True | False | Total |
| if( ( SvIOK(sv) ) || ( SvNOK(sv) ) || ( is_string( sv ) && looks_like_number( sv ) ) ) |
64 |
2 |
66 |
| if( ( SvIOK(sv) ) || ( SvNOK(sv) ) || ( is_string( sv ) && looks_like_number( sv ) ) ) |
64 |
0 |
64 |
| if( ( SvIOK(sv) ) || ( SvNOK(sv) ) || ( is_string( sv ) && looks_like_number( sv ) ) ) |
50 |
14 |
64 |
| if( ( SvIOK(sv) ) || ( SvNOK(sv) ) || ( is_string( sv ) && looks_like_number( sv ) ) ) |
44 |
6 |
50 |
|
| 149 |
|
| { |
| 150 |
46 |
| ST(0) = sv; |
| 151 |
46 |
| XSRETURN(1); |
| 152 |
|
| } |
| 153 |
20 |
| XSRETURN_UNDEF; |
| 154 |
|
| } |
| 155 |
|
| |
| 156 |
|
| ## Group 1: String validators |
| 157 |
|
| |
| 158 |
|
| void |
| 159 |
|
| _IDENTIFIER(sv) |
| 160 |
|
| SV *sv; |
| 161 |
|
| PROTOTYPE: $ |
| 162 |
|
| ALIAS: |
| 163 |
|
| _IDENTIFIER = 0 |
| 164 |
|
| _CLASS = 1 |
| 165 |
|
| CODE: |
| 166 |
|
| { |
| 167 |
|
| STRLEN len; |
| 168 |
|
| const char *pv; |
| 169 |
98 |
▶ | if( SvMAGICAL(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(sv) ) |
22 |
76 |
98 |
|
| 170 |
22 |
| mg_get(sv); |
| 171 |
98 |
▶ | if( !is_string0(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( !is_string0(sv) ) |
24 |
74 |
98 |
|
| 172 |
24 |
| XSRETURN_UNDEF; |
| 173 |
74 |
| pv = SvPV(sv, len); |
| 174 |
74 |
▶ | if( len == 0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( len == 0 ) |
4 |
70 |
74 |
|
| 175 |
4 |
| XSRETURN_UNDEF; |
| 176 |
70 |
▶ | if( ix == 0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ix == 0 ) |
28 |
42 |
70 |
|
| 177 |
|
| { |
| 178 |
28 |
▶ | if( is_identifier(pv, len) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( is_identifier(pv, len) ) |
18 |
10 |
28 |
|
| 179 |
|
| { |
| 180 |
18 |
| ST(0) = sv; |
| 181 |
18 |
| XSRETURN(1); |
| 182 |
|
| } |
| 183 |
|
| } |
| 184 |
|
| else |
| 185 |
|
| { |
| 186 |
42 |
▶ | if( is_class(pv, len) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( is_class(pv, len) ) |
30 |
12 |
42 |
|
| 187 |
|
| { |
| 188 |
30 |
| ST(0) = sv; |
| 189 |
30 |
| XSRETURN(1); |
| 190 |
|
| } |
| 191 |
|
| } |
| 192 |
22 |
| XSRETURN_UNDEF; |
| 193 |
|
| } |
| 194 |
|
| |
| 195 |
|
| ## Group 2: Numeric validators |
| 196 |
|
| |
| 197 |
|
| void |
| 198 |
|
| _POSINT(sv) |
| 199 |
|
| SV *sv; |
| 200 |
|
| PROTOTYPE: $ |
| 201 |
|
| ALIAS: |
| 202 |
|
| _POSINT = 0 |
| 203 |
|
| _NONNEGINT = 1 |
| 204 |
|
| CODE: |
| 205 |
|
| { |
| 206 |
|
| STRLEN len; |
| 207 |
|
| const char *pv; |
| 208 |
|
| STRLEN i; |
| 209 |
94 |
▶ | if( SvMAGICAL(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(sv) ) |
18 |
76 |
94 |
|
| 210 |
18 |
| mg_get(sv); |
| 211 |
94 |
▶ | if( SvROK(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvROK(sv) ) |
20 |
74 |
94 |
|
| 212 |
20 |
| XSRETURN_UNDEF; |
| 213 |
74 |
▶ | if( !is_string0(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( !is_string0(sv) ) |
4 |
70 |
74 |
|
| 214 |
4 |
| XSRETURN_UNDEF; |
| 215 |
70 |
| pv = SvPV(sv, len); |
| 216 |
70 |
▶ | if( len == 0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( len == 0 ) |
4 |
66 |
70 |
|
| 217 |
4 |
| XSRETURN_UNDEF; |
| 218 |
66 |
▶ | if( ix == 0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ix == 0 ) |
32 |
34 |
66 |
|
| 219 |
|
| { |
| 220 |
|
| /* _POSINT: first digit must be 1-9 */ |
| 221 |
32 |
▶ | if( pv[0] < '1' || pv[0] > '9' ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( pv[0] < '1' || pv[0] > '9' ) |
20 |
12 |
32 |
| if( pv[0] < '1' || pv[0] > '9' ) |
2 |
18 |
20 |
|
| 222 |
14 |
| XSRETURN_UNDEF; |
| 223 |
|
| } |
| 224 |
|
| else |
| 225 |
|
| { |
| 226 |
|
| /* _NONNEGINT: "0" is ok, otherwise first digit 1-9 */ |
| 227 |
34 |
▶ | if( len == 1 && pv[0] == '0' ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( len == 1 && pv[0] == '0' ) |
14 |
20 |
34 |
| if( len == 1 && pv[0] == '0' ) |
6 |
8 |
14 |
|
| 228 |
|
| { |
| 229 |
6 |
| ST(0) = sv; |
| 230 |
6 |
| XSRETURN(1); |
| 231 |
|
| } |
| 232 |
28 |
▶ | if( pv[0] < '1' || pv[0] > '9' ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( pv[0] < '1' || pv[0] > '9' ) |
18 |
10 |
28 |
| if( pv[0] < '1' || pv[0] > '9' ) |
2 |
16 |
18 |
|
| 233 |
12 |
| XSRETURN_UNDEF; |
| 234 |
|
| } |
| 235 |
106 |
▶ | for( i = 1; i < len; i++ ) |
Branch: 1 branch
| Branch | True | False | Total |
| for( i = 1; i < len; i++ ) |
72 |
34 |
106 |
|
| 236 |
|
| { |
| 237 |
72 |
▶ | if( pv[i] < '0' || pv[i] > '9' ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( pv[i] < '0' || pv[i] > '9' ) |
72 |
0 |
72 |
| if( pv[i] < '0' || pv[i] > '9' ) |
0 |
72 |
72 |
|
| 238 |
0 |
| XSRETURN_UNDEF; |
| 239 |
|
| } |
| 240 |
34 |
| ST(0) = sv; |
| 241 |
34 |
| XSRETURN(1); |
| 242 |
|
| } |
| 243 |
|
| |
| 244 |
|
| ## Group 3: Class dispatchers |
| 245 |
|
| |
| 246 |
|
| void |
| 247 |
|
| _CLASSISA(sv, arg) |
| 248 |
|
| SV *sv; |
| 249 |
|
| char *arg; |
| 250 |
|
| PROTOTYPE: $$ |
| 251 |
|
| ALIAS: |
| 252 |
|
| _CLASSISA = 0 |
| 253 |
|
| _CLASSDOES = 1 |
| 254 |
|
| _CLASSCAN = 2 |
| 255 |
|
| _SUBCLASS = 3 |
| 256 |
|
| CODE: |
| 257 |
|
| { |
| 258 |
|
| static const char *methods[] = {"isa", "DOES", "can", "isa"}; |
| 259 |
|
| STRLEN svlen; |
| 260 |
|
| const char *pv; |
| 261 |
|
| STRLEN arglen; |
| 262 |
82 |
▶ | if( SvMAGICAL(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(sv) ) |
0 |
82 |
82 |
|
| 263 |
0 |
| mg_get(sv); |
| 264 |
82 |
▶ | if( !is_string0(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( !is_string0(sv) ) |
13 |
69 |
82 |
|
| 265 |
13 |
| XSRETURN_UNDEF; |
| 266 |
69 |
| pv = SvPV(sv, svlen); |
| 267 |
69 |
▶ | if( svlen == 0 || !is_class(pv, svlen) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( svlen == 0 || !is_class(pv, svlen) ) |
66 |
3 |
69 |
| if( svlen == 0 || !is_class(pv, svlen) ) |
15 |
51 |
66 |
|
| 268 |
18 |
| XSRETURN_UNDEF; |
| 269 |
51 |
▶ | if( !arg || ( ( arglen = strlen(arg) ) == 0 ) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( !arg || ( ( arglen = strlen(arg) ) == 0 ) ) |
51 |
0 |
51 |
| if( !arg || ( ( arglen = strlen(arg) ) == 0 ) ) |
0 |
51 |
51 |
|
| 270 |
0 |
| XSRETURN_UNDEF; |
| 271 |
|
| |
| 272 |
|
| /* _SUBCLASS: must not be the same class */ |
| 273 |
51 |
▶ | if( ix == 3 && svlen == arglen && strEQ(pv, arg) ) |
Branch: 3 branches
| Branch | True | False | Total |
| if( ix == 3 && svlen == arglen && strEQ(pv, arg) ) |
18 |
33 |
51 |
| if( ix == 3 && svlen == arglen && strEQ(pv, arg) ) |
14 |
4 |
18 |
| if( ix == 3 && svlen == arglen && strEQ(pv, arg) ) |
4 |
10 |
14 |
|
| 274 |
4 |
| XSRETURN_UNDEF; |
| 275 |
|
| |
| 276 |
|
| { |
| 277 |
47 |
| I32 result = 0; |
| 278 |
|
| int count; |
| 279 |
|
| |
| 280 |
47 |
| ENTER; |
| 281 |
47 |
| SAVETMPS; |
| 282 |
47 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
47 |
47 |
|
| 283 |
47 |
▶ | XPUSHs( sv_2mortal( newSVsv( sv ) ) ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( sv_2mortal( newSVsv( sv ) ) ); |
0 |
47 |
47 |
|
| 284 |
47 |
▶ | XPUSHs( sv_2mortal( newSVpv( arg, arglen ) ) ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( sv_2mortal( newSVpv( arg, arglen ) ) ); |
0 |
47 |
47 |
|
| 285 |
47 |
| PUTBACK; |
| 286 |
|
| |
| 287 |
47 |
▶ | if( ( count = call_method(methods[ix], G_SCALAR) ) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ( count = call_method(methods[ix], G_SCALAR) ) ) |
47 |
0 |
47 |
|
| 288 |
|
| { |
| 289 |
47 |
| I32 oldax = ax; |
| 290 |
47 |
| SPAGAIN; |
| 291 |
47 |
| SP -= count; |
| 292 |
47 |
| ax = (SP - PL_stack_base) + 1; |
| 293 |
47 |
| result = SvTRUE(ST(0)); |
| 294 |
47 |
| ax = oldax; |
| 295 |
|
| } |
| 296 |
|
| |
| 297 |
47 |
| PUTBACK; |
| 298 |
47 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
47 |
0 |
47 |
|
| 299 |
47 |
| LEAVE; |
| 300 |
|
| |
| 301 |
47 |
▶ | if( result ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( result ) |
21 |
26 |
47 |
|
| 302 |
|
| { |
| 303 |
21 |
| ST(0) = sv; |
| 304 |
21 |
| XSRETURN(1); |
| 305 |
|
| } |
| 306 |
|
| } |
| 307 |
26 |
| XSRETURN_UNDEF; |
| 308 |
|
| } |
| 309 |
|
| |
| 310 |
|
| ## Group 4: Instance dispatchers |
| 311 |
|
| |
| 312 |
|
| void |
| 313 |
|
| _INSTANCE(ref, arg) |
| 314 |
|
| SV *ref; |
| 315 |
|
| char *arg; |
| 316 |
|
| PROTOTYPE: $$ |
| 317 |
|
| ALIAS: |
| 318 |
|
| _INSTANCE = 0 |
| 319 |
|
| _INSTANCEDOES = 1 |
| 320 |
|
| _INSTANCECAN = 2 |
| 321 |
|
| CODE: |
| 322 |
|
| { |
| 323 |
|
| static const char *methods[] = {"isa", "DOES", "can"}; |
| 324 |
|
| STRLEN len; |
| 325 |
107 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
107 |
107 |
|
| 326 |
0 |
| mg_get(ref); |
| 327 |
107 |
▶ | if( SvROK(ref) && arg && ( ( len = strlen(arg) ) > 0 ) ) |
Branch: 3 branches
| Branch | True | False | Total |
| if( SvROK(ref) && arg && ( ( len = strlen(arg) ) > 0 ) ) |
95 |
12 |
107 |
| if( SvROK(ref) && arg && ( ( len = strlen(arg) ) > 0 ) ) |
95 |
0 |
95 |
| if( SvROK(ref) && arg && ( ( len = strlen(arg) ) > 0 ) ) |
95 |
0 |
95 |
|
| 328 |
|
| { |
| 329 |
95 |
▶ | if( sv_isobject(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( sv_isobject(ref) ) |
84 |
11 |
95 |
|
| 330 |
|
| { |
| 331 |
84 |
| I32 result = 0; |
| 332 |
|
| int count; |
| 333 |
|
| |
| 334 |
84 |
| ENTER; |
| 335 |
84 |
| SAVETMPS; |
| 336 |
84 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
84 |
84 |
|
| 337 |
84 |
▶ | XPUSHs( sv_2mortal( newSVsv( ref ) ) ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( sv_2mortal( newSVsv( ref ) ) ); |
0 |
84 |
84 |
|
| 338 |
84 |
▶ | XPUSHs( sv_2mortal( newSVpv( arg, len ) ) ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( sv_2mortal( newSVpv( arg, len ) ) ); |
0 |
84 |
84 |
|
| 339 |
84 |
| PUTBACK; |
| 340 |
|
| |
| 341 |
84 |
▶ | if( ( count = call_method(methods[ix], G_SCALAR) ) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ( count = call_method(methods[ix], G_SCALAR) ) ) |
84 |
0 |
84 |
|
| 342 |
|
| { |
| 343 |
84 |
| I32 oldax = ax; |
| 344 |
84 |
| SPAGAIN; |
| 345 |
84 |
| SP -= count; |
| 346 |
84 |
| ax = (SP - PL_stack_base) + 1; |
| 347 |
84 |
| result = SvTRUE(ST(0)); |
| 348 |
84 |
| ax = oldax; |
| 349 |
|
| } |
| 350 |
|
| |
| 351 |
84 |
| PUTBACK; |
| 352 |
84 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
84 |
0 |
84 |
|
| 353 |
84 |
| LEAVE; |
| 354 |
|
| |
| 355 |
84 |
▶ | if( result ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( result ) |
72 |
12 |
84 |
|
| 356 |
|
| { |
| 357 |
72 |
| ST(0) = ref; |
| 358 |
72 |
| XSRETURN(1); |
| 359 |
|
| } |
| 360 |
|
| } |
| 361 |
|
| } |
| 362 |
35 |
| XSRETURN_UNDEF; |
| 363 |
|
| } |
| 364 |
|
| |
| 365 |
|
| ## Group 5: Invocant dispatchers |
| 366 |
|
| |
| 367 |
|
| void |
| 368 |
|
| _INVOCANT(sv) |
| 369 |
|
| SV *sv; |
| 370 |
|
| PROTOTYPE: $ |
| 371 |
|
| CODE: |
| 372 |
|
| { |
| 373 |
|
| STRLEN len; |
| 374 |
|
| const char *pv; |
| 375 |
16 |
▶ | if( SvMAGICAL(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(sv) ) |
0 |
16 |
16 |
|
| 376 |
0 |
| mg_get(sv); |
| 377 |
|
| /* blessed object? */ |
| 378 |
16 |
▶ | if( SvROK(sv) && sv_isobject(sv) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( SvROK(sv) && sv_isobject(sv) ) |
8 |
8 |
16 |
| if( SvROK(sv) && sv_isobject(sv) ) |
6 |
2 |
8 |
|
| 379 |
|
| { |
| 380 |
6 |
| ST(0) = sv; |
| 381 |
6 |
| XSRETURN(1); |
| 382 |
|
| } |
| 383 |
|
| /* valid class name? */ |
| 384 |
10 |
▶ | if( !is_string0(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( !is_string0(sv) ) |
5 |
5 |
10 |
|
| 385 |
5 |
| XSRETURN_UNDEF; |
| 386 |
5 |
| pv = SvPV(sv, len); |
| 387 |
5 |
▶ | if( len > 0 && is_class(pv, len) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( len > 0 && is_class(pv, len) ) |
5 |
0 |
5 |
| if( len > 0 && is_class(pv, len) ) |
4 |
1 |
5 |
|
| 388 |
|
| { |
| 389 |
4 |
| ST(0) = sv; |
| 390 |
4 |
| XSRETURN(1); |
| 391 |
|
| } |
| 392 |
1 |
| XSRETURN_UNDEF; |
| 393 |
|
| } |
| 394 |
|
| |
| 395 |
|
| void |
| 396 |
|
| _INVOCANTCAN(sv, method) |
| 397 |
|
| SV *sv; |
| 398 |
|
| char *method; |
| 399 |
|
| PROTOTYPE: $$ |
| 400 |
|
| CODE: |
| 401 |
|
| { |
| 402 |
|
| STRLEN len; |
| 403 |
|
| const char *pv; |
| 404 |
27 |
| int is_valid_invocant = 0; |
| 405 |
|
| STRLEN methlen; |
| 406 |
|
| |
| 407 |
27 |
▶ | if( SvMAGICAL(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(sv) ) |
0 |
27 |
27 |
|
| 408 |
0 |
| mg_get(sv); |
| 409 |
27 |
▶ | if( !method || ( ( methlen = strlen(method) ) == 0 ) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( !method || ( ( methlen = strlen(method) ) == 0 ) ) |
27 |
0 |
27 |
| if( !method || ( ( methlen = strlen(method) ) == 0 ) ) |
0 |
27 |
27 |
|
| 410 |
0 |
| XSRETURN_UNDEF; |
| 411 |
|
| |
| 412 |
|
| /* blessed object? */ |
| 413 |
27 |
▶ | if( SvROK(sv) && sv_isobject(sv) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( SvROK(sv) && sv_isobject(sv) ) |
19 |
8 |
27 |
| if( SvROK(sv) && sv_isobject(sv) ) |
18 |
1 |
19 |
|
| 414 |
18 |
| is_valid_invocant = 1; |
| 415 |
|
| /* valid class name? */ |
| 416 |
9 |
▶ | else if( is_string0(sv) ) |
Branch: 1 branch
| Branch | True | False | Total |
| else if( is_string0(sv) ) |
5 |
4 |
9 |
|
| 417 |
|
| { |
| 418 |
5 |
| pv = SvPV(sv, len); |
| 419 |
5 |
▶ | if( len > 0 && is_class(pv, len) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( len > 0 && is_class(pv, len) ) |
4 |
1 |
5 |
| if( len > 0 && is_class(pv, len) ) |
4 |
0 |
4 |
|
| 420 |
4 |
| is_valid_invocant = 1; |
| 421 |
|
| } |
| 422 |
|
| |
| 423 |
27 |
▶ | if( is_valid_invocant ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( is_valid_invocant ) |
22 |
5 |
27 |
|
| 424 |
|
| { |
| 425 |
22 |
| I32 result = 0; |
| 426 |
|
| int count; |
| 427 |
|
| |
| 428 |
22 |
| ENTER; |
| 429 |
22 |
| SAVETMPS; |
| 430 |
22 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
22 |
22 |
|
| 431 |
22 |
▶ | XPUSHs( sv_2mortal( newSVsv( sv ) ) ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( sv_2mortal( newSVsv( sv ) ) ); |
0 |
22 |
22 |
|
| 432 |
22 |
▶ | XPUSHs( sv_2mortal( newSVpv( method, methlen ) ) ); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs( sv_2mortal( newSVpv( method, methlen ) ) ); |
0 |
22 |
22 |
|
| 433 |
22 |
| PUTBACK; |
| 434 |
|
| |
| 435 |
22 |
▶ | if( ( count = call_method("can", G_SCALAR) ) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ( count = call_method("can", G_SCALAR) ) ) |
22 |
0 |
22 |
|
| 436 |
|
| { |
| 437 |
22 |
| I32 oldax = ax; |
| 438 |
22 |
| SPAGAIN; |
| 439 |
22 |
| SP -= count; |
| 440 |
22 |
| ax = (SP - PL_stack_base) + 1; |
| 441 |
22 |
| result = SvTRUE(ST(0)); |
| 442 |
22 |
| ax = oldax; |
| 443 |
|
| } |
| 444 |
|
| |
| 445 |
22 |
| PUTBACK; |
| 446 |
22 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
22 |
0 |
22 |
|
| 447 |
22 |
| LEAVE; |
| 448 |
|
| |
| 449 |
22 |
▶ | if( result ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( result ) |
17 |
5 |
22 |
|
| 450 |
|
| { |
| 451 |
17 |
| ST(0) = sv; |
| 452 |
17 |
| XSRETURN(1); |
| 453 |
|
| } |
| 454 |
|
| } |
| 455 |
10 |
| XSRETURN_UNDEF; |
| 456 |
|
| } |
| 457 |
|
| |
| 458 |
|
| ## Remaining standalone XSUBs |
| 459 |
|
| |
| 460 |
|
| void |
| 461 |
|
| _SCALAR0(ref) |
| 462 |
|
| SV *ref; |
| 463 |
|
| PROTOTYPE: $ |
| 464 |
|
| CODE: |
| 465 |
|
| { |
| 466 |
30 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
30 |
30 |
|
| 467 |
0 |
| mg_get(ref); |
| 468 |
30 |
▶ | if( SvROK(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvROK(ref) ) |
22 |
8 |
30 |
|
| 469 |
|
| { |
| 470 |
22 |
▶ | if( ( SvTYPE(SvRV(ref)) <= SVt_PVBM ) && !sv_isobject(ref) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( ( SvTYPE(SvRV(ref)) <= SVt_PVBM ) && !sv_isobject(ref) ) |
16 |
6 |
22 |
| if( ( SvTYPE(SvRV(ref)) <= SVt_PVBM ) && !sv_isobject(ref) ) |
16 |
0 |
16 |
|
| 471 |
|
| { |
| 472 |
16 |
| ST(0) = ref; |
| 473 |
16 |
| XSRETURN(1); |
| 474 |
|
| } |
| 475 |
|
| } |
| 476 |
14 |
| XSRETURN_UNDEF; |
| 477 |
|
| } |
| 478 |
|
| |
| 479 |
|
| void |
| 480 |
|
| _SCALAR(ref) |
| 481 |
|
| SV *ref; |
| 482 |
|
| PROTOTYPE: $ |
| 483 |
|
| CODE: |
| 484 |
|
| { |
| 485 |
26 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
26 |
26 |
|
| 486 |
0 |
| mg_get(ref); |
| 487 |
26 |
▶ | if( SvROK(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvROK(ref) ) |
18 |
8 |
26 |
|
| 488 |
|
| { |
| 489 |
18 |
| svtype tp = SvTYPE(SvRV(ref)); |
| 490 |
18 |
▶ | if( ( SvTYPE(SvRV(ref)) <= SVt_PVBM ) && (!sv_isobject(ref)) && is_string( SvRV(ref) ) ) |
Branch: 3 branches
| Branch | True | False | Total |
| if( ( SvTYPE(SvRV(ref)) <= SVt_PVBM ) && (!sv_isobject(ref)) && is_string( SvRV(ref) ) ) |
12 |
6 |
18 |
| if( ( SvTYPE(SvRV(ref)) <= SVt_PVBM ) && (!sv_isobject(ref)) && is_string( SvRV(ref) ) ) |
12 |
0 |
12 |
| if( ( SvTYPE(SvRV(ref)) <= SVt_PVBM ) && (!sv_isobject(ref)) && is_string( SvRV(ref) ) ) |
8 |
4 |
12 |
|
| 491 |
|
| { |
| 492 |
8 |
| ST(0) = ref; |
| 493 |
8 |
| XSRETURN(1); |
| 494 |
|
| } |
| 495 |
|
| } |
| 496 |
18 |
| XSRETURN_UNDEF; |
| 497 |
|
| } |
| 498 |
|
| |
| 499 |
|
| void |
| 500 |
|
| _REGEX(ref) |
| 501 |
|
| SV *ref; |
| 502 |
|
| PROTOTYPE: $ |
| 503 |
|
| CODE: |
| 504 |
|
| { |
| 505 |
24 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
24 |
24 |
|
| 506 |
0 |
| mg_get(ref); |
| 507 |
24 |
▶ | if( SvROK(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvROK(ref) ) |
16 |
8 |
24 |
|
| 508 |
|
| { |
| 509 |
16 |
| svtype tp = SvTYPE(SvRV(ref)); |
| 510 |
|
| #if PERL_VERSION >= 11 |
| 511 |
16 |
▶ | if( ( SVt_REGEXP == tp ) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( ( SVt_REGEXP == tp ) ) |
6 |
10 |
16 |
|
| 512 |
|
| #else |
| 513 |
|
| if( ( SVt_PVMG == tp ) && sv_isobject(ref) |
| 514 |
|
| && ( 0 == strncmp( "Regexp", sv_reftype(SvRV(ref),TRUE), |
| 515 |
|
| strlen("Regexp") ) ) ) |
| 516 |
|
| #endif |
| 517 |
|
| { |
| 518 |
6 |
| ST(0) = ref; |
| 519 |
6 |
| XSRETURN(1); |
| 520 |
|
| } |
| 521 |
|
| } |
| 522 |
18 |
| XSRETURN_UNDEF; |
| 523 |
|
| } |
| 524 |
|
| |
| 525 |
|
| void |
| 526 |
|
| _ARRAY0(ref) |
| 527 |
|
| SV *ref; |
| 528 |
|
| PROTOTYPE: $ |
| 529 |
|
| CODE: |
| 530 |
|
| { |
| 531 |
28 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
28 |
28 |
|
| 532 |
0 |
| mg_get(ref); |
| 533 |
28 |
▶ | if( is_array(ref) && !sv_isobject(ref) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( is_array(ref) && !sv_isobject(ref) ) |
14 |
14 |
28 |
| if( is_array(ref) && !sv_isobject(ref) ) |
12 |
2 |
14 |
|
| 534 |
|
| { |
| 535 |
12 |
| ST(0) = ref; |
| 536 |
12 |
| XSRETURN(1); |
| 537 |
|
| } |
| 538 |
|
| |
| 539 |
16 |
| XSRETURN_UNDEF; |
| 540 |
|
| } |
| 541 |
|
| |
| 542 |
|
| void |
| 543 |
|
| _ARRAY(ref) |
| 544 |
|
| SV *ref; |
| 545 |
|
| PROTOTYPE: $ |
| 546 |
|
| CODE: |
| 547 |
|
| { |
| 548 |
28 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
28 |
28 |
|
| 549 |
0 |
| mg_get(ref); |
| 550 |
28 |
▶ | if( is_array(ref) && !sv_isobject(ref) && ( av_len((AV *)(SvRV(ref))) >= 0 ) ) |
Branch: 3 branches
| Branch | True | False | Total |
| if( is_array(ref) && !sv_isobject(ref) && ( av_len((AV *)(SvRV(ref))) >= 0 ) ) |
14 |
14 |
28 |
| if( is_array(ref) && !sv_isobject(ref) && ( av_len((AV *)(SvRV(ref))) >= 0 ) ) |
12 |
2 |
14 |
| if( is_array(ref) && !sv_isobject(ref) && ( av_len((AV *)(SvRV(ref))) >= 0 ) ) |
10 |
2 |
12 |
|
| 551 |
|
| { |
| 552 |
10 |
| ST(0) = ref; |
| 553 |
10 |
| XSRETURN(1); |
| 554 |
|
| } |
| 555 |
18 |
| XSRETURN_UNDEF; |
| 556 |
|
| } |
| 557 |
|
| |
| 558 |
|
| void |
| 559 |
|
| _ARRAYLIKE(ref) |
| 560 |
|
| SV *ref; |
| 561 |
|
| PROTOTYPE: $ |
| 562 |
|
| CODE: |
| 563 |
|
| { |
| 564 |
36 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
36 |
36 |
|
| 565 |
0 |
| mg_get(ref); |
| 566 |
36 |
▶ | if( SvROK(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvROK(ref) ) |
30 |
6 |
36 |
|
| 567 |
|
| { |
| 568 |
30 |
▶ | if( is_array(ref) || is_like( ref, "@{}" ) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( is_array(ref) || is_like( ref, "@{}" ) ) |
18 |
12 |
30 |
| if( is_array(ref) || is_like( ref, "@{}" ) ) |
12 |
6 |
18 |
|
| 569 |
|
| { |
| 570 |
24 |
| ST(0) = ref; |
| 571 |
24 |
| XSRETURN(1); |
| 572 |
|
| } |
| 573 |
|
| } |
| 574 |
|
| |
| 575 |
12 |
| XSRETURN_UNDEF; |
| 576 |
|
| } |
| 577 |
|
| |
| 578 |
|
| void |
| 579 |
|
| _HASH0(ref) |
| 580 |
|
| SV *ref; |
| 581 |
|
| PROTOTYPE: $ |
| 582 |
|
| CODE: |
| 583 |
|
| { |
| 584 |
26 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
26 |
26 |
|
| 585 |
0 |
| mg_get(ref); |
| 586 |
26 |
▶ | if( is_hash(ref) && !sv_isobject(ref) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( is_hash(ref) && !sv_isobject(ref) ) |
12 |
14 |
26 |
| if( is_hash(ref) && !sv_isobject(ref) ) |
10 |
2 |
12 |
|
| 587 |
|
| { |
| 588 |
10 |
| ST(0) = ref; |
| 589 |
10 |
| XSRETURN(1); |
| 590 |
|
| } |
| 591 |
|
| |
| 592 |
16 |
| XSRETURN_UNDEF; |
| 593 |
|
| } |
| 594 |
|
| |
| 595 |
|
| void |
| 596 |
|
| _HASH(ref) |
| 597 |
|
| SV *ref; |
| 598 |
|
| PROTOTYPE: $ |
| 599 |
|
| CODE: |
| 600 |
|
| { |
| 601 |
26 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
26 |
26 |
|
| 602 |
0 |
| mg_get(ref); |
| 603 |
26 |
▶ | if( is_hash(ref) && !sv_isobject(ref) && ( HvKEYS(SvRV(ref)) >= 1 ) ) |
Branch: 4 branches
| Branch | True | False | Total |
| if( is_hash(ref) && !sv_isobject(ref) && ( HvKEYS(SvRV(ref)) >= 1 ) ) |
12 |
14 |
26 |
| if( is_hash(ref) && !sv_isobject(ref) && ( HvKEYS(SvRV(ref)) >= 1 ) ) |
10 |
2 |
12 |
| if( is_hash(ref) && !sv_isobject(ref) && ( HvKEYS(SvRV(ref)) >= 1 ) ) |
0 |
10 |
10 |
| if( is_hash(ref) && !sv_isobject(ref) && ( HvKEYS(SvRV(ref)) >= 1 ) ) |
8 |
2 |
10 |
|
| 604 |
|
| { |
| 605 |
8 |
| ST(0) = ref; |
| 606 |
8 |
| XSRETURN(1); |
| 607 |
|
| } |
| 608 |
|
| |
| 609 |
18 |
| XSRETURN_UNDEF; |
| 610 |
|
| } |
| 611 |
|
| |
| 612 |
|
| void |
| 613 |
|
| _HASHLIKE(ref) |
| 614 |
|
| SV *ref; |
| 615 |
|
| PROTOTYPE: $ |
| 616 |
|
| CODE: |
| 617 |
|
| { |
| 618 |
36 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
36 |
36 |
|
| 619 |
0 |
| mg_get(ref); |
| 620 |
36 |
▶ | if( SvROK(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvROK(ref) ) |
30 |
6 |
36 |
|
| 621 |
|
| { |
| 622 |
30 |
▶ | if( is_hash(ref) || is_like( ref, "%{}" ) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( is_hash(ref) || is_like( ref, "%{}" ) ) |
18 |
12 |
30 |
| if( is_hash(ref) || is_like( ref, "%{}" ) ) |
12 |
6 |
18 |
|
| 623 |
|
| { |
| 624 |
24 |
| ST(0) = ref; |
| 625 |
24 |
| XSRETURN(1); |
| 626 |
|
| } |
| 627 |
|
| } |
| 628 |
|
| |
| 629 |
12 |
| XSRETURN_UNDEF; |
| 630 |
|
| } |
| 631 |
|
| |
| 632 |
|
| void |
| 633 |
|
| _CODE(ref) |
| 634 |
|
| SV *ref; |
| 635 |
|
| PROTOTYPE: $ |
| 636 |
|
| CODE: |
| 637 |
|
| { |
| 638 |
26 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
26 |
26 |
|
| 639 |
0 |
| mg_get(ref); |
| 640 |
26 |
▶ | if( SvROK(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvROK(ref) ) |
18 |
8 |
26 |
|
| 641 |
|
| { |
| 642 |
18 |
▶ | if( SVt_PVCV == SvTYPE(SvRV(ref)) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SVt_PVCV == SvTYPE(SvRV(ref)) ) |
12 |
6 |
18 |
|
| 643 |
|
| { |
| 644 |
12 |
| ST(0) = ref; |
| 645 |
12 |
| XSRETURN(1); |
| 646 |
|
| } |
| 647 |
|
| } |
| 648 |
14 |
| XSRETURN_UNDEF; |
| 649 |
|
| } |
| 650 |
|
| |
| 651 |
|
| void |
| 652 |
|
| _CODELIKE(ref) |
| 653 |
|
| SV *ref; |
| 654 |
|
| PROTOTYPE: $ |
| 655 |
|
| CODE: |
| 656 |
|
| { |
| 657 |
19 |
▶ | if( SvMAGICAL(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvMAGICAL(ref) ) |
0 |
19 |
19 |
|
| 658 |
0 |
| mg_get(ref); |
| 659 |
19 |
▶ | if( SvROK(ref) ) |
Branch: 1 branch
| Branch | True | False | Total |
| if( SvROK(ref) ) |
13 |
6 |
19 |
|
| 660 |
|
| { |
| 661 |
13 |
▶ | if( ( SVt_PVCV == SvTYPE(SvRV(ref)) ) || ( is_like(ref, "&{}" ) ) ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( ( SVt_PVCV == SvTYPE(SvRV(ref)) ) || ( is_like(ref, "&{}" ) ) ) |
7 |
6 |
13 |
| if( ( SVt_PVCV == SvTYPE(SvRV(ref)) ) || ( is_like(ref, "&{}" ) ) ) |
2 |
5 |
7 |
|
| 662 |
|
| { |
| 663 |
8 |
| ST(0) = ref; |
| 664 |
8 |
| XSRETURN(1); |
| 665 |
|
| } |
| 666 |
|
| } |
| 667 |
11 |
| XSRETURN_UNDEF; |
| 668 |
|
| } |
| 669 |
|
| |
| 670 |
|
| void |
| 671 |
|
| _XScompiled () |
| 672 |
|
| CODE: |
| 673 |
0 |
| XSRETURN_YES; |