| 1 |
|
| #include "EXTERN.h" |
| 2 |
|
| #include "perl.h" |
| 3 |
|
| #include "XSUB.h" |
| 4 |
|
| #define NEED_grok_number |
| 5 |
|
| #define NEED_grok_numeric_radix |
| 6 |
|
| #define NEED_newRV_noinc |
| 7 |
|
| #define NEED_sv_2pv_nolen |
| 8 |
|
| /* #include "ppport.h" */ |
| 9 |
|
| |
| 10 |
|
| /* #define sv_defined(sv) (sv && (SvIOK(sv) || SvNOK(sv) || SvPOK(sv) || SvROK(sv))) */ |
| 11 |
|
| #define sv_defined(sv) (sv && SvOK(sv)) |
| 12 |
|
| #define CALL_CTX_ITEM 1 |
| 13 |
|
| #define CALL_CTX_LIST 2 |
| 14 |
|
| #define CALL_CTX_SMART 4 |
| 15 |
|
| #define CALL_CTX_PASS_SELF 8 |
| 16 |
|
| |
| 17 |
|
| /* /----------------------------------------------------------------/// */ |
| 18 |
|
| |
| 19 |
0 |
| void _debug (SV* self, SV* data) { |
| 20 |
0 |
| dSP; |
| 21 |
|
| I32 n, i; |
| 22 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 23 |
0 |
▶ | XPUSHs(self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(self); |
0 |
0 |
0 |
|
| 24 |
0 |
▶ | XPUSHs(data); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(data); |
0 |
0 |
0 |
|
| 25 |
0 |
| PUTBACK; |
| 26 |
0 |
| n = call_method("__dump_any", G_SCALAR); |
| 27 |
0 |
| SPAGAIN; |
| 28 |
0 |
▶ | for (i = 0; i < n; i++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < n; i++) POPs; |
0 |
0 |
0 |
|
| 29 |
0 |
| PUTBACK; |
| 30 |
0 |
| return; |
| 31 |
|
| } |
| 32 |
|
| |
| 33 |
2175 |
| static SV* call_sv_with_args (SV* code, SV* self, AV* args, I32 flags, SV* optional_obj, I32 call_ctx) { |
| 34 |
2175 |
| dSP; |
| 35 |
2175 |
| I32 n, i, j, count = av_len(args); |
| 36 |
|
| SV** svp; |
| 37 |
2175 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
2175 |
2175 |
|
| 38 |
2175 |
▶ | if (call_ctx & CALL_CTX_PASS_SELF) XPUSHs(self); |
Branch: 2 branches
| Branch | True | False | Total |
| if (call_ctx & CALL_CTX_PASS_SELF) XPUSHs(self); |
117 |
2058 |
2175 |
| if (call_ctx & CALL_CTX_PASS_SELF) XPUSHs(self); |
0 |
117 |
117 |
|
| 39 |
2175 |
▶ | if (sv_defined(optional_obj)) XPUSHs(optional_obj); |
Branch: 3 branches
| Branch | True | False | Total |
| if (sv_defined(optional_obj)) XPUSHs(optional_obj); |
1824 |
351 |
2175 |
| if (sv_defined(optional_obj)) XPUSHs(optional_obj); |
1824 |
0 |
1824 |
| if (sv_defined(optional_obj)) XPUSHs(optional_obj); |
0 |
1824 |
1824 |
|
| 40 |
3066 |
▶ | for (i = 0; i <= count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i <= count; i++) { |
891 |
2175 |
3066 |
|
| 41 |
|
| SV* _var; |
| 42 |
|
| AV* var; |
| 43 |
891 |
| svp = av_fetch(args, i, FALSE); |
| 44 |
891 |
| SvGETMAGIC(*svp); |
| 45 |
891 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
891 |
891 |
|
| 46 |
891 |
▶ | XPUSHs(self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(self); |
0 |
891 |
891 |
|
| 47 |
891 |
▶ | XPUSHs(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(*svp); |
0 |
891 |
891 |
|
| 48 |
891 |
| PUTBACK; |
| 49 |
891 |
| n = call_method("play_expr", G_ARRAY); |
| 50 |
891 |
| SPAGAIN; |
| 51 |
|
| /* for (j = 0; j < n; j++) XPUSHs(POPs); // noop */ |
| 52 |
891 |
| PUTBACK; |
| 53 |
|
| } |
| 54 |
2175 |
| PUTBACK; |
| 55 |
2175 |
| n = call_sv(code, flags); |
| 56 |
2142 |
| SPAGAIN; |
| 57 |
|
| |
| 58 |
|
| SV* ref; |
| 59 |
2142 |
▶ | if (flags & G_EVAL && SvTRUE(ERRSV)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (flags & G_EVAL && SvTRUE(ERRSV)) { |
492 |
1650 |
2142 |
| if (flags & G_EVAL && SvTRUE(ERRSV)) { |
492 |
0 |
492 |
| if (flags & G_EVAL && SvTRUE(ERRSV)) { |
0 |
492 |
492 |
|
| 60 |
0 |
▶ | for (i = 0; i < n; i++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < n; i++) POPs; |
0 |
0 |
0 |
|
| 61 |
0 |
| ref = &PL_sv_undef; |
| 62 |
2142 |
▶ | } else if (call_ctx & CALL_CTX_ITEM) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (call_ctx & CALL_CTX_ITEM) { |
672 |
1470 |
2142 |
|
| 63 |
672 |
▶ | ref = (n == 0) ? &PL_sv_undef : POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| ref = (n == 0) ? &PL_sv_undef : POPs; |
672 |
0 |
672 |
|
| 64 |
672 |
▶ | for (i = 1; i < n; i++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i < n; i++) POPs; |
0 |
672 |
672 |
|
| 65 |
1470 |
▶ | } else if (call_ctx & CALL_CTX_LIST) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (call_ctx & CALL_CTX_LIST) { |
36 |
1434 |
1470 |
|
| 66 |
36 |
| AV* results = newAV(); |
| 67 |
36 |
▶ | if (n) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n) { |
36 |
0 |
36 |
|
| 68 |
36 |
| av_extend(results, n - 1); |
| 69 |
84 |
▶ | for (i = n - 1; i >= 0; i--) av_store(results, i, SvREFCNT_inc((SV*)POPs)); |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = n - 1; i >= 0; i--) av_store(results, i, SvREFCNT_inc((SV*)POPs)); |
48 |
36 |
84 |
|
| 70 |
|
| } |
| 71 |
36 |
| ref = newRV_inc((SV*)results); |
| 72 |
1434 |
▶ | } else if (call_ctx & CALL_CTX_SMART) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (call_ctx & CALL_CTX_SMART) { |
1434 |
0 |
1434 |
|
| 73 |
1434 |
▶ | if (flags & G_EVAL && SvTRUE(ERRSV)) return &PL_sv_undef; |
Branch: 3 branches
| Branch | True | False | Total |
| if (flags & G_EVAL && SvTRUE(ERRSV)) return &PL_sv_undef; |
492 |
942 |
1434 |
| if (flags & G_EVAL && SvTRUE(ERRSV)) return &PL_sv_undef; |
492 |
0 |
492 |
| if (flags & G_EVAL && SvTRUE(ERRSV)) return &PL_sv_undef; |
0 |
492 |
492 |
|
| 74 |
1434 |
▶ | if (n) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n) { |
1434 |
0 |
1434 |
|
| 75 |
1434 |
| SV* result = POPs; |
| 76 |
1434 |
▶ | if (sv_defined(result)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_defined(result)) { |
1434 |
0 |
1434 |
| if (sv_defined(result)) { |
1431 |
3 |
1434 |
|
| 77 |
1431 |
▶ | if (n == 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n == 1) { |
1404 |
27 |
1431 |
|
| 78 |
1404 |
| ref = result; |
| 79 |
|
| } else { |
| 80 |
27 |
| AV* results = newAV(); |
| 81 |
27 |
▶ | if (n) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n) { |
27 |
0 |
27 |
|
| 82 |
27 |
| av_extend(results, n - 1); |
| 83 |
27 |
| av_store(results, n - 1, SvREFCNT_inc(result)); |
| 84 |
81 |
▶ | for (i = n - 2; i >= 0; i--) av_store(results, i, SvREFCNT_inc((SV*)POPs)); |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = n - 2; i >= 0; i--) av_store(results, i, SvREFCNT_inc((SV*)POPs)); |
54 |
27 |
81 |
|
| 85 |
|
| } |
| 86 |
27 |
| ref = newRV_inc((SV*)results); |
| 87 |
|
| } |
| 88 |
|
| } else { |
| 89 |
3 |
| result = POPs; |
| 90 |
3 |
▶ | for (i = 1; i < n; i++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i < n; i++) POPs; |
0 |
3 |
3 |
|
| 91 |
3 |
▶ | if (sv_defined(result)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_defined(result)) { |
3 |
0 |
3 |
| if (sv_defined(result)) { |
3 |
0 |
3 |
|
| 92 |
3 |
| PUTBACK; |
| 93 |
3 |
| SV* errsv = get_sv("@", TRUE); |
| 94 |
3 |
| sv_setsv(errsv, result); |
| 95 |
3 |
| (void)die(Nullch); |
| 96 |
|
| } else { |
| 97 |
0 |
| ref = &PL_sv_undef; |
| 98 |
|
| } |
| 99 |
|
| } |
| 100 |
|
| } else { |
| 101 |
0 |
| ref = &PL_sv_undef; |
| 102 |
|
| } |
| 103 |
|
| } |
| 104 |
2139 |
| PUTBACK; |
| 105 |
2139 |
| return ref; |
| 106 |
|
| } |
| 107 |
|
| |
| 108 |
0 |
| static SV* call_sv_with_resolved_args (SV* code, SV* self, AV* args, I32 flags, SV* optional_obj) { |
| 109 |
0 |
| dSP; |
| 110 |
0 |
| I32 n, i, j, count = av_len(args); |
| 111 |
|
| SV** svp; |
| 112 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 113 |
0 |
▶ | if (sv_defined(optional_obj)) XPUSHs(optional_obj); |
Branch: 3 branches
| Branch | True | False | Total |
| if (sv_defined(optional_obj)) XPUSHs(optional_obj); |
0 |
0 |
0 |
| if (sv_defined(optional_obj)) XPUSHs(optional_obj); |
0 |
0 |
0 |
| if (sv_defined(optional_obj)) XPUSHs(optional_obj); |
0 |
0 |
0 |
|
| 114 |
0 |
▶ | for (i = 0; i <= count; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i <= count; i++) { |
0 |
0 |
0 |
|
| 115 |
0 |
| svp = av_fetch(args, i, FALSE); |
| 116 |
0 |
| SvGETMAGIC(*svp); |
| 117 |
0 |
▶ | XPUSHs(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(*svp); |
0 |
0 |
0 |
|
| 118 |
|
| } |
| 119 |
0 |
| PUTBACK; |
| 120 |
0 |
| n = call_sv(code, flags); |
| 121 |
0 |
| SPAGAIN; |
| 122 |
|
| |
| 123 |
|
| SV* ref; |
| 124 |
0 |
▶ | if (n) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n) { |
0 |
0 |
0 |
|
| 125 |
0 |
| SV* result = POPs; |
| 126 |
0 |
▶ | if (sv_defined(result)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_defined(result)) { |
0 |
0 |
0 |
| if (sv_defined(result)) { |
0 |
0 |
0 |
|
| 127 |
0 |
▶ | if (n == 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n == 1) { |
0 |
0 |
0 |
|
| 128 |
0 |
| ref = result; |
| 129 |
|
| } else { |
| 130 |
0 |
| AV* results = newAV(); |
| 131 |
0 |
| av_extend(results, n - 1); |
| 132 |
0 |
| av_store(results, n - 1, result); |
| 133 |
0 |
▶ | for (i = n - 2; i >= 0; i--) av_store(results, i, (SV*)POPs); |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = n - 2; i >= 0; i--) av_store(results, i, (SV*)POPs); |
0 |
0 |
0 |
|
| 134 |
0 |
| ref = newRV_noinc((SV*)results); |
| 135 |
|
| } |
| 136 |
0 |
| PUTBACK; |
| 137 |
|
| } else { |
| 138 |
0 |
| result = POPs; |
| 139 |
0 |
▶ | for (i = 1; i < n; i++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i < n; i++) POPs; |
0 |
0 |
0 |
|
| 140 |
0 |
| PUTBACK; |
| 141 |
0 |
▶ | if (sv_defined(result)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_defined(result)) { |
0 |
0 |
0 |
| if (sv_defined(result)) { |
0 |
0 |
0 |
|
| 142 |
0 |
| SV* errsv = get_sv("@", TRUE); |
| 143 |
0 |
| sv_setsv(errsv, result); |
| 144 |
0 |
| (void)die(Nullch); |
| 145 |
|
| } else { |
| 146 |
0 |
| ref = &PL_sv_undef; |
| 147 |
|
| } |
| 148 |
|
| } |
| 149 |
|
| } else { |
| 150 |
0 |
| PUTBACK; |
| 151 |
0 |
| ref = &PL_sv_undef; |
| 152 |
|
| } |
| 153 |
|
| |
| 154 |
0 |
| return ref; |
| 155 |
|
| } |
| 156 |
|
| |
| 157 |
16279 |
| static bool name_is_private (const char* name) { |
| 158 |
16279 |
▶ | if ((*name == '_' || *name == '.') /* yuck - hard coded */ |
Branch: 2 branches
| Branch | True | False | Total |
| if ((*name == '_' || *name == '.') /* yuck - hard coded */ |
16219 |
60 |
16279 |
| if ((*name == '_' || *name == '.') /* yuck - hard coded */ |
0 |
16219 |
16219 |
|
| 159 |
60 |
▶ | && SvTRUE(get_sv("Template::Alloy::QR_PRIVATE", FALSE))) return 1; |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTRUE(get_sv("Template::Alloy::QR_PRIVATE", FALSE))) return 1; |
24 |
36 |
60 |
|
| 160 |
16255 |
| return 0; |
| 161 |
|
| } |
| 162 |
|
| |
| 163 |
0 |
| static void _play_foreach (SV* self, SV* ref, SV* node, SV* out_ref) { |
| 164 |
0 |
| dSP; |
| 165 |
|
| I32 i, n; |
| 166 |
|
| SV** svp; |
| 167 |
|
| |
| 168 |
|
| /* ref contains the variable name (if any) and the array to foreach on */ |
| 169 |
0 |
| svp = av_fetch((AV*)SvRV(ref), 0, FALSE); |
| 170 |
0 |
| SvGETMAGIC(*svp); |
| 171 |
0 |
| SV* var = *svp; |
| 172 |
0 |
| svp = av_fetch((AV*)SvRV(ref), 1, FALSE); |
| 173 |
0 |
| SvGETMAGIC(*svp); |
| 174 |
0 |
| SV* items = *svp; |
| 175 |
|
| |
| 176 |
|
| /* turn items into the array that it actually will be */ |
| 177 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 178 |
0 |
▶ | XPUSHs(self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(self); |
0 |
0 |
0 |
|
| 179 |
0 |
▶ | XPUSHs(items); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(items); |
0 |
0 |
0 |
|
| 180 |
0 |
| PUTBACK; |
| 181 |
0 |
| n = call_method("play_expr", G_SCALAR); |
| 182 |
0 |
| SPAGAIN; |
| 183 |
0 |
| items = POPs; |
| 184 |
0 |
▶ | for (i = 1; i < n; i++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i < n; i++) POPs; |
0 |
0 |
0 |
|
| 185 |
0 |
| PUTBACK; |
| 186 |
|
| |
| 187 |
|
| /* make sure we got something back */ |
| 188 |
0 |
▶ | if (! sv_defined(items) || ! SvROK(items)) return; |
Branch: 3 branches
| Branch | True | False | Total |
| if (! sv_defined(items) || ! SvROK(items)) return; |
0 |
0 |
0 |
| if (! sv_defined(items) || ! SvROK(items)) return; |
0 |
0 |
0 |
| if (! sv_defined(items) || ! SvROK(items)) return; |
0 |
0 |
0 |
|
| 189 |
|
| |
| 190 |
|
| /* turn the items into an iterator if it isn't already one */ |
| 191 |
0 |
▶ | if (! sv_isobject(items) |
Branch: 1 branch
| Branch | True | False | Total |
| if (! sv_isobject(items) |
0 |
0 |
0 |
|
| 192 |
0 |
▶ | || (! sv_derived_from(items, "Template::Alloy::Iterator") /* hrm - don't really like hard coded names */ |
Branch: 1 branch
| Branch | True | False | Total |
| || (! sv_derived_from(items, "Template::Alloy::Iterator") /* hrm - don't really like hard coded names */ |
0 |
0 |
0 |
|
| 193 |
0 |
▶ | && ! sv_derived_from(items, "Template::Iterator"))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && ! sv_derived_from(items, "Template::Iterator"))) { |
0 |
0 |
0 |
|
| 194 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 195 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv("Template::Alloy::Iterator", 0))); /* hrm - even worse here */ |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv("Template::Alloy::Iterator", 0))); /* hrm - even worse here */ |
0 |
0 |
0 |
|
| 196 |
0 |
▶ | XPUSHs(items); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(items); |
0 |
0 |
0 |
|
| 197 |
0 |
| PUTBACK; |
| 198 |
0 |
| n = call_method("new", G_SCALAR); |
| 199 |
0 |
| SPAGAIN; |
| 200 |
0 |
| items = POPs; |
| 201 |
0 |
▶ | for (i = 1; i < n; i++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i < n; i++) POPs; |
0 |
0 |
0 |
|
| 202 |
0 |
| PUTBACK; |
| 203 |
|
| |
| 204 |
|
| } |
| 205 |
|
| |
| 206 |
0 |
| svp = av_fetch((AV*)SvRV(node), 4, FALSE); |
| 207 |
0 |
| SvGETMAGIC(*svp); |
| 208 |
0 |
| SV* sub_tree = *svp; |
| 209 |
|
| |
| 210 |
|
| /* localize the loop object into the stash */ |
| 211 |
0 |
| svp = hv_fetch((HV*)SvRV(self), "_vars", 5, FALSE); |
| 212 |
0 |
| SvGETMAGIC(*svp); |
| 213 |
0 |
| SV* _vars = *svp; |
| 214 |
0 |
| HV* vars = (HV*)SvRV(_vars); |
| 215 |
0 |
| bool loop_exists = hv_exists(vars, "loop", 4); |
| 216 |
0 |
▶ | SV* old_loop = (loop_exists) ? hv_delete(vars, "loop", 4, 0) : Nullsv; |
Branch: 1 branch
| Branch | True | False | Total |
| SV* old_loop = (loop_exists) ? hv_delete(vars, "loop", 4, 0) : Nullsv; |
0 |
0 |
0 |
|
| 217 |
|
| |
| 218 |
0 |
| SvREFCNT_inc(items); |
| 219 |
0 |
| hv_store(vars, "loop", 4, items, 0); |
| 220 |
|
| |
| 221 |
|
| /* sv_catsv(SvRV(out_ref), sv_2mortal(newSVpv("Test", 0))); */ |
| 222 |
|
| |
| 223 |
|
| /* _debug(self, items); */ |
| 224 |
|
| |
| 225 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 226 |
0 |
▶ | XPUSHs(items); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(items); |
0 |
0 |
0 |
|
| 227 |
0 |
| PUTBACK; |
| 228 |
0 |
| n = call_method("get_first", G_ARRAY); /* todo - eval to catch perl errors - so we can put the stash back */ |
| 229 |
0 |
| SPAGAIN; |
| 230 |
0 |
▶ | SV* error = (n >= 2) ? POPs : Nullsv; |
Branch: 1 branch
| Branch | True | False | Total |
| SV* error = (n >= 2) ? POPs : Nullsv; |
0 |
0 |
0 |
|
| 231 |
0 |
▶ | SV* item = (n >= 1) ? POPs : Nullsv; |
Branch: 1 branch
| Branch | True | False | Total |
| SV* item = (n >= 1) ? POPs : Nullsv; |
0 |
0 |
0 |
|
| 232 |
|
| I32 j; |
| 233 |
0 |
▶ | for (j = 2; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 2; j < n; j++) POPs; |
0 |
0 |
0 |
|
| 234 |
0 |
| PUTBACK; |
| 235 |
|
| |
| 236 |
|
| /* here is the iteration */ |
| 237 |
0 |
▶ | while (! SvTRUE(error)) { |
Branch: 1 branch
| Branch | True | False | Total |
| while (! SvTRUE(error)) { |
0 |
0 |
0 |
|
| 238 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 239 |
0 |
▶ | XPUSHs(self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(self); |
0 |
0 |
0 |
|
| 240 |
0 |
▶ | XPUSHs(var); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(var); |
0 |
0 |
0 |
|
| 241 |
0 |
▶ | XPUSHs(item); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(item); |
0 |
0 |
0 |
|
| 242 |
0 |
| PUTBACK; |
| 243 |
0 |
| n = call_method("set_variable", G_VOID); |
| 244 |
0 |
| SPAGAIN; |
| 245 |
0 |
| PUTBACK; |
| 246 |
|
| |
| 247 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 248 |
0 |
▶ | XPUSHs(self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(self); |
0 |
0 |
0 |
|
| 249 |
0 |
▶ | XPUSHs(sub_tree); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sub_tree); |
0 |
0 |
0 |
|
| 250 |
0 |
▶ | XPUSHs(out_ref); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(out_ref); |
0 |
0 |
0 |
|
| 251 |
0 |
| PUTBACK; |
| 252 |
0 |
| n = call_method("play_tree", G_VOID | G_EVAL); |
| 253 |
0 |
| SPAGAIN; |
| 254 |
0 |
| PUTBACK; |
| 255 |
|
| |
| 256 |
0 |
| SV* errsv = get_sv("@", TRUE); |
| 257 |
0 |
▶ | if (SvTRUE(errsv)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTRUE(errsv)) { |
0 |
0 |
0 |
|
| 258 |
0 |
▶ | if (sv_isobject(errsv) |
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_isobject(errsv) |
0 |
0 |
0 |
|
| 259 |
0 |
▶ | && (sv_derived_from(errsv, "Template::Alloy::Exception") |
Branch: 1 branch
| Branch | True | False | Total |
| && (sv_derived_from(errsv, "Template::Alloy::Exception") |
0 |
0 |
0 |
|
| 260 |
0 |
▶ | || sv_derived_from(errsv, "Template::Exception"))) { |
Branch: 1 branch
| Branch | True | False | Total |
| || sv_derived_from(errsv, "Template::Exception"))) { |
0 |
0 |
0 |
|
| 261 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 262 |
0 |
▶ | XPUSHs(errsv); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(errsv); |
0 |
0 |
0 |
|
| 263 |
0 |
| PUTBACK; |
| 264 |
0 |
| n = call_method("type", G_SCALAR); /* todo - eval to catch perl errors - so we can put the stash back */ |
| 265 |
0 |
| SPAGAIN; |
| 266 |
0 |
| SV* type = POPs; |
| 267 |
0 |
| PUTBACK; |
| 268 |
0 |
▶ | if (sv_eq(type, sv_2mortal(newSVpv("next", 0)))) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_eq(type, sv_2mortal(newSVpv("next", 0)))) { |
0 |
0 |
0 |
|
| 269 |
|
| /* do nothing - fall down to the next */ |
| 270 |
0 |
▶ | } else if (sv_eq(type, sv_2mortal(newSVpv("last", 0)))) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (sv_eq(type, sv_2mortal(newSVpv("last", 0)))) { |
0 |
0 |
0 |
|
| 271 |
0 |
| break; /* exit the while loop */ |
| 272 |
|
| } else { |
| 273 |
0 |
| (void)die(Nullch); /* rethrow exception */ |
| 274 |
|
| } |
| 275 |
|
| } else { |
| 276 |
0 |
| (void)die(Nullch); |
| 277 |
|
| } |
| 278 |
|
| } |
| 279 |
|
| |
| 280 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 281 |
0 |
▶ | XPUSHs(items); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(items); |
0 |
0 |
0 |
|
| 282 |
0 |
| PUTBACK; |
| 283 |
0 |
| n = call_method("get_next", G_ARRAY); /* todo - eval to catch perl errors - so we can put the stash back */ |
| 284 |
0 |
| SPAGAIN; |
| 285 |
0 |
▶ | error = (n >= 2) ? POPs : Nullsv; |
Branch: 1 branch
| Branch | True | False | Total |
| error = (n >= 2) ? POPs : Nullsv; |
0 |
0 |
0 |
|
| 286 |
0 |
▶ | item = (n >= 1) ? POPs : Nullsv; |
Branch: 1 branch
| Branch | True | False | Total |
| item = (n >= 1) ? POPs : Nullsv; |
0 |
0 |
0 |
|
| 287 |
|
| I32 j; |
| 288 |
0 |
▶ | for (j = 2; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 2; j < n; j++) POPs; |
0 |
0 |
0 |
|
| 289 |
0 |
| PUTBACK; |
| 290 |
|
| |
| 291 |
|
| } |
| 292 |
|
| |
| 293 |
0 |
▶ | if (SvTRUE(error) && ! sv_eq(error, sv_2mortal(newSVpv("3", 0)))) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvTRUE(error) && ! sv_eq(error, sv_2mortal(newSVpv("3", 0)))) { |
0 |
0 |
0 |
| if (SvTRUE(error) && ! sv_eq(error, sv_2mortal(newSVpv("3", 0)))) { |
0 |
0 |
0 |
|
| 294 |
0 |
| SV* errsv = get_sv("@", TRUE); |
| 295 |
0 |
| sv_setsv(errsv, error); |
| 296 |
0 |
| (void)die(Nullch); |
| 297 |
|
| } |
| 298 |
|
| |
| 299 |
|
| /* restore the old loop */ |
| 300 |
0 |
| hv_delete(vars, "loop", 4, G_DISCARD); |
| 301 |
0 |
▶ | if (loop_exists) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (loop_exists) { |
0 |
0 |
0 |
|
| 302 |
0 |
| SvREFCNT_inc(old_loop); |
| 303 |
0 |
| hv_store(vars, "loop", 4, old_loop, 0); |
| 304 |
|
| } |
| 305 |
|
| |
| 306 |
0 |
| return; |
| 307 |
|
| } |
| 308 |
|
| |
| 309 |
|
| |
| 310 |
0 |
| static void xs_throw (SV* self, const char* exception_type, SV* msg) { |
| 311 |
0 |
| dSP; |
| 312 |
|
| |
| 313 |
0 |
▶ | if (sv_isobject(msg) |
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_isobject(msg) |
0 |
0 |
0 |
|
| 314 |
0 |
▶ | && (sv_derived_from(msg, "Template::Alloy::Exception") |
Branch: 1 branch
| Branch | True | False | Total |
| && (sv_derived_from(msg, "Template::Alloy::Exception") |
0 |
0 |
0 |
|
| 315 |
0 |
▶ | || sv_derived_from(msg, "Template::Exception"))) { |
Branch: 1 branch
| Branch | True | False | Total |
| || sv_derived_from(msg, "Template::Exception"))) { |
0 |
0 |
0 |
|
| 316 |
0 |
| SV* errsv = get_sv("@", TRUE); |
| 317 |
0 |
| sv_setsv(errsv, msg); |
| 318 |
0 |
| (void)die(Nullch); |
| 319 |
|
| } |
| 320 |
|
| |
| 321 |
0 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
0 |
0 |
|
| 322 |
0 |
▶ | XPUSHs(self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(self); |
0 |
0 |
0 |
|
| 323 |
0 |
▶ | XPUSHs(sv_2mortal(newSVpv(exception_type, 0))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv(exception_type, 0))); |
0 |
0 |
0 |
|
| 324 |
0 |
▶ | XPUSHs(msg); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(msg); |
0 |
0 |
0 |
|
| 325 |
0 |
| PUTBACK; |
| 326 |
0 |
| I32 n = call_method("throw", G_VOID); |
| 327 |
0 |
| SPAGAIN; |
| 328 |
|
| I32 i; |
| 329 |
0 |
▶ | for (i = 0; i < n; i++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < n; i++) POPs; |
0 |
0 |
0 |
|
| 330 |
0 |
| PUTBACK; |
| 331 |
0 |
| return; |
| 332 |
|
| } |
| 333 |
|
| |
| 334 |
0 |
| static void xs_die (SV* obj) { |
| 335 |
0 |
| dSP; |
| 336 |
0 |
| return; |
| 337 |
|
| } |
| 338 |
|
| |
| 339 |
|
| /* /----------------------------------------------------------------/// */ |
| 340 |
|
| |
| 341 |
|
| MODULE = Template::Alloy::XS PACKAGE = Template::Alloy::XS |
| 342 |
|
| |
| 343 |
|
| PROTOTYPES: DISABLE |
| 344 |
|
| |
| 345 |
|
| static int |
| 346 |
|
| __test_xs (self) |
| 347 |
|
| SV* self; |
| 348 |
|
| CODE: |
| 349 |
|
| GV *gv; |
| 350 |
2 |
▶ | if (sv_isobject(self)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_isobject(self)) { |
2 |
0 |
2 |
|
| 351 |
2 |
| HV* obj = SvSTASH((SV*) SvRV(self)); |
| 352 |
2 |
▶ | if ((gv = gv_fetchmethod_autoload(obj, "foobar", 0))){ |
Branch: 1 branch
| Branch | True | False | Total |
| if ((gv = gv_fetchmethod_autoload(obj, "foobar", 0))){ |
1 |
1 |
2 |
|
| 353 |
1 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
1 |
1 |
|
| 354 |
1 |
▶ | XPUSHs(self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(self); |
0 |
1 |
1 |
|
| 355 |
1 |
| PUTBACK; |
| 356 |
|
| I32 n, i; |
| 357 |
1 |
| n = call_method("foobar", G_ARRAY); |
| 358 |
1 |
| SPAGAIN; |
| 359 |
1 |
| SV* r = POPs; |
| 360 |
1 |
▶ | for (i = 1; i < n; i++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 1; i < n; i++) POPs; |
0 |
1 |
1 |
|
| 361 |
1 |
| PUTBACK; |
| 362 |
|
| |
| 363 |
1 |
▶ | if (n > 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n > 1) { |
0 |
1 |
1 |
|
| 364 |
0 |
| RETVAL = -5; |
| 365 |
|
| } else { |
| 366 |
1 |
| RETVAL = SvNV(r); |
| 367 |
1 |
| SV* foo = &PL_sv_undef; |
| 368 |
1 |
| HV* bar = newHV(); |
| 369 |
1 |
| SV** res = hv_store(bar, "foo", 3, sv_2mortal(newSVpv("123",0)), 0); |
| 370 |
1 |
| SV** svp = hv_fetch(bar, "foo", 3, FALSE); |
| 371 |
1 |
| RETVAL = SvNV(*svp); |
| 372 |
|
| /* RETVAL = sv_defined(r) ? 7 : 8; */ |
| 373 |
|
| } |
| 374 |
|
| |
| 375 |
|
| } else { |
| 376 |
1 |
| RETVAL = -1; |
| 377 |
|
| } |
| 378 |
|
| } else { |
| 379 |
0 |
| RETVAL = -2; |
| 380 |
|
| } |
| 381 |
|
| OUTPUT: |
| 382 |
|
| RETVAL |
| 383 |
|
| |
| 384 |
|
| |
| 385 |
|
| static SV* |
| 386 |
|
| play_expr (_self, _var, ...) |
| 387 |
|
| SV* _self; |
| 388 |
|
| SV* _var; |
| 389 |
|
| PPCODE: |
| 390 |
25063 |
▶ | if (! _var) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (! _var) XSRETURN_UNDEF; |
0 |
25063 |
25063 |
|
| 391 |
25063 |
▶ | if (! SvROK(_var)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (! SvROK(_var)) { |
8441 |
16622 |
25063 |
|
| 392 |
8441 |
▶ | XPUSHs(_var); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_var); |
0 |
8441 |
8441 |
|
| 393 |
8441 |
| XSRETURN(1); |
| 394 |
|
| } |
| 395 |
|
| |
| 396 |
16622 |
| HV* self = (HV*)SvRV(_self); |
| 397 |
16622 |
| AV* var = (AV*)SvRV(_var); |
| 398 |
16622 |
▶ | HV* Args = (items > 2 && SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVHV) ? (HV*)SvRV(ST(2)) : Nullhv; |
Branch: 3 branches
| Branch | True | False | Total |
| HV* Args = (items > 2 && SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVHV) ? (HV*)SvRV(ST(2)) : Nullhv; |
105 |
16517 |
16622 |
| HV* Args = (items > 2 && SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVHV) ? (HV*)SvRV(ST(2)) : Nullhv; |
105 |
0 |
105 |
| HV* Args = (items > 2 && SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVHV) ? (HV*)SvRV(ST(2)) : Nullhv; |
105 |
0 |
105 |
|
| 399 |
16622 |
| I32 i = 0; |
| 400 |
|
| I32 n; |
| 401 |
|
| SV** svp; |
| 402 |
|
| SV** args_svp; |
| 403 |
|
| |
| 404 |
16622 |
| svp = hv_fetch(Args, "return_ref", 10, FALSE); |
| 405 |
16622 |
▶ | bool return_ref = (svp && SvTRUE(*svp)); |
Branch: 2 branches
| Branch | True | False | Total |
| bool return_ref = (svp && SvTRUE(*svp)); |
54 |
16568 |
16622 |
| bool return_ref = (svp && SvTRUE(*svp)); |
54 |
0 |
54 |
|
| 406 |
16622 |
| I32 var_len = av_len(var); |
| 407 |
|
| |
| 408 |
|
| /* determine the top level of this particular variable access */ |
| 409 |
|
| SV* ref; |
| 410 |
|
| SV* name; |
| 411 |
|
| AV* args; |
| 412 |
16622 |
▶ | if (i > var_len) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (i > var_len) { |
0 |
16622 |
16622 |
|
| 413 |
0 |
| name = &PL_sv_undef; |
| 414 |
|
| } else { |
| 415 |
16622 |
| svp = av_fetch(var, i++, FALSE); |
| 416 |
16622 |
| SvGETMAGIC(*svp); |
| 417 |
16622 |
| name = (SV*)(*svp); |
| 418 |
|
| } |
| 419 |
|
| |
| 420 |
16622 |
▶ | if (i > var_len) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (i > var_len) { |
27 |
16595 |
16622 |
|
| 421 |
27 |
| args = (AV*)sv_2mortal((SV*)newAV()); |
| 422 |
|
| } else { |
| 423 |
16595 |
| args_svp = av_fetch(var, i++, FALSE); |
| 424 |
16595 |
| SvGETMAGIC(*args_svp); |
| 425 |
16595 |
▶ | args = (SvROK(*args_svp) && SvTYPE(SvRV(*args_svp)) == SVt_PVAV) ? (AV*)SvRV(*args_svp) : (AV*)sv_2mortal((SV*)newAV()); |
Branch: 2 branches
| Branch | True | False | Total |
| args = (SvROK(*args_svp) && SvTYPE(SvRV(*args_svp)) == SVt_PVAV) ? (AV*)SvRV(*args_svp) : (AV*)sv_2mortal((SV*)newAV()); |
129 |
16466 |
16595 |
| args = (SvROK(*args_svp) && SvTYPE(SvRV(*args_svp)) == SVt_PVAV) ? (AV*)SvRV(*args_svp) : (AV*)sv_2mortal((SV*)newAV()); |
129 |
0 |
129 |
|
| 426 |
|
| } |
| 427 |
|
| |
| 428 |
|
| /* warn "play_expr: begin \"$name\"\n" if trace; */ |
| 429 |
16622 |
▶ | if (SvROK(name)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(name)) { |
8641 |
7981 |
16622 |
|
| 430 |
8641 |
▶ | if (SvTYPE(SvRV(name)) != SVt_PVAV) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(SvRV(name)) != SVt_PVAV) |
0 |
8641 |
8641 |
|
| 431 |
0 |
| (void)die("Found a non-arrayref during play_expr"); |
| 432 |
|
| |
| 433 |
|
| /* see if the first item is defined - if not - its an operator tree */ |
| 434 |
8641 |
| svp = av_fetch((AV*)SvRV(name), 0, FALSE); |
| 435 |
8641 |
| SvGETMAGIC(*svp); |
| 436 |
8641 |
▶ | if (! sv_defined(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(*svp)) { |
8641 |
0 |
8641 |
| if (! sv_defined(*svp)) { |
8467 |
174 |
8641 |
|
| 437 |
8467 |
| svp = av_fetch((AV*)SvRV(name), 1, FALSE); |
| 438 |
8467 |
| SvGETMAGIC(*svp); |
| 439 |
|
| /* if it is the .. operator then just return the number of elements it created (in array context) */ |
| 440 |
16755 |
▶ | if (GIMME_V == G_ARRAY && sv_eq(*svp, sv_2mortal(newSVpv("..", 0)))) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (GIMME_V == G_ARRAY && sv_eq(*svp, sv_2mortal(newSVpv("..", 0)))) { |
425 |
8042 |
8467 |
| if (GIMME_V == G_ARRAY && sv_eq(*svp, sv_2mortal(newSVpv("..", 0)))) { |
173 |
252 |
425 |
|
| 441 |
173 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
173 |
173 |
|
| 442 |
173 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
173 |
173 |
|
| 443 |
173 |
▶ | XPUSHs(name); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(name); |
0 |
173 |
173 |
|
| 444 |
173 |
| PUTBACK; |
| 445 |
173 |
| n = call_method("play_operator", G_ARRAY); |
| 446 |
173 |
| SPAGAIN; |
| 447 |
173 |
| PUTBACK; |
| 448 |
173 |
| XSRETURN(n); |
| 449 |
8294 |
▶ | } else if (sv_eq(*svp, sv_2mortal(newSVpv("-temp-", 0)))) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (sv_eq(*svp, sv_2mortal(newSVpv("-temp-", 0)))) { |
84 |
8210 |
8294 |
|
| 450 |
84 |
| svp = av_fetch((AV*)SvRV(name), 2, FALSE); |
| 451 |
84 |
| SvGETMAGIC(*svp); |
| 452 |
84 |
| ref = (SV*)(*svp); |
| 453 |
|
| } else { |
| 454 |
8210 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
8210 |
8210 |
|
| 455 |
8210 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
8210 |
8210 |
|
| 456 |
8210 |
▶ | XPUSHs(name); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(name); |
0 |
8210 |
8210 |
|
| 457 |
8210 |
| PUTBACK; |
| 458 |
8210 |
| n = call_method("play_operator", G_SCALAR); |
| 459 |
8204 |
| SPAGAIN; |
| 460 |
8204 |
| ref = POPs; |
| 461 |
|
| I32 j; |
| 462 |
8204 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
8204 |
8204 |
|
| 463 |
8204 |
| PUTBACK; |
| 464 |
|
| } |
| 465 |
|
| |
| 466 |
|
| } else { /* a named variable access (ie via $name.foo) */ |
| 467 |
174 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
174 |
174 |
|
| 468 |
174 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
174 |
174 |
|
| 469 |
174 |
▶ | XPUSHs(name); /* we could check if name is an array - but we will let the recursive call hit */ |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(name); /* we could check if name is an array - but we will let the recursive call hit */ |
0 |
174 |
174 |
|
| 470 |
174 |
| PUTBACK; |
| 471 |
174 |
| n = call_method("play_expr", G_SCALAR); |
| 472 |
174 |
| SPAGAIN; |
| 473 |
174 |
| name = POPs; |
| 474 |
|
| STRLEN name_len; |
| 475 |
174 |
▶ | char* name_c = SvPV(name, name_len); |
Branch: 1 branch
| Branch | True | False | Total |
| char* name_c = SvPV(name, name_len); |
165 |
9 |
174 |
|
| 476 |
174 |
| name_c = SvPV(name, name_len); |
| 477 |
|
| I32 j; |
| 478 |
174 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
174 |
174 |
|
| 479 |
174 |
| PUTBACK; |
| 480 |
|
| |
| 481 |
174 |
▶ | if (sv_defined(name)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_defined(name)) { |
174 |
0 |
174 |
| if (sv_defined(name)) { |
174 |
0 |
174 |
|
| 482 |
174 |
▶ | if (name_is_private(name_c)) { /* don't allow vars that begin with _ */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (name_is_private(name_c)) { /* don't allow vars that begin with _ */ |
3 |
171 |
174 |
|
| 483 |
3 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
3 |
3 |
|
| 484 |
3 |
| XSRETURN(1); |
| 485 |
|
| } |
| 486 |
171 |
| svp = hv_fetch(self, "_vars", 5, FALSE); |
| 487 |
171 |
| SvGETMAGIC(*svp); |
| 488 |
171 |
| HV* vars = (HV*)SvRV(*svp); |
| 489 |
171 |
▶ | if (svp = hv_fetch(vars, name_c, name_len, FALSE)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp = hv_fetch(vars, name_c, name_len, FALSE)) { |
126 |
45 |
171 |
|
| 490 |
126 |
| SvGETMAGIC(*svp); |
| 491 |
126 |
| ref = *svp; |
| 492 |
126 |
▶ | if (return_ref && i >= var_len && ! SvROK(ref)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
0 |
126 |
126 |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
0 |
0 |
0 |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
0 |
0 |
0 |
|
| 493 |
0 |
▶ | XPUSHs(newRV_inc(ref)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(newRV_inc(ref)); |
0 |
0 |
0 |
|
| 494 |
0 |
| XSRETURN(1); |
| 495 |
|
| } |
| 496 |
|
| } else { |
| 497 |
45 |
| SV* table = get_sv("Template::Alloy::VOBJS", FALSE); |
| 498 |
45 |
▶ | if (SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(table) |
45 |
0 |
45 |
|
| 499 |
45 |
▶ | && SvTYPE(SvRV(table)) == SVt_PVHV |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTYPE(SvRV(table)) == SVt_PVHV |
45 |
0 |
45 |
|
| 500 |
45 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE)) |
0 |
45 |
45 |
|
| 501 |
0 |
▶ | && SvTRUE(*svp)) { |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTRUE(*svp)) { |
0 |
0 |
0 |
|
| 502 |
0 |
| SvGETMAGIC(*svp); |
| 503 |
0 |
| ref = *svp; |
| 504 |
|
| } else { |
| 505 |
45 |
| ref = &PL_sv_undef; |
| 506 |
|
| } |
| 507 |
|
| } |
| 508 |
|
| } |
| 509 |
|
| } |
| 510 |
7981 |
▶ | } else if (sv_defined(name)) { |
Branch: 2 branches
| Branch | True | False | Total |
| } else if (sv_defined(name)) { |
7981 |
0 |
7981 |
| } else if (sv_defined(name)) { |
7981 |
0 |
7981 |
|
| 511 |
|
| |
| 512 |
|
| STRLEN name_len; |
| 513 |
7981 |
| char* name_c = SvPV(name, name_len); |
| 514 |
|
| |
| 515 |
7981 |
▶ | if (name_is_private(name_c)) { /* don't allow vars that begin with _ */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (name_is_private(name_c)) { /* don't allow vars that begin with _ */ |
15 |
7966 |
7981 |
|
| 516 |
15 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
15 |
15 |
|
| 517 |
21 |
| XSRETURN(1); |
| 518 |
|
| } |
| 519 |
7966 |
| svp = hv_fetch(self, "_vars", 5, FALSE); |
| 520 |
7966 |
| SvGETMAGIC(*svp); |
| 521 |
|
| |
| 522 |
7966 |
| HV* vars = (HV*)SvRV(*svp); |
| 523 |
7966 |
▶ | if (svp = hv_fetch(vars, name_c, name_len, FALSE)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp = hv_fetch(vars, name_c, name_len, FALSE)) { |
7333 |
633 |
7966 |
|
| 524 |
7333 |
| SvGETMAGIC(*svp); |
| 525 |
7333 |
| ref = *svp; |
| 526 |
7333 |
▶ | if (return_ref && i >= var_len && ! SvROK(ref)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
54 |
7279 |
7333 |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
21 |
33 |
54 |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
6 |
15 |
21 |
|
| 527 |
6 |
▶ | XPUSHs(newRV_inc(ref)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(newRV_inc(ref)); |
0 |
6 |
6 |
|
| 528 |
6 |
| XSRETURN(1); |
| 529 |
|
| } |
| 530 |
|
| } |
| 531 |
7960 |
▶ | if (! svp || ! sv_defined(ref)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (! svp || ! sv_defined(ref)) { |
7327 |
633 |
7960 |
| if (! svp || ! sv_defined(ref)) { |
7327 |
0 |
7327 |
| if (! svp || ! sv_defined(ref)) { |
36 |
7291 |
7327 |
|
| 532 |
669 |
▶ | if (sv_eq(name, sv_2mortal(newSVpv("template", 0))) |
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_eq(name, sv_2mortal(newSVpv("template", 0))) |
132 |
537 |
669 |
|
| 533 |
132 |
▶ | && (svp = hv_fetch(self, "_template", 9, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch(self, "_template", 9, FALSE))) { |
132 |
0 |
132 |
|
| 534 |
132 |
| SvGETMAGIC(*svp); |
| 535 |
132 |
| ref = *svp; |
| 536 |
537 |
▶ | } else if (sv_eq(name, sv_2mortal(newSVpv("component", 0))) |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (sv_eq(name, sv_2mortal(newSVpv("component", 0))) |
39 |
498 |
537 |
|
| 537 |
39 |
▶ | && (svp = hv_fetch(self, "_component", 10, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch(self, "_component", 10, FALSE))) { |
39 |
0 |
39 |
|
| 538 |
39 |
| SvGETMAGIC(*svp); |
| 539 |
39 |
| ref = *svp; |
| 540 |
|
| } else { |
| 541 |
498 |
| SV* table = get_sv("Template::Alloy::VOBJS", FALSE); |
| 542 |
498 |
▶ | if (SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(table) |
498 |
0 |
498 |
|
| 543 |
498 |
▶ | && SvTYPE(SvRV(table)) == SVt_PVHV |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTYPE(SvRV(table)) == SVt_PVHV |
498 |
0 |
498 |
|
| 544 |
498 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE)) |
27 |
471 |
498 |
|
| 545 |
27 |
▶ | && SvTRUE(*svp)) { |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTRUE(*svp)) { |
27 |
0 |
27 |
|
| 546 |
27 |
| SvGETMAGIC(*svp); |
| 547 |
27 |
| ref = *svp; |
| 548 |
|
| } else { |
| 549 |
471 |
| svp = hv_fetch(self, "VMETHOD_FUNCTIONS", 17, FALSE); |
| 550 |
471 |
▶ | if (svp) SvGETMAGIC(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) SvGETMAGIC(*svp); |
471 |
0 |
471 |
|
| 551 |
471 |
| SV* table = get_sv("Template::Alloy::ITEM_OPS", TRUE); |
| 552 |
471 |
▶ | if ((! sv_defined(*svp) || SvTRUE(*svp)) |
Branch: 3 branches
| Branch | True | False | Total |
| if ((! sv_defined(*svp) || SvTRUE(*svp)) |
471 |
0 |
471 |
| if ((! sv_defined(*svp) || SvTRUE(*svp)) |
9 |
462 |
471 |
| if ((! sv_defined(*svp) || SvTRUE(*svp)) |
3 |
6 |
9 |
|
| 553 |
465 |
▶ | && SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| && SvROK(table) |
465 |
0 |
465 |
|
| 554 |
465 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
27 |
438 |
465 |
|
| 555 |
27 |
| SvGETMAGIC(*svp); |
| 556 |
27 |
| ref = *svp; |
| 557 |
|
| } else { |
| 558 |
444 |
| ref = &PL_sv_undef; |
| 559 |
|
| } |
| 560 |
|
| } |
| 561 |
|
| } |
| 562 |
|
| |
| 563 |
669 |
▶ | if (! sv_defined(ref) |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(ref) |
669 |
0 |
669 |
| if (! sv_defined(ref) |
444 |
225 |
669 |
|
| 564 |
444 |
▶ | && (svp = hv_fetch(self, "LOWER_CASE_VAR_FALLBACK", 23, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch(self, "LOWER_CASE_VAR_FALLBACK", 23, FALSE))) { |
3 |
441 |
444 |
|
| 565 |
3 |
| SvGETMAGIC(*svp); |
| 566 |
3 |
▶ | if (SvTRUE(*svp)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTRUE(*svp)) { |
3 |
0 |
3 |
|
| 567 |
3 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
3 |
3 |
|
| 568 |
3 |
▶ | XPUSHs(name); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(name); |
0 |
3 |
3 |
|
| 569 |
3 |
| PUTBACK; |
| 570 |
3 |
| n = call_pv("Template::Alloy::XS::__lc", G_SCALAR); /* i would love to call the builtin directly (anybody know how?) */ |
| 571 |
3 |
| SPAGAIN; |
| 572 |
3 |
▶ | if (n >= 1) name = POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| if (n >= 1) name = POPs; |
3 |
0 |
3 |
|
| 573 |
|
| I32 j; |
| 574 |
3 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
3 |
3 |
|
| 575 |
3 |
| PUTBACK; |
| 576 |
|
| |
| 577 |
3 |
| name_c = SvPV(name, name_len); |
| 578 |
3 |
▶ | if (svp = hv_fetch(vars, name_c, name_len, FALSE)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp = hv_fetch(vars, name_c, name_len, FALSE)) { |
3 |
0 |
3 |
|
| 579 |
3 |
| SvGETMAGIC(*svp); |
| 580 |
3 |
| ref = *svp; |
| 581 |
|
| } |
| 582 |
|
| } |
| 583 |
|
| } |
| 584 |
|
| } |
| 585 |
|
| } |
| 586 |
|
| |
| 587 |
16419 |
| HV* seen_filters = (HV *)sv_2mortal((SV *)newHV()); |
| 588 |
|
| |
| 589 |
19005 |
▶ | while (sv_defined(ref)) { |
Branch: 2 branches
| Branch | True | False | Total |
| while (sv_defined(ref)) { |
19005 |
0 |
19005 |
| while (sv_defined(ref)) { |
18375 |
630 |
19005 |
|
| 590 |
|
| |
| 591 |
|
| /* check at each point if the rurned thing was a code */ |
| 592 |
18375 |
▶ | if (SvROK(ref) && SvTYPE(SvRV(ref)) == SVt_PVCV) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ref) && SvTYPE(SvRV(ref)) == SVt_PVCV) { |
3158 |
15217 |
18375 |
| if (SvROK(ref) && SvTYPE(SvRV(ref)) == SVt_PVCV) { |
366 |
2792 |
3158 |
|
| 593 |
|
| SV* type; |
| 594 |
366 |
▶ | if (return_ref && i >= var_len) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (return_ref && i >= var_len) { |
15 |
351 |
366 |
| if (return_ref && i >= var_len) { |
15 |
0 |
15 |
|
| 595 |
15 |
▶ | XPUSHs(SvREFCNT_inc(ref)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(SvREFCNT_inc(ref)); |
0 |
15 |
15 |
|
| 596 |
42 |
| XSRETURN(1); |
| 597 |
|
| } |
| 598 |
351 |
▶ | if (hv_exists(self, "CALL_CONTEXT", 12) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hv_exists(self, "CALL_CONTEXT", 12) |
336 |
15 |
351 |
|
| 599 |
336 |
▶ | && (svp = hv_fetch(self, "CALL_CONTEXT", 12, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch(self, "CALL_CONTEXT", 12, FALSE))) { |
336 |
0 |
336 |
|
| 600 |
336 |
| SvGETMAGIC(*svp); |
| 601 |
336 |
| type = (SV*)(*svp); |
| 602 |
|
| } |
| 603 |
351 |
▶ | if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
351 |
0 |
351 |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
6 |
345 |
351 |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
3 |
3 |
6 |
|
| 604 |
3 |
| ref = call_sv_with_args(ref, _self, args, G_SCALAR, Nullsv, CALL_CTX_ITEM); |
| 605 |
348 |
▶ | } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
Branch: 3 branches
| Branch | True | False | Total |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
348 |
0 |
348 |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
3 |
345 |
348 |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
3 |
0 |
3 |
|
| 606 |
3 |
| ref = call_sv_with_args(ref, _self, args, G_ARRAY, Nullsv, CALL_CTX_LIST); |
| 607 |
|
| } else { |
| 608 |
345 |
| ref = call_sv_with_args(ref, _self, args, G_ARRAY, Nullsv, CALL_CTX_SMART); |
| 609 |
|
| } |
| 610 |
348 |
▶ | if (! sv_defined(ref)) break; |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(ref)) break; |
348 |
0 |
348 |
| if (! sv_defined(ref)) break; |
348 |
0 |
348 |
|
| 611 |
|
| } |
| 612 |
|
| |
| 613 |
|
| |
| 614 |
|
| /* descend one chained level */ |
| 615 |
18357 |
▶ | if (i >= var_len) break; |
Branch: 1 branch
| Branch | True | False | Total |
| if (i >= var_len) break; |
15702 |
2655 |
18357 |
|
| 616 |
|
| |
| 617 |
2655 |
| bool was_dot_call = 0; |
| 618 |
2655 |
| svp = hv_fetch(Args, "no_dots", 7, FALSE); |
| 619 |
2655 |
▶ | if (svp) SvGETMAGIC(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) SvGETMAGIC(*svp); |
0 |
2655 |
2655 |
|
| 620 |
2655 |
▶ | if (svp && SvTRUE(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp && SvTRUE(*svp)) { |
0 |
2655 |
2655 |
| if (svp && SvTRUE(*svp)) { |
0 |
0 |
0 |
|
| 621 |
0 |
| was_dot_call = 1; |
| 622 |
|
| } else { |
| 623 |
2655 |
| svp = av_fetch(var, i++, FALSE); |
| 624 |
2655 |
| SvGETMAGIC(*svp); |
| 625 |
2655 |
| was_dot_call = sv_eq(*svp, sv_2mortal(newSVpv(".", 0))); |
| 626 |
|
| } |
| 627 |
|
| |
| 628 |
2655 |
| svp = av_fetch(var, i++, FALSE); |
| 629 |
2655 |
▶ | if (! svp) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (! svp) { |
0 |
2655 |
2655 |
|
| 630 |
0 |
| ref = &PL_sv_undef; |
| 631 |
0 |
| break; |
| 632 |
|
| } |
| 633 |
2655 |
| SvGETMAGIC(*svp); |
| 634 |
2655 |
| name = (SV*)(*svp); |
| 635 |
|
| STRLEN name_len; |
| 636 |
2655 |
| char* name_c = SvPV(name, name_len); |
| 637 |
|
| |
| 638 |
2655 |
| svp = av_fetch(var, i++, FALSE); |
| 639 |
2655 |
▶ | if (! svp) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (! svp) { |
0 |
2655 |
2655 |
|
| 640 |
0 |
| ref = &PL_sv_undef; |
| 641 |
0 |
| break; |
| 642 |
|
| } |
| 643 |
2655 |
| SvGETMAGIC(*svp); |
| 644 |
2655 |
▶ | args = (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) ? (AV*)SvRV(*svp) : (AV*)sv_2mortal((SV*)newAV()); |
Branch: 2 branches
| Branch | True | False | Total |
| args = (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) ? (AV*)SvRV(*svp) : (AV*)sv_2mortal((SV*)newAV()); |
543 |
2112 |
2655 |
| args = (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) ? (AV*)SvRV(*svp) : (AV*)sv_2mortal((SV*)newAV()); |
543 |
0 |
543 |
|
| 645 |
|
| |
| 646 |
|
| /* warn "play_expr: nested \"$name\"\n" if trace; */ |
| 647 |
|
| |
| 648 |
|
| /* allow for named portions of a variable name (foo.$name.bar) */ |
| 649 |
2655 |
▶ | if (SvROK(name)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(name)) { |
48 |
2607 |
2655 |
|
| 650 |
48 |
▶ | if (SvTYPE(SvRV(name)) == SVt_PVAV) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(SvRV(name)) == SVt_PVAV) { |
48 |
0 |
48 |
|
| 651 |
48 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
48 |
48 |
|
| 652 |
48 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
48 |
48 |
|
| 653 |
48 |
▶ | XPUSHs(name); /* we could check if name is an array - but we will let the recursive call hit */ |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(name); /* we could check if name is an array - but we will let the recursive call hit */ |
0 |
48 |
48 |
|
| 654 |
48 |
| PUTBACK; |
| 655 |
48 |
| n = call_method("play_expr", G_SCALAR); |
| 656 |
48 |
| SPAGAIN; |
| 657 |
48 |
| name = POPs; |
| 658 |
48 |
| name_c = SvPV(name, name_len); |
| 659 |
|
| I32 j; |
| 660 |
48 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
48 |
48 |
|
| 661 |
48 |
| PUTBACK; |
| 662 |
48 |
▶ | if (! sv_defined(name)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(name)) { |
48 |
0 |
48 |
| if (! sv_defined(name)) { |
0 |
48 |
48 |
|
| 663 |
0 |
| ref = &PL_sv_undef; |
| 664 |
0 |
| break; |
| 665 |
|
| } |
| 666 |
|
| } else { |
| 667 |
0 |
| (void)die("Shouldn't get a . ref($name) . during a vivify on chain"); |
| 668 |
|
| } |
| 669 |
|
| } |
| 670 |
2655 |
▶ | if (name_is_private(name_c)) { /* don't allow vars that begin with _ */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (name_is_private(name_c)) { /* don't allow vars that begin with _ */ |
3 |
2652 |
2655 |
|
| 671 |
3 |
| ref = &PL_sv_undef; |
| 672 |
3 |
| break; |
| 673 |
|
| } |
| 674 |
|
| |
| 675 |
|
| /* allow for scalar and filter access (this happens for every non virtual method call) */ |
| 676 |
2652 |
▶ | if (! SvROK(ref)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (! SvROK(ref)) { |
711 |
1941 |
2652 |
|
| 677 |
|
| SV* table; |
| 678 |
711 |
▶ | if ((table = get_sv("Template::Alloy::ITEM_METHODS", FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((table = get_sv("Template::Alloy::ITEM_METHODS", FALSE)) |
711 |
0 |
711 |
|
| 679 |
711 |
▶ | && SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| && SvROK(table) |
711 |
0 |
711 |
|
| 680 |
711 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
117 |
594 |
711 |
|
| 681 |
117 |
| SvGETMAGIC(*svp); |
| 682 |
117 |
| ref = call_sv_with_args(*svp, _self, args, G_SCALAR, ref, CALL_CTX_ITEM | CALL_CTX_PASS_SELF); |
| 683 |
|
| |
| 684 |
594 |
▶ | } else if ((table = get_sv("Template::Alloy::ITEM_OPS", FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| } else if ((table = get_sv("Template::Alloy::ITEM_OPS", FALSE)) |
594 |
0 |
594 |
|
| 685 |
594 |
▶ | && SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| && SvROK(table) |
594 |
0 |
594 |
|
| 686 |
594 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
546 |
48 |
594 |
|
| 687 |
546 |
| SvGETMAGIC(*svp); |
| 688 |
546 |
| ref = call_sv_with_args(*svp, _self, args, G_SCALAR, ref, CALL_CTX_ITEM); |
| 689 |
|
| |
| 690 |
48 |
▶ | } else if ((table = get_sv("Template::Alloy::LIST_OPS", FALSE)) /* auto-promote to list and use list op */ |
Branch: 1 branch
| Branch | True | False | Total |
| } else if ((table = get_sv("Template::Alloy::LIST_OPS", FALSE)) /* auto-promote to list and use list op */ |
48 |
0 |
48 |
|
| 691 |
48 |
▶ | && SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| && SvROK(table) |
48 |
0 |
48 |
|
| 692 |
57 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
9 |
39 |
48 |
|
| 693 |
9 |
| SvGETMAGIC(*svp); |
| 694 |
9 |
| AV* array = newAV(); |
| 695 |
9 |
| av_push(array, ref); |
| 696 |
9 |
| ref = call_sv_with_args(*svp, _self, args, G_SCALAR, newRV_noinc((SV*)array), CALL_CTX_SMART); |
| 697 |
|
| } else { |
| 698 |
39 |
| SV* filter = Nullsv; |
| 699 |
39 |
▶ | if(svp = hv_fetch(self, "FILTERS", 7, FALSE)) { /* filter configured in Template args */ |
Branch: 1 branch
| Branch | True | False | Total |
| if(svp = hv_fetch(self, "FILTERS", 7, FALSE)) { /* filter configured in Template args */ |
27 |
12 |
39 |
|
| 700 |
27 |
| SvGETMAGIC(*svp); |
| 701 |
27 |
| table = *svp; |
| 702 |
27 |
▶ | if (SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(table) |
27 |
0 |
27 |
|
| 703 |
27 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
27 |
0 |
27 |
|
| 704 |
27 |
| SvGETMAGIC(*svp); |
| 705 |
27 |
| filter = *svp; |
| 706 |
|
| } |
| 707 |
|
| } |
| 708 |
39 |
▶ | if (! sv_defined(filter) |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(filter) |
27 |
12 |
39 |
| if (! sv_defined(filter) |
0 |
27 |
27 |
|
| 709 |
12 |
▶ | && (table = get_sv("Template::Alloy::FILTER_OPS", FALSE)) /* predefined filters in CET */ |
Branch: 1 branch
| Branch | True | False | Total |
| && (table = get_sv("Template::Alloy::FILTER_OPS", FALSE)) /* predefined filters in CET */ |
12 |
0 |
12 |
|
| 710 |
12 |
▶ | && SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| && SvROK(table) |
12 |
0 |
12 |
|
| 711 |
12 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
0 |
12 |
12 |
|
| 712 |
0 |
| SvGETMAGIC(*svp); |
| 713 |
0 |
| filter = *svp; |
| 714 |
|
| } |
| 715 |
39 |
▶ | if (! sv_defined(filter) |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(filter) |
27 |
12 |
39 |
| if (! sv_defined(filter) |
0 |
27 |
27 |
|
| 716 |
12 |
▶ | && SvROK(name) /* looks like a filter sub passed in the stash */ |
Branch: 1 branch
| Branch | True | False | Total |
| && SvROK(name) /* looks like a filter sub passed in the stash */ |
6 |
6 |
12 |
|
| 717 |
6 |
▶ | && SvTYPE(SvRV(name)) == SVt_PVCV) { |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTYPE(SvRV(name)) == SVt_PVCV) { |
6 |
0 |
6 |
|
| 718 |
6 |
| filter = name; |
| 719 |
|
| } |
| 720 |
39 |
▶ | if (! sv_defined(filter)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(filter)) { |
33 |
6 |
39 |
| if (! sv_defined(filter)) { |
0 |
33 |
33 |
|
| 721 |
6 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
6 |
6 |
|
| 722 |
6 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
6 |
6 |
|
| 723 |
6 |
| PUTBACK; |
| 724 |
6 |
| n = call_method("list_filters", G_SCALAR); /* filter defined in Template::Filters */ |
| 725 |
6 |
| SPAGAIN; |
| 726 |
6 |
▶ | if (n==1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n==1) { |
6 |
0 |
6 |
|
| 727 |
6 |
| table = POPs; |
| 728 |
6 |
▶ | if (SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(table) |
6 |
0 |
6 |
|
| 729 |
6 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
0 |
6 |
6 |
|
| 730 |
0 |
| SvGETMAGIC(*svp); |
| 731 |
0 |
| filter = *svp; |
| 732 |
|
| } |
| 733 |
|
| } else { |
| 734 |
|
| I32 j; |
| 735 |
0 |
▶ | for (j = 0; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 0; j < n; j++) POPs; |
0 |
0 |
0 |
|
| 736 |
|
| } |
| 737 |
6 |
| PUTBACK; |
| 738 |
|
| } |
| 739 |
39 |
▶ | if (sv_defined(filter)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_defined(filter)) { |
33 |
6 |
39 |
| if (sv_defined(filter)) { |
33 |
0 |
33 |
|
| 740 |
33 |
▶ | if (SvROK(filter) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(filter) |
33 |
0 |
33 |
|
| 741 |
33 |
▶ | && SvTYPE(SvRV(filter)) == SVt_PVCV) { /* non-dynamic filter - no args */ |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTYPE(SvRV(filter)) == SVt_PVCV) { /* non-dynamic filter - no args */ |
9 |
24 |
33 |
|
| 742 |
9 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
9 |
9 |
|
| 743 |
9 |
▶ | XPUSHs(ref); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(ref); |
0 |
9 |
9 |
|
| 744 |
9 |
| PUTBACK; |
| 745 |
9 |
| n = call_sv(filter, G_SCALAR | G_EVAL); |
| 746 |
9 |
| SPAGAIN; |
| 747 |
9 |
▶ | if (n == 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n == 1) { |
9 |
0 |
9 |
|
| 748 |
9 |
| ref = POPs; |
| 749 |
|
| } else { |
| 750 |
|
| I32 j; |
| 751 |
0 |
▶ | for (j = 0; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 0; j < n; j++) POPs; |
0 |
0 |
0 |
|
| 752 |
|
| } |
| 753 |
9 |
| PUTBACK; |
| 754 |
9 |
▶ | if (SvTRUE(ERRSV)) xs_throw(_self, "filter", ERRSV); |
Branch: 3 branches
| Branch | True | False | Total |
| if (SvTRUE(ERRSV)) xs_throw(_self, "filter", ERRSV); |
9 |
0 |
9 |
| if (SvTRUE(ERRSV)) xs_throw(_self, "filter", ERRSV); |
0 |
9 |
9 |
| if (SvTRUE(ERRSV)) xs_throw(_self, "filter", ERRSV); |
0 |
0 |
0 |
|
| 755 |
24 |
▶ | } else if (! SvROK(filter) || SvTYPE(SvRV(filter)) != SVt_PVAV) { /* invalid filter */ |
Branch: 2 branches
| Branch | True | False | Total |
| } else if (! SvROK(filter) || SvTYPE(SvRV(filter)) != SVt_PVAV) { /* invalid filter */ |
24 |
0 |
24 |
| } else if (! SvROK(filter) || SvTYPE(SvRV(filter)) != SVt_PVAV) { /* invalid filter */ |
0 |
24 |
24 |
|
| 756 |
0 |
| SV* msg = newSVpv("invalid FILTER entry for '", 0); |
| 757 |
0 |
| sv_catsv(msg, name); |
| 758 |
0 |
| sv_catpv(msg, "' (not a CODE ref)"); |
| 759 |
0 |
| xs_throw(_self, "filter", msg); |
| 760 |
|
| } else { |
| 761 |
24 |
| AV* fa = (AV*)SvRV(filter); |
| 762 |
24 |
| svp = av_fetch(fa, 0, FALSE); |
| 763 |
24 |
▶ | if (svp) SvGETMAGIC(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) SvGETMAGIC(*svp); |
24 |
0 |
24 |
|
| 764 |
24 |
▶ | if (av_len(fa) == 1 |
Branch: 1 branch
| Branch | True | False | Total |
| if (av_len(fa) == 1 |
24 |
0 |
24 |
|
| 765 |
24 |
▶ | && svp |
Branch: 1 branch
| Branch | True | False | Total |
| && svp |
24 |
0 |
24 |
|
| 766 |
24 |
▶ | && SvROK(*svp) |
Branch: 1 branch
| Branch | True | False | Total |
| && SvROK(*svp) |
6 |
18 |
24 |
|
| 767 |
12 |
▶ | && SvTYPE(SvRV(*svp)) == SVt_PVCV) { /* these are the TT style filters */ |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTYPE(SvRV(*svp)) == SVt_PVCV) { /* these are the TT style filters */ |
6 |
0 |
6 |
|
| 768 |
6 |
| SV* coderef = *svp; |
| 769 |
6 |
| svp = av_fetch(fa, 1, FALSE); |
| 770 |
6 |
▶ | if (svp) SvGETMAGIC(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) SvGETMAGIC(*svp); |
6 |
0 |
6 |
|
| 771 |
6 |
▶ | if (svp && SvTRUE(*svp)) { /* it is a "dynamic filter" that will return a sub */ |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp && SvTRUE(*svp)) { /* it is a "dynamic filter" that will return a sub */ |
6 |
0 |
6 |
| if (svp && SvTRUE(*svp)) { /* it is a "dynamic filter" that will return a sub */ |
3 |
3 |
6 |
|
| 772 |
|
| I32 j; |
| 773 |
3 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
3 |
3 |
|
| 774 |
3 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
3 |
3 |
|
| 775 |
3 |
| PUTBACK; |
| 776 |
3 |
| n = call_method("context", G_SCALAR); |
| 777 |
3 |
| SPAGAIN; |
| 778 |
3 |
▶ | SV* context = (n == 1) ? POPs : Nullsv; |
Branch: 1 branch
| Branch | True | False | Total |
| SV* context = (n == 1) ? POPs : Nullsv; |
3 |
0 |
3 |
|
| 779 |
3 |
▶ | if (n > 1) for (j = 1; j < n; j++) POPs; |
Branch: 2 branches
| Branch | True | False | Total |
| if (n > 1) for (j = 1; j < n; j++) POPs; |
0 |
3 |
3 |
| if (n > 1) for (j = 1; j < n; j++) POPs; |
0 |
0 |
0 |
|
| 780 |
3 |
| PUTBACK; |
| 781 |
|
| |
| 782 |
3 |
| I32 count = av_len(args); |
| 783 |
3 |
| AV* _args = newAV(); |
| 784 |
3 |
| av_extend(_args, count - 1); |
| 785 |
6 |
▶ | for (j = 0; j <= count; j++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 0; j <= count; j++) { |
3 |
3 |
6 |
|
| 786 |
3 |
| svp = av_fetch(args, j, FALSE); |
| 787 |
3 |
▶ | if (svp) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) { |
3 |
0 |
3 |
|
| 788 |
3 |
| SvGETMAGIC(*svp); |
| 789 |
3 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
3 |
3 |
|
| 790 |
3 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
3 |
3 |
|
| 791 |
3 |
▶ | XPUSHs(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(*svp); |
0 |
3 |
3 |
|
| 792 |
3 |
| PUTBACK; |
| 793 |
3 |
| n = call_method("play_expr", G_SCALAR); |
| 794 |
3 |
| SPAGAIN; |
| 795 |
3 |
| av_store(_args, j, (SV*)POPs); |
| 796 |
3 |
▶ | if (n > 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n > 1) { |
0 |
3 |
3 |
|
| 797 |
|
| I32 k; |
| 798 |
0 |
▶ | for (k = 1; k < n; k++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (k = 1; k < n; k++) POPs; |
0 |
0 |
0 |
|
| 799 |
|
| } |
| 800 |
3 |
| PUTBACK; |
| 801 |
|
| } else { |
| 802 |
0 |
| av_store(_args, j, &PL_sv_undef); |
| 803 |
|
| } |
| 804 |
|
| } |
| 805 |
3 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
3 |
3 |
|
| 806 |
3 |
▶ | XPUSHs(context); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(context); |
0 |
3 |
3 |
|
| 807 |
6 |
▶ | for (j = 0; j <= av_len(_args); j++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 0; j <= av_len(_args); j++) { |
3 |
3 |
6 |
|
| 808 |
3 |
| svp = av_fetch(_args, j, FALSE); |
| 809 |
3 |
▶ | if (svp) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) { |
3 |
0 |
3 |
|
| 810 |
3 |
| SvGETMAGIC(*svp); |
| 811 |
3 |
▶ | XPUSHs(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(*svp); |
0 |
3 |
3 |
|
| 812 |
|
| } else { |
| 813 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 814 |
|
| } |
| 815 |
|
| } |
| 816 |
3 |
| PUTBACK; |
| 817 |
3 |
| n = call_sv(coderef, G_ARRAY); |
| 818 |
3 |
| SPAGAIN; |
| 819 |
3 |
▶ | if (SvTRUE(ERRSV)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvTRUE(ERRSV)) { |
3 |
0 |
3 |
| if (SvTRUE(ERRSV)) { |
0 |
3 |
3 |
|
| 820 |
0 |
| PUTBACK; |
| 821 |
0 |
▶ | xs_throw(_self, "filter", ERRSV); |
Branch: 1 branch
| Branch | True | False | Total |
| xs_throw(_self, "filter", ERRSV); |
0 |
0 |
0 |
|
| 822 |
3 |
▶ | } else if (n >= 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (n >= 1) { |
3 |
0 |
3 |
|
| 823 |
3 |
| coderef = POPs; |
| 824 |
3 |
▶ | SV* err = (n >= 2) ? POPs : Nullsv; |
Branch: 1 branch
| Branch | True | False | Total |
| SV* err = (n >= 2) ? POPs : Nullsv; |
0 |
3 |
3 |
|
| 825 |
|
| I32 j; |
| 826 |
3 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
3 |
3 |
|
| 827 |
3 |
| PUTBACK; |
| 828 |
3 |
▶ | if (! SvTRUE(coderef) && SvTRUE(err)) xs_throw(_self, "filter", err); |
Branch: 2 branches
| Branch | True | False | Total |
| if (! SvTRUE(coderef) && SvTRUE(err)) xs_throw(_self, "filter", err); |
0 |
3 |
3 |
| if (! SvTRUE(coderef) && SvTRUE(err)) xs_throw(_self, "filter", err); |
0 |
0 |
0 |
|
| 829 |
3 |
▶ | if (! SvROK(coderef) || SvTYPE(SvRV(coderef)) != SVt_PVCV) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! SvROK(coderef) || SvTYPE(SvRV(coderef)) != SVt_PVCV) { |
3 |
0 |
3 |
| if (! SvROK(coderef) || SvTYPE(SvRV(coderef)) != SVt_PVCV) { |
0 |
3 |
3 |
|
| 830 |
0 |
▶ | if (sv_isobject(coderef) |
Branch: 1 branch
| Branch | True | False | Total |
| if (sv_isobject(coderef) |
0 |
0 |
0 |
|
| 831 |
0 |
▶ | && (sv_derived_from(coderef, "Template::Alloy::Exception") |
Branch: 1 branch
| Branch | True | False | Total |
| && (sv_derived_from(coderef, "Template::Alloy::Exception") |
0 |
0 |
0 |
|
| 832 |
0 |
▶ | || sv_derived_from(coderef, "Template::Exception"))) { |
Branch: 1 branch
| Branch | True | False | Total |
| || sv_derived_from(coderef, "Template::Exception"))) { |
0 |
0 |
0 |
|
| 833 |
0 |
| xs_throw(_self, "filter", coderef); |
| 834 |
|
| } |
| 835 |
0 |
| SV* msg = newSVpv("invalid FILTER entry for '", 0); |
| 836 |
0 |
| sv_catsv(msg, name); |
| 837 |
0 |
| sv_catpv(msg, "' (not a CODE ref) (2)"); |
| 838 |
0 |
| xs_throw(_self, "filter", msg); |
| 839 |
|
| } |
| 840 |
|
| } else { |
| 841 |
0 |
| PUTBACK; |
| 842 |
0 |
| SV* msg = newSVpv("invalid FILTER entry for '", 0); |
| 843 |
0 |
| sv_catsv(msg, name); |
| 844 |
0 |
| sv_catpv(msg, "' (not a CODE ref) (3)"); |
| 845 |
0 |
| xs_throw(_self, "filter", msg); |
| 846 |
|
| } |
| 847 |
|
| } |
| 848 |
|
| /* at this point - coderef should be a coderef */ |
| 849 |
6 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
6 |
6 |
|
| 850 |
6 |
▶ | XPUSHs(ref); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(ref); |
0 |
6 |
6 |
|
| 851 |
6 |
| PUTBACK; |
| 852 |
6 |
| n = call_sv(coderef, G_EVAL | G_SCALAR); |
| 853 |
6 |
| SPAGAIN; |
| 854 |
6 |
▶ | ref = (n >= 1) ? POPs : &PL_sv_undef; |
Branch: 1 branch
| Branch | True | False | Total |
| ref = (n >= 1) ? POPs : &PL_sv_undef; |
6 |
0 |
6 |
|
| 855 |
|
| I32 j; |
| 856 |
6 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
6 |
6 |
|
| 857 |
6 |
| PUTBACK; |
| 858 |
6 |
▶ | if (SvTRUE(ERRSV)) xs_throw(_self, "filter", ERRSV); |
Branch: 3 branches
| Branch | True | False | Total |
| if (SvTRUE(ERRSV)) xs_throw(_self, "filter", ERRSV); |
6 |
0 |
6 |
| if (SvTRUE(ERRSV)) xs_throw(_self, "filter", ERRSV); |
0 |
6 |
6 |
| if (SvTRUE(ERRSV)) xs_throw(_self, "filter", ERRSV); |
0 |
0 |
0 |
|
| 859 |
|
| |
| 860 |
|
| } else { /* this looks like our vmethods turned into "filters" (a filter stored under a name) */ |
| 861 |
18 |
| svp = hv_fetch(seen_filters, name_c, name_len, FALSE); |
| 862 |
18 |
▶ | if (svp && SvTRUE(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp && SvTRUE(*svp)) { |
0 |
18 |
18 |
| if (svp && SvTRUE(*svp)) { |
0 |
0 |
0 |
|
| 863 |
0 |
| SV* msg = newSVpv("Recursive filter alias \"", 0); |
| 864 |
0 |
| sv_catsv(msg, name); |
| 865 |
0 |
| sv_catpv(msg, "\")"); |
| 866 |
0 |
| xs_throw(_self, "filter", msg); |
| 867 |
|
| } |
| 868 |
18 |
| hv_store(seen_filters, name_c, name_len, newSViv(1), 0); |
| 869 |
18 |
| AV* newvar = newAV(); |
| 870 |
18 |
| av_push(newvar, name); |
| 871 |
18 |
| av_push(newvar, newSViv(0)); |
| 872 |
18 |
| av_push(newvar, newSVpv("|", 1)); |
| 873 |
|
| I32 j; |
| 874 |
|
| /* BUGS/TODO - there is a memory leak right here - the newvar doesn't seem to get released */ |
| 875 |
54 |
▶ | for (j = 0; j <= av_len(fa); j++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 0; j <= av_len(fa); j++) { |
36 |
18 |
54 |
|
| 876 |
36 |
| svp = av_fetch(fa, j, FALSE); |
| 877 |
36 |
▶ | if (svp) SvGETMAGIC(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) SvGETMAGIC(*svp); |
36 |
0 |
36 |
|
| 878 |
36 |
▶ | av_push(newvar, svp ? *svp : &PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| av_push(newvar, svp ? *svp : &PL_sv_undef); |
36 |
0 |
36 |
|
| 879 |
|
| } |
| 880 |
36 |
▶ | for (j = i; j <= av_len(var); j++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = i; j <= av_len(var); j++) { |
18 |
18 |
36 |
|
| 881 |
18 |
| svp = av_fetch(var, j, FALSE); |
| 882 |
18 |
▶ | if (svp) SvGETMAGIC(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) SvGETMAGIC(*svp); |
18 |
0 |
18 |
|
| 883 |
18 |
▶ | av_push(newvar, svp ? *svp : &PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| av_push(newvar, svp ? *svp : &PL_sv_undef); |
18 |
0 |
18 |
|
| 884 |
|
| } |
| 885 |
18 |
| var = newvar; |
| 886 |
18 |
| var_len = av_len(var); |
| 887 |
18 |
| i = 2; |
| 888 |
|
| } |
| 889 |
24 |
| svp = av_fetch(var, i - 5, FALSE); |
| 890 |
24 |
▶ | if (svp && SvTRUE(*svp)) { /* looks like its cyclic - without a coderef in sight */ |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp && SvTRUE(*svp)) { /* looks like its cyclic - without a coderef in sight */ |
24 |
0 |
24 |
| if (svp && SvTRUE(*svp)) { /* looks like its cyclic - without a coderef in sight */ |
24 |
0 |
24 |
|
| 891 |
24 |
| SV* _name = *svp; |
| 892 |
|
| STRLEN _name_len; |
| 893 |
24 |
| char* _name_c = SvPV(_name, _name_len); |
| 894 |
24 |
| svp = hv_fetch(seen_filters, _name_c, _name_len, FALSE); |
| 895 |
24 |
▶ | if (svp && SvTRUE(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp && SvTRUE(*svp)) { |
0 |
24 |
24 |
| if (svp && SvTRUE(*svp)) { |
0 |
0 |
0 |
|
| 896 |
0 |
| SV* msg = newSVpv("invalid FILTER entry for '", 0); |
| 897 |
0 |
| sv_catsv(msg, _name); |
| 898 |
0 |
| sv_catpv(msg, "' (not a CODE ref) (4)"); |
| 899 |
0 |
| xs_throw(_self, "filter", msg); |
| 900 |
|
| } |
| 901 |
|
| } |
| 902 |
|
| } |
| 903 |
|
| } else { |
| 904 |
6 |
| ref = &PL_sv_undef; |
| 905 |
|
| } |
| 906 |
|
| } |
| 907 |
|
| |
| 908 |
|
| } else { |
| 909 |
|
| |
| 910 |
|
| /* method calls on objects */ |
| 911 |
1941 |
▶ | if (was_dot_call && sv_isobject(ref)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (was_dot_call && sv_isobject(ref)) { |
1929 |
12 |
1941 |
| if (was_dot_call && sv_isobject(ref)) { |
555 |
1374 |
1929 |
|
| 912 |
|
| SV* type; |
| 913 |
555 |
▶ | if (return_ref && i >= var_len) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (return_ref && i >= var_len) { |
0 |
555 |
555 |
| if (return_ref && i >= var_len) { |
0 |
0 |
0 |
|
| 914 |
0 |
▶ | XPUSHs(SvREFCNT_inc(ref)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(SvREFCNT_inc(ref)); |
0 |
0 |
0 |
|
| 915 |
0 |
| XSRETURN(1); |
| 916 |
|
| } |
| 917 |
555 |
▶ | if (hv_exists(self, "CALL_CONTEXT", 12) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hv_exists(self, "CALL_CONTEXT", 12) |
555 |
0 |
555 |
|
| 918 |
555 |
▶ | && (svp = hv_fetch(self, "CALL_CONTEXT", 12, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch(self, "CALL_CONTEXT", 12, FALSE))) { |
555 |
0 |
555 |
|
| 919 |
555 |
| SvGETMAGIC(*svp); |
| 920 |
555 |
| type = (SV*)(*svp); |
| 921 |
|
| } |
| 922 |
|
| |
| 923 |
555 |
| HV* stash = SvSTASH((SV*)SvRV(ref)); |
| 924 |
555 |
| GV* gv = gv_fetchmethod_autoload(stash, name_c, 1); |
| 925 |
555 |
▶ | if (! gv && sv_defined(type) |
Branch: 3 branches
| Branch | True | False | Total |
| if (! gv && sv_defined(type) |
18 |
537 |
555 |
| if (! gv && sv_defined(type) |
18 |
0 |
18 |
| if (! gv && sv_defined(type) |
6 |
12 |
18 |
|
| 926 |
6 |
▶ | && (sv_eq(type, sv_2mortal(newSVpv("item", 0))) || sv_eq(type, sv_2mortal(newSVpv("list", 0))))) { |
Branch: 2 branches
| Branch | True | False | Total |
| && (sv_eq(type, sv_2mortal(newSVpv("item", 0))) || sv_eq(type, sv_2mortal(newSVpv("list", 0))))) { |
3 |
3 |
6 |
| && (sv_eq(type, sv_2mortal(newSVpv("item", 0))) || sv_eq(type, sv_2mortal(newSVpv("list", 0))))) { |
3 |
0 |
3 |
|
| 927 |
6 |
| char* package = (char*)sv_reftype(SvRV(ref), 1); |
| 928 |
6 |
| croak("Can't locate object method \"%s\" via package %s", name_c, package); |
| 929 |
|
| } |
| 930 |
|
| |
| 931 |
549 |
▶ | if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
549 |
0 |
549 |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
63 |
486 |
549 |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
30 |
33 |
63 |
|
| 932 |
30 |
| ref = call_sv_with_args((SV*)GvCV(gv), _self, args, G_SCALAR, ref, CALL_CTX_ITEM); |
| 933 |
30 |
▶ | if (! sv_defined(ref)) break; |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(ref)) break; |
30 |
0 |
30 |
| if (! sv_defined(ref)) break; |
30 |
0 |
30 |
|
| 934 |
537 |
| continue; |
| 935 |
519 |
▶ | } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
Branch: 3 branches
| Branch | True | False | Total |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
519 |
0 |
519 |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
33 |
486 |
519 |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
24 |
9 |
33 |
|
| 936 |
24 |
| ref = call_sv_with_args((SV*)GvCV(gv), _self, args, G_ARRAY, ref, CALL_CTX_LIST); |
| 937 |
24 |
▶ | if (! sv_defined(ref)) break; |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(ref)) break; |
24 |
0 |
24 |
| if (! sv_defined(ref)) break; |
24 |
0 |
24 |
|
| 938 |
24 |
| continue; |
| 939 |
495 |
▶ | } else if (gv) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (gv) { |
483 |
12 |
495 |
|
| 940 |
483 |
| SV* newref = call_sv_with_args((SV*)GvCV(gv), _self, args, G_ARRAY | G_EVAL, ref, CALL_CTX_SMART); |
| 941 |
483 |
▶ | if (!SvTRUE(ERRSV)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvTRUE(ERRSV)) { |
483 |
0 |
483 |
| if (!SvTRUE(ERRSV)) { |
483 |
0 |
483 |
|
| 942 |
483 |
| ref = newref; |
| 943 |
483 |
▶ | if (! sv_defined(ref)) break; |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(ref)) break; |
483 |
0 |
483 |
| if (! sv_defined(ref)) break; |
483 |
0 |
483 |
|
| 944 |
483 |
| continue; |
| 945 |
|
| } |
| 946 |
0 |
| SV* errsv = get_sv("@", 0); |
| 947 |
0 |
▶ | if (SvROK(errsv)) (void)die(Nullch); /* rethrow */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(errsv)) (void)die(Nullch); /* rethrow */ |
0 |
0 |
0 |
|
| 948 |
0 |
| SV* msg = sv_2mortal(newSVpv("Can't locate object method \"", 0)); |
| 949 |
0 |
| sv_catpv(msg, name_c); |
| 950 |
0 |
| sv_catpv(msg, "\" via package \""); |
| 951 |
0 |
| sv_catpv(msg, (char*)sv_reftype(SvRV(ref), 1)); |
| 952 |
0 |
| sv_catpv(msg, "\""); |
| 953 |
|
| /* |
| 954 |
|
| char* package = (char*)sv_reftype(SvRV(ref), 1); |
| 955 |
|
| croak("Can't locate object method \"%s\" via package %s", name_c, package); |
| 956 |
|
| die $@ if $@ !~ /Can\'t locate object method "\Q$name\E" via package "\Q$class\E"/; |
| 957 |
|
| */ |
| 958 |
|
| /* now fail down to normal lookup */ |
| 959 |
|
| } |
| 960 |
|
| } |
| 961 |
|
| |
| 962 |
|
| /* hash member access */ |
| 963 |
1398 |
▶ | if (SvTYPE(SvRV(ref)) == SVt_PVHV) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(SvRV(ref)) == SVt_PVHV) { |
816 |
582 |
1398 |
|
| 964 |
816 |
| HV* ref_hv = (HV*)SvRV(ref); |
| 965 |
816 |
▶ | if (was_dot_call |
Branch: 1 branch
| Branch | True | False | Total |
| if (was_dot_call |
810 |
6 |
816 |
|
| 966 |
810 |
▶ | && hv_exists(ref_hv, name_c, name_len) |
Branch: 1 branch
| Branch | True | False | Total |
| && hv_exists(ref_hv, name_c, name_len) |
528 |
282 |
810 |
|
| 967 |
528 |
▶ | && (svp = hv_fetch(ref_hv, name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch(ref_hv, name_c, name_len, FALSE))) { |
528 |
0 |
528 |
|
| 968 |
528 |
| SvGETMAGIC(*svp); |
| 969 |
528 |
| ref = (SV*)(*svp); |
| 970 |
528 |
▶ | if (return_ref && i >= var_len && ! SvROK(ref)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
12 |
516 |
528 |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
12 |
0 |
12 |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
12 |
0 |
12 |
|
| 971 |
12 |
▶ | XPUSHs(newRV_inc(ref)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(newRV_inc(ref)); |
0 |
12 |
12 |
|
| 972 |
12 |
| XSRETURN(1); |
| 973 |
|
| } |
| 974 |
|
| } else { |
| 975 |
288 |
| SV* table = get_sv("Template::Alloy::HASH_OPS", TRUE); |
| 976 |
288 |
▶ | if (SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(table) |
288 |
0 |
288 |
|
| 977 |
288 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
159 |
129 |
288 |
|
| 978 |
159 |
| SvGETMAGIC(*svp); |
| 979 |
159 |
| ref = call_sv_with_args(*svp, _self, args, G_SCALAR, ref, CALL_CTX_SMART); |
| 980 |
129 |
▶ | } else if ((svp = hv_fetch(Args, "is_namespace_during_compile", 27, FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| } else if ((svp = hv_fetch(Args, "is_namespace_during_compile", 27, FALSE)) |
6 |
123 |
129 |
|
| 981 |
6 |
▶ | && SvTRUE(*svp)) { |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTRUE(*svp)) { |
6 |
0 |
6 |
|
| 982 |
6 |
▶ | XPUSHs(_var); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_var); |
0 |
6 |
6 |
|
| 983 |
6 |
| XSRETURN(1); |
| 984 |
|
| } else { |
| 985 |
123 |
▶ | if (return_ref && i >= var_len) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (return_ref && i >= var_len) { |
3 |
120 |
123 |
| if (return_ref && i >= var_len) { |
3 |
0 |
3 |
|
| 986 |
3 |
| hv_store(ref_hv, name_c, name_len, sv_newmortal(), 0); |
| 987 |
|
| |
| 988 |
3 |
| svp = hv_fetch(ref_hv, name_c, name_len, FALSE); |
| 989 |
3 |
| SvGETMAGIC(*svp); |
| 990 |
3 |
| ref = (SV*)(*svp); |
| 991 |
|
| |
| 992 |
3 |
▶ | XPUSHs(newRV_inc(ref)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(newRV_inc(ref)); |
0 |
3 |
3 |
|
| 993 |
3 |
| XSRETURN(1); |
| 994 |
|
| } |
| 995 |
120 |
| ref = &PL_sv_undef; |
| 996 |
|
| } |
| 997 |
|
| } |
| 998 |
|
| |
| 999 |
|
| /* array access */ |
| 1000 |
582 |
▶ | } else if (SvTYPE(SvRV(ref)) == SVt_PVAV) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (SvTYPE(SvRV(ref)) == SVt_PVAV) { |
582 |
0 |
582 |
|
| 1001 |
|
| UV name_uv; |
| 1002 |
|
| int res; |
| 1003 |
582 |
▶ | if ((res = grok_number(name_c, name_len, &name_uv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((res = grok_number(name_c, name_len, &name_uv)) |
150 |
432 |
582 |
|
| 1004 |
294 |
▶ | && res & IS_NUMBER_IN_UV) { /* $name =~ m{ ^ -? $QR_NUM $ }ox) { */ |
Branch: 1 branch
| Branch | True | False | Total |
| && res & IS_NUMBER_IN_UV) { /* $name =~ m{ ^ -? $QR_NUM $ }ox) { */ |
150 |
0 |
150 |
|
| 1005 |
150 |
| AV* ref_av = (AV*)SvRV(ref); |
| 1006 |
150 |
| I32 index = (int)SvNV(name); |
| 1007 |
150 |
▶ | if (svp = av_fetch(ref_av, index, FALSE)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp = av_fetch(ref_av, index, FALSE)) { |
129 |
21 |
150 |
|
| 1008 |
129 |
| SvGETMAGIC(*svp); |
| 1009 |
129 |
| ref = (SV*)(*svp); |
| 1010 |
129 |
▶ | if (return_ref && i >= var_len && ! SvROK(ref)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
3 |
126 |
129 |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
3 |
0 |
3 |
| if (return_ref && i >= var_len && ! SvROK(ref)) { |
3 |
0 |
3 |
|
| 1011 |
3 |
▶ | XPUSHs(newRV_inc(ref)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(newRV_inc(ref)); |
0 |
3 |
3 |
|
| 1012 |
6 |
| XSRETURN(1); |
| 1013 |
|
| } |
| 1014 |
|
| } else { |
| 1015 |
21 |
▶ | if (return_ref && i >= var_len) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (return_ref && i >= var_len) { |
3 |
18 |
21 |
| if (return_ref && i >= var_len) { |
3 |
0 |
3 |
|
| 1016 |
3 |
▶ | if (av_len(ref_av) < index) av_extend(ref_av, index); |
Branch: 1 branch
| Branch | True | False | Total |
| if (av_len(ref_av) < index) av_extend(ref_av, index); |
3 |
0 |
3 |
|
| 1017 |
3 |
| av_store(ref_av, index, sv_newmortal()); |
| 1018 |
|
| |
| 1019 |
3 |
| svp = av_fetch(ref_av, index, FALSE); |
| 1020 |
3 |
| SvGETMAGIC(*svp); |
| 1021 |
3 |
| ref = (SV*)(*svp); |
| 1022 |
|
| |
| 1023 |
3 |
▶ | XPUSHs(newRV_inc(ref)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(newRV_inc(ref)); |
0 |
3 |
3 |
|
| 1024 |
3 |
| XSRETURN(1); |
| 1025 |
|
| } |
| 1026 |
18 |
| ref = &PL_sv_undef; |
| 1027 |
|
| } |
| 1028 |
|
| } else { |
| 1029 |
432 |
| SV* table = get_sv("Template::Alloy::LIST_OPS", TRUE); |
| 1030 |
432 |
▶ | if (SvROK(table) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(table) |
432 |
0 |
432 |
|
| 1031 |
432 |
▶ | && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch((HV*)SvRV(table), name_c, name_len, FALSE))) { |
432 |
0 |
432 |
|
| 1032 |
432 |
| SvGETMAGIC(*svp); |
| 1033 |
432 |
| ref = call_sv_with_args(*svp, _self, args, G_SCALAR, ref, CALL_CTX_SMART); |
| 1034 |
|
| } else { |
| 1035 |
0 |
| ref = &PL_sv_undef; |
| 1036 |
|
| } |
| 1037 |
|
| } |
| 1038 |
|
| } |
| 1039 |
|
| } |
| 1040 |
|
| |
| 1041 |
|
| } /* end of while */ |
| 1042 |
|
| |
| 1043 |
|
| /* allow for undefinedness */ |
| 1044 |
16335 |
▶ | if (! sv_defined(ref)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(ref)) { |
16335 |
0 |
16335 |
| if (! sv_defined(ref)) { |
633 |
15702 |
16335 |
|
| 1045 |
633 |
| svp = hv_fetch(self, "STRICT", 6, FALSE); |
| 1046 |
633 |
▶ | if (svp && SvTRUE(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp && SvTRUE(*svp)) { |
633 |
0 |
633 |
| if (svp && SvTRUE(*svp)) { |
27 |
606 |
633 |
|
| 1047 |
27 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
27 |
27 |
|
| 1048 |
27 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
27 |
27 |
|
| 1049 |
27 |
▶ | XPUSHs(_var); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_var); |
0 |
27 |
27 |
|
| 1050 |
27 |
| PUTBACK; |
| 1051 |
27 |
| n = call_method("strict_throw", G_VOID); /* will die */ |
| 1052 |
3 |
| SPAGAIN; |
| 1053 |
|
| I32 j; |
| 1054 |
3 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
3 |
3 |
|
| 1055 |
3 |
| PUTBACK; |
| 1056 |
|
| } |
| 1057 |
|
| |
| 1058 |
609 |
| svp = hv_fetch(self, "_debug_undef", 12, FALSE); |
| 1059 |
609 |
▶ | if (svp && SvTRUE(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp && SvTRUE(*svp)) { |
6 |
603 |
609 |
| if (svp && SvTRUE(*svp)) { |
6 |
0 |
6 |
|
| 1060 |
6 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
6 |
6 |
|
| 1061 |
6 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
6 |
6 |
|
| 1062 |
6 |
▶ | XPUSHs(_var); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_var); |
0 |
6 |
6 |
|
| 1063 |
6 |
| PUTBACK; |
| 1064 |
6 |
| n = call_method("tt_var_string", G_SCALAR); |
| 1065 |
6 |
| SPAGAIN; |
| 1066 |
6 |
▶ | SV* varname = (n >= 1) ? (SV*)POPs : sv_2mortal(newSVpv("UNKNOWN", 0)); |
Branch: 1 branch
| Branch | True | False | Total |
| SV* varname = (n >= 1) ? (SV*)POPs : sv_2mortal(newSVpv("UNKNOWN", 0)); |
6 |
0 |
6 |
|
| 1067 |
|
| I32 j; |
| 1068 |
6 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
6 |
6 |
|
| 1069 |
6 |
| PUTBACK; |
| 1070 |
|
| |
| 1071 |
6 |
| SV* msg = sv_2mortal(newSVpv("", 0)); |
| 1072 |
6 |
| sv_catsv(msg, (SV*)varname); |
| 1073 |
6 |
| sv_catpv(msg, " is undefined\n"); |
| 1074 |
6 |
| SV* errsv = get_sv("@", GV_ADD); |
| 1075 |
6 |
| sv_setsv(errsv, msg); |
| 1076 |
6 |
| (void)die(Nullch); |
| 1077 |
|
| } else { |
| 1078 |
|
| /* BUGS/TODO */ |
| 1079 |
|
| /* $ref = $self->undefined_any($var); */ |
| 1080 |
|
| } |
| 1081 |
|
| } |
| 1082 |
|
| |
| 1083 |
16305 |
▶ | XPUSHs(ref); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(ref); |
0 |
16305 |
16305 |
|
| 1084 |
16305 |
| XSRETURN(1); |
| 1085 |
|
| |
| 1086 |
|
| |
| 1087 |
|
| static int |
| 1088 |
|
| play_tree_xs (_self, _tree, _out_ref) |
| 1089 |
|
| SV* _self; |
| 1090 |
|
| SV* _tree; |
| 1091 |
|
| SV* _out_ref; |
| 1092 |
|
| PPCODE: |
| 1093 |
3020 |
▶ | if (SvROK(_self) && SvROK(_tree) && SvROK(_out_ref)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (SvROK(_self) && SvROK(_tree) && SvROK(_out_ref)) { |
3020 |
0 |
3020 |
| if (SvROK(_self) && SvROK(_tree) && SvROK(_out_ref)) { |
3020 |
0 |
3020 |
| if (SvROK(_self) && SvROK(_tree) && SvROK(_out_ref)) { |
3020 |
0 |
3020 |
|
| 1094 |
3020 |
| HV* self = (HV*)SvRV(_self); |
| 1095 |
3020 |
| AV* tree = (AV*)SvRV(_tree); |
| 1096 |
3020 |
| SV* out_ref = (SV*)SvRV(_out_ref); |
| 1097 |
3020 |
| SV* _table = get_sv("Template::Alloy::Play::DIRECTIVES", FALSE); |
| 1098 |
3020 |
▶ | if (! SvROK(_table) || SvTYPE(SvRV(_table)) != SVt_PVHV) (void)die("Missing table"); |
Branch: 2 branches
| Branch | True | False | Total |
| if (! SvROK(_table) || SvTYPE(SvRV(_table)) != SVt_PVHV) (void)die("Missing table"); |
3020 |
0 |
3020 |
| if (! SvROK(_table) || SvTYPE(SvRV(_table)) != SVt_PVHV) (void)die("Missing table"); |
0 |
3020 |
3020 |
|
| 1099 |
3020 |
| HV* table = (HV*)SvRV(_table); |
| 1100 |
3020 |
| I32 len = av_len(tree) + 1; |
| 1101 |
|
| |
| 1102 |
|
| SV** svp; |
| 1103 |
|
| I32 i; |
| 1104 |
|
| I32 n; |
| 1105 |
|
| SV* _node; |
| 1106 |
|
| AV* node; |
| 1107 |
|
| SV* directive; |
| 1108 |
|
| STRLEN directive_len; |
| 1109 |
|
| char* directive_c; |
| 1110 |
|
| SV* details; |
| 1111 |
|
| SV* add_str; |
| 1112 |
|
| |
| 1113 |
8080 |
▶ | for (i = 0; i < len; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < len; i++) { |
5185 |
2895 |
8080 |
|
| 1114 |
5185 |
| svp = av_fetch(tree, i, FALSE); |
| 1115 |
5185 |
▶ | if (! svp) continue; |
Branch: 1 branch
| Branch | True | False | Total |
| if (! svp) continue; |
0 |
5185 |
5185 |
|
| 1116 |
5185 |
| SvGETMAGIC(*svp); |
| 1117 |
5185 |
| _node = *svp; |
| 1118 |
|
| |
| 1119 |
5185 |
▶ | if (! SvROK(_node)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (! SvROK(_node)) { |
850 |
4335 |
5185 |
|
| 1120 |
850 |
▶ | if (sv_defined(_node)) sv_catsv(out_ref, _node); |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_defined(_node)) sv_catsv(out_ref, _node); |
850 |
0 |
850 |
| if (sv_defined(_node)) sv_catsv(out_ref, _node); |
850 |
0 |
850 |
|
| 1121 |
850 |
| continue; |
| 1122 |
|
| } |
| 1123 |
|
| |
| 1124 |
4335 |
▶ | if ((svp = hv_fetch(self, "_debug_dirs", 11, FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((svp = hv_fetch(self, "_debug_dirs", 11, FALSE)) |
8 |
4327 |
4335 |
|
| 1125 |
8 |
▶ | && SvTRUE(*svp)) { |
Branch: 1 branch
| Branch | True | False | Total |
| && SvTRUE(*svp)) { |
8 |
0 |
8 |
|
| 1126 |
8 |
| svp = hv_fetch(self, "_debug_off", 10, FALSE); |
| 1127 |
8 |
▶ | if (! svp || (svp && ! SvTRUE(*svp))) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (! svp || (svp && ! SvTRUE(*svp))) { |
0 |
8 |
8 |
| if (! svp || (svp && ! SvTRUE(*svp))) { |
0 |
0 |
0 |
| if (! svp || (svp && ! SvTRUE(*svp))) { |
0 |
0 |
0 |
|
| 1128 |
8 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
8 |
8 |
|
| 1129 |
8 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
8 |
8 |
|
| 1130 |
8 |
▶ | XPUSHs(_node); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_node); |
0 |
8 |
8 |
|
| 1131 |
8 |
| PUTBACK; |
| 1132 |
8 |
| n = call_method("debug_node", G_SCALAR); |
| 1133 |
8 |
| SPAGAIN; |
| 1134 |
8 |
▶ | if (n >= 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n >= 1) { |
8 |
0 |
8 |
|
| 1135 |
8 |
| add_str = POPs; |
| 1136 |
|
| I32 j; |
| 1137 |
8 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
8 |
8 |
|
| 1138 |
8 |
▶ | if (sv_defined(add_str)) sv_catsv(out_ref, add_str); |
Branch: 2 branches
| Branch | True | False | Total |
| if (sv_defined(add_str)) sv_catsv(out_ref, add_str); |
8 |
0 |
8 |
| if (sv_defined(add_str)) sv_catsv(out_ref, add_str); |
8 |
0 |
8 |
|
| 1139 |
|
| } |
| 1140 |
8 |
| PUTBACK; |
| 1141 |
|
| } |
| 1142 |
|
| } |
| 1143 |
|
| |
| 1144 |
4335 |
| node = (AV*)SvRV(_node); |
| 1145 |
|
| |
| 1146 |
4335 |
| svp = av_fetch(node, 0, FALSE); |
| 1147 |
4335 |
▶ | if (! svp) continue; |
Branch: 1 branch
| Branch | True | False | Total |
| if (! svp) continue; |
0 |
4335 |
4335 |
|
| 1148 |
4335 |
| SvGETMAGIC(*svp); |
| 1149 |
4335 |
| directive = *svp; |
| 1150 |
4335 |
| directive_c = SvPV(directive, directive_len); |
| 1151 |
|
| |
| 1152 |
4335 |
| svp = av_fetch(node, 3, FALSE); |
| 1153 |
4335 |
▶ | if (! svp) continue; |
Branch: 1 branch
| Branch | True | False | Total |
| if (! svp) continue; |
5 |
4330 |
4335 |
|
| 1154 |
4330 |
| SvGETMAGIC(*svp); |
| 1155 |
4330 |
| details = *svp; |
| 1156 |
|
| |
| 1157 |
4330 |
| svp = hv_fetch(table, directive_c, directive_len, FALSE); |
| 1158 |
4330 |
▶ | if (! svp) continue; |
Branch: 1 branch
| Branch | True | False | Total |
| if (! svp) continue; |
0 |
4330 |
4330 |
|
| 1159 |
|
| |
| 1160 |
|
| /* attempt to handle FOREACH natively */ |
| 1161 |
|
| /* if (sv_eq(directive, sv_2mortal(newSVpv("FOREACH", 0))) */ |
| 1162 |
|
| /* || sv_eq(directive, sv_2mortal(newSVpv("FOR", 0)))) { */ |
| 1163 |
|
| /* //if (*directive_c == 'FOREACH' || *directive_c == 'FOR') { */ |
| 1164 |
|
| /* _play_foreach(_self, details, _node, _out_ref); */ |
| 1165 |
|
| /* } else { */ |
| 1166 |
|
| |
| 1167 |
4330 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
4330 |
4330 |
|
| 1168 |
4330 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
4330 |
4330 |
|
| 1169 |
4330 |
▶ | XPUSHs(details); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(details); |
0 |
4330 |
4330 |
|
| 1170 |
4330 |
▶ | XPUSHs(_node); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_node); |
0 |
4330 |
4330 |
|
| 1171 |
4330 |
▶ | XPUSHs(_out_ref); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_out_ref); |
0 |
4330 |
4330 |
|
| 1172 |
4330 |
| PUTBACK; |
| 1173 |
4330 |
| n = call_sv(*svp, G_VOID); |
| 1174 |
4205 |
| SPAGAIN; |
| 1175 |
4205 |
▶ | if (n >= 1) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (n >= 1) { |
0 |
4205 |
4205 |
|
| 1176 |
|
| I32 j; |
| 1177 |
0 |
▶ | for (j = 0; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 0; j < n; j++) POPs; |
0 |
0 |
0 |
|
| 1178 |
|
| } |
| 1179 |
4205 |
| PUTBACK; |
| 1180 |
|
| /* } */ |
| 1181 |
|
| } |
| 1182 |
|
| |
| 1183 |
2895 |
▶ | XPUSHi(1); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHi(1); |
2880 |
15 |
2895 |
| XPUSHi(1); |
0 |
2895 |
2895 |
|
| 1184 |
|
| } else { |
| 1185 |
0 |
▶ | XPUSHi(0); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHi(0); |
0 |
0 |
0 |
| XPUSHi(0); |
0 |
0 |
0 |
|
| 1186 |
|
| } |
| 1187 |
2895 |
| XSRETURN(1); |
| 1188 |
|
| |
| 1189 |
|
| |
| 1190 |
|
| static SV* |
| 1191 |
|
| set_variable (_self, _var, val, ...) |
| 1192 |
|
| SV* _self; |
| 1193 |
|
| SV* _var; |
| 1194 |
|
| SV* val; |
| 1195 |
|
| PPCODE: |
| 1196 |
5283 |
▶ | if (! _var) XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| if (! _var) XSRETURN_UNDEF; |
0 |
5283 |
5283 |
|
| 1197 |
|
| |
| 1198 |
5283 |
| HV* self = (HV*)SvRV(_self); |
| 1199 |
|
| AV* var; |
| 1200 |
5283 |
▶ | if (SvROK(_var)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(_var)) { |
5208 |
75 |
5283 |
|
| 1201 |
5208 |
| var = (AV*)SvRV(_var); |
| 1202 |
|
| } else { /* allow for the parse tree to store literals - the literal is used as a name (like [% 'a' = 'A' %]) */ |
| 1203 |
75 |
| var = newAV(); |
| 1204 |
75 |
| av_push(var, _var); |
| 1205 |
75 |
| av_push(var, newSViv(0)); |
| 1206 |
|
| } |
| 1207 |
5283 |
▶ | HV* Args = (items > 3 && SvROK(ST(3)) && SvTYPE(SvRV(ST(3))) == SVt_PVHV) ? (HV*)SvRV(ST(3)) : Nullhv; |
Branch: 3 branches
| Branch | True | False | Total |
| HV* Args = (items > 3 && SvROK(ST(3)) && SvTYPE(SvRV(ST(3))) == SVt_PVHV) ? (HV*)SvRV(ST(3)) : Nullhv; |
3 |
5280 |
5283 |
| HV* Args = (items > 3 && SvROK(ST(3)) && SvTYPE(SvRV(ST(3))) == SVt_PVHV) ? (HV*)SvRV(ST(3)) : Nullhv; |
3 |
0 |
3 |
| HV* Args = (items > 3 && SvROK(ST(3)) && SvTYPE(SvRV(ST(3))) == SVt_PVHV) ? (HV*)SvRV(ST(3)) : Nullhv; |
3 |
0 |
3 |
|
| 1208 |
5283 |
| I32 i = 0; |
| 1209 |
|
| I32 n; |
| 1210 |
|
| SV** svp; |
| 1211 |
5283 |
| I32 var_len = av_len(var); |
| 1212 |
|
| |
| 1213 |
|
| /* determine the top level of this particular variable access */ |
| 1214 |
|
| |
| 1215 |
|
| SV* ref; |
| 1216 |
5283 |
| svp = av_fetch(var, i++, FALSE); |
| 1217 |
5283 |
| SvGETMAGIC(*svp); |
| 1218 |
5283 |
| SV* name = (SV*)(*svp); |
| 1219 |
|
| STRLEN name_len; |
| 1220 |
5283 |
| char* name_c = SvPV(name, name_len); |
| 1221 |
|
| |
| 1222 |
5283 |
| svp = av_fetch(var, i++, FALSE); |
| 1223 |
5283 |
| SvGETMAGIC(*svp); |
| 1224 |
5283 |
▶ | AV* args = (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) ? (AV*)SvRV(*svp) : (AV*)sv_2mortal((SV*)newAV()); |
Branch: 2 branches
| Branch | True | False | Total |
| AV* args = (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) ? (AV*)SvRV(*svp) : (AV*)sv_2mortal((SV*)newAV()); |
0 |
5283 |
5283 |
| AV* args = (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) ? (AV*)SvRV(*svp) : (AV*)sv_2mortal((SV*)newAV()); |
0 |
0 |
0 |
|
| 1225 |
|
| |
| 1226 |
5283 |
▶ | if (SvROK(name)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(name)) { |
18 |
5265 |
5283 |
|
| 1227 |
|
| /* non-named types can't be set */ |
| 1228 |
18 |
▶ | if (SvTYPE(SvRV(name)) != SVt_PVAV) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(SvRV(name)) != SVt_PVAV) { |
0 |
18 |
18 |
|
| 1229 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1230 |
0 |
| XSRETURN(1); |
| 1231 |
|
| } |
| 1232 |
|
| |
| 1233 |
|
| /* operators can't be set either */ |
| 1234 |
18 |
| svp = av_fetch((AV*)SvRV(name), 0, FALSE); |
| 1235 |
18 |
| SvGETMAGIC(*svp); |
| 1236 |
18 |
▶ | if (! sv_defined(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(*svp)) { |
18 |
0 |
18 |
| if (! sv_defined(*svp)) { |
6 |
12 |
18 |
|
| 1237 |
6 |
| svp = av_fetch((AV*)SvRV(name), 1, FALSE); |
| 1238 |
6 |
| SvGETMAGIC(*svp); |
| 1239 |
6 |
▶ | if (!sv_defined(*svp) |
Branch: 2 branches
| Branch | True | False | Total |
| if (!sv_defined(*svp) |
6 |
0 |
6 |
| if (!sv_defined(*svp) |
0 |
6 |
6 |
|
| 1240 |
0 |
▶ | && 0 == sv_eq(*svp, sv_2mortal(newSVpv("@()", 0))) |
Branch: 1 branch
| Branch | True | False | Total |
| && 0 == sv_eq(*svp, sv_2mortal(newSVpv("@()", 0))) |
0 |
0 |
0 |
|
| 1241 |
0 |
▶ | && 0 == sv_eq(*svp, sv_2mortal(newSVpv("$()", 0)))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && 0 == sv_eq(*svp, sv_2mortal(newSVpv("$()", 0)))) { |
0 |
0 |
0 |
|
| 1242 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1243 |
0 |
| XSRETURN(1); |
| 1244 |
|
| } |
| 1245 |
6 |
▶ | PUSHMARK(SP); /* @() and $() call context operators can though */ |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); /* @() and $() call context operators can though */ |
0 |
6 |
6 |
|
| 1246 |
6 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
6 |
6 |
|
| 1247 |
6 |
▶ | XPUSHs(name); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(name); |
0 |
6 |
6 |
|
| 1248 |
6 |
| PUTBACK; |
| 1249 |
6 |
| n = call_method("play_operator", G_SCALAR); |
| 1250 |
6 |
| SPAGAIN; |
| 1251 |
6 |
| ref = POPs; |
| 1252 |
|
| I32 j; |
| 1253 |
6 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
6 |
6 |
|
| 1254 |
6 |
| PUTBACK; |
| 1255 |
|
| } else { |
| 1256 |
|
| /* named access (ie via $name.foo) */ |
| 1257 |
12 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
12 |
12 |
|
| 1258 |
12 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
12 |
12 |
|
| 1259 |
12 |
▶ | XPUSHs(name); /* we could check if name is an array - but we will let the recursive call hit */ |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(name); /* we could check if name is an array - but we will let the recursive call hit */ |
0 |
12 |
12 |
|
| 1260 |
12 |
| PUTBACK; |
| 1261 |
12 |
| n = call_method("play_expr", G_SCALAR); |
| 1262 |
12 |
| SPAGAIN; |
| 1263 |
12 |
| name = POPs; |
| 1264 |
12 |
| name_c = SvPV(name, name_len); |
| 1265 |
|
| I32 j; |
| 1266 |
12 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
12 |
12 |
|
| 1267 |
12 |
| PUTBACK; |
| 1268 |
|
| |
| 1269 |
12 |
▶ | if (! sv_defined(name) /* no defined */ |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(name) /* no defined */ |
12 |
0 |
12 |
| if (! sv_defined(name) /* no defined */ |
12 |
0 |
12 |
|
| 1270 |
12 |
▶ | || name_is_private(name_c) /* don't allow vars that begin with _ */ |
Branch: 1 branch
| Branch | True | False | Total |
| || name_is_private(name_c) /* don't allow vars that begin with _ */ |
12 |
0 |
12 |
|
| 1271 |
12 |
▶ | || ! (svp = hv_fetch(self, "_vars", 5, FALSE)) /* no entry */ |
Branch: 1 branch
| Branch | True | False | Total |
| || ! (svp = hv_fetch(self, "_vars", 5, FALSE)) /* no entry */ |
0 |
12 |
12 |
|
| 1272 |
|
| ) { |
| 1273 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1274 |
0 |
| XSRETURN(1); |
| 1275 |
|
| } |
| 1276 |
|
| |
| 1277 |
12 |
| SvGETMAGIC(*svp); |
| 1278 |
12 |
| ref = *svp; |
| 1279 |
|
| |
| 1280 |
12 |
| HV* ref_hv = (HV*)SvRV(ref); |
| 1281 |
12 |
▶ | if (svp = hv_fetch(ref_hv, name_c, name_len, FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp = hv_fetch(ref_hv, name_c, name_len, FALSE)) |
0 |
12 |
12 |
|
| 1282 |
0 |
| SvGETMAGIC(*svp); |
| 1283 |
|
| |
| 1284 |
12 |
▶ | if (i > var_len) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (i > var_len) { |
6 |
6 |
12 |
|
| 1285 |
6 |
| SV* newval = newSVsv(val); |
| 1286 |
|
| |
| 1287 |
6 |
▶ | if (svp) SvSetSV_nosteal(*svp, newval); |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp) SvSetSV_nosteal(*svp, newval); |
0 |
6 |
6 |
| if (svp) SvSetSV_nosteal(*svp, newval); |
0 |
0 |
0 |
|
| 1288 |
6 |
| else hv_store(ref_hv, name_c, name_len, newval, 0); |
| 1289 |
|
| |
| 1290 |
6 |
▶ | XPUSHs(val); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(val); |
0 |
6 |
6 |
|
| 1291 |
6 |
| XSRETURN(1); |
| 1292 |
|
| } |
| 1293 |
|
| |
| 1294 |
6 |
▶ | if (! svp || ! SvROK(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! svp || ! SvROK(*svp)) { |
0 |
6 |
6 |
| if (! svp || ! SvROK(*svp)) { |
0 |
0 |
0 |
|
| 1295 |
6 |
| HV* newlevel = newHV(); |
| 1296 |
6 |
| hv_store(ref_hv, name_c, name_len, newRV_noinc((SV*)newlevel), 0); |
| 1297 |
6 |
| svp = hv_fetch(ref_hv, name_c, name_len, FALSE); |
| 1298 |
6 |
| SvGETMAGIC(*svp); |
| 1299 |
|
| } |
| 1300 |
6 |
| ref = *svp; |
| 1301 |
|
| } |
| 1302 |
5265 |
▶ | } else if (sv_defined(name)) { |
Branch: 2 branches
| Branch | True | False | Total |
| } else if (sv_defined(name)) { |
5265 |
0 |
5265 |
| } else if (sv_defined(name)) { |
5265 |
0 |
5265 |
|
| 1303 |
5265 |
▶ | if (name_is_private(name_c) /* don't allow vars that begin with _ */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (name_is_private(name_c) /* don't allow vars that begin with _ */ |
5262 |
3 |
5265 |
|
| 1304 |
5262 |
▶ | || ! (svp = hv_fetch(self, "_vars", 5, FALSE)) /* no entry */ |
Branch: 1 branch
| Branch | True | False | Total |
| || ! (svp = hv_fetch(self, "_vars", 5, FALSE)) /* no entry */ |
0 |
5262 |
5262 |
|
| 1305 |
|
| ) { |
| 1306 |
3 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
3 |
3 |
|
| 1307 |
3 |
| XSRETURN(1); |
| 1308 |
|
| } |
| 1309 |
|
| |
| 1310 |
5262 |
| SvGETMAGIC(*svp); |
| 1311 |
5262 |
| ref = *svp; |
| 1312 |
|
| |
| 1313 |
5262 |
| HV* ref_hv = (HV*)SvRV(ref); |
| 1314 |
5262 |
▶ | if (svp = hv_fetch(ref_hv, name_c, name_len, FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp = hv_fetch(ref_hv, name_c, name_len, FALSE)) |
4036 |
1226 |
5262 |
|
| 1315 |
4036 |
| SvGETMAGIC(*svp); |
| 1316 |
|
| |
| 1317 |
5262 |
▶ | if (i > var_len) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (i > var_len) { |
5130 |
132 |
5262 |
|
| 1318 |
5130 |
| SV* newval = newSVsv(val); |
| 1319 |
|
| |
| 1320 |
5130 |
▶ | if (svp) SvSetSV_nosteal(*svp, newval); |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp) SvSetSV_nosteal(*svp, newval); |
3955 |
1175 |
5130 |
| if (svp) SvSetSV_nosteal(*svp, newval); |
3955 |
0 |
3955 |
|
| 1321 |
1175 |
| else hv_store(ref_hv, name_c, name_len, newval, 0); |
| 1322 |
|
| |
| 1323 |
5130 |
▶ | XPUSHs(newval); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(newval); |
0 |
5130 |
5130 |
|
| 1324 |
5130 |
| XSRETURN(1); |
| 1325 |
|
| } |
| 1326 |
|
| |
| 1327 |
132 |
▶ | if (! svp || ! SvROK(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! svp || ! SvROK(*svp)) { |
81 |
51 |
132 |
| if (! svp || ! SvROK(*svp)) { |
0 |
81 |
81 |
|
| 1328 |
51 |
| HV* newlevel = newHV(); |
| 1329 |
51 |
| hv_store(ref_hv, name_c, name_len, newRV_noinc((SV*)newlevel), 0); |
| 1330 |
51 |
| svp = hv_fetch(ref_hv, name_c, name_len, FALSE); |
| 1331 |
51 |
| SvGETMAGIC(*svp); |
| 1332 |
|
| } |
| 1333 |
132 |
| ref = *svp; |
| 1334 |
|
| |
| 1335 |
|
| } |
| 1336 |
|
| |
| 1337 |
192 |
▶ | while (sv_defined(ref)) { |
Branch: 2 branches
| Branch | True | False | Total |
| while (sv_defined(ref)) { |
192 |
0 |
192 |
| while (sv_defined(ref)) { |
192 |
0 |
192 |
|
| 1338 |
|
| |
| 1339 |
|
| /* check at each point if the returned thing was a code */ |
| 1340 |
192 |
▶ | if (SvROK(ref) && SvTYPE(SvRV(ref)) == SVt_PVCV) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (SvROK(ref) && SvTYPE(SvRV(ref)) == SVt_PVCV) { |
192 |
0 |
192 |
| if (SvROK(ref) && SvTYPE(SvRV(ref)) == SVt_PVCV) { |
0 |
192 |
192 |
|
| 1341 |
|
| SV* type; |
| 1342 |
0 |
▶ | if (hv_exists(self, "CALL_CONTEXT", 12) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hv_exists(self, "CALL_CONTEXT", 12) |
0 |
0 |
0 |
|
| 1343 |
0 |
▶ | && (svp = hv_fetch(self, "CALL_CONTEXT", 12, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch(self, "CALL_CONTEXT", 12, FALSE))) { |
0 |
0 |
0 |
|
| 1344 |
0 |
| SvGETMAGIC(*svp); |
| 1345 |
0 |
| type = (SV*)(*svp); |
| 1346 |
|
| } |
| 1347 |
0 |
▶ | if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
0 |
0 |
0 |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
0 |
0 |
0 |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
0 |
0 |
0 |
|
| 1348 |
0 |
| ref = call_sv_with_args(ref, _self, args, G_SCALAR, Nullsv, CALL_CTX_ITEM); |
| 1349 |
0 |
▶ | } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
Branch: 3 branches
| Branch | True | False | Total |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
0 |
0 |
0 |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
0 |
0 |
0 |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
0 |
0 |
0 |
|
| 1350 |
0 |
| ref = call_sv_with_args(ref, _self, args, G_ARRAY, Nullsv, CALL_CTX_LIST); |
| 1351 |
|
| } else { |
| 1352 |
0 |
| ref = call_sv_with_args(ref, _self, args, G_ARRAY, Nullsv, CALL_CTX_SMART); |
| 1353 |
|
| } |
| 1354 |
0 |
▶ | if (! sv_defined(ref)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(ref)) { |
0 |
0 |
0 |
| if (! sv_defined(ref)) { |
0 |
0 |
0 |
|
| 1355 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1356 |
144 |
| XSRETURN(1); |
| 1357 |
|
| } |
| 1358 |
|
| } |
| 1359 |
|
| |
| 1360 |
|
| /* descend one chained level */ |
| 1361 |
192 |
▶ | if (i >= var_len) break; |
Branch: 1 branch
| Branch | True | False | Total |
| if (i >= var_len) break; |
0 |
192 |
192 |
|
| 1362 |
|
| |
| 1363 |
192 |
| bool was_dot_call = 0; |
| 1364 |
192 |
| svp = hv_fetch(Args, "no_dots", 7, FALSE); |
| 1365 |
192 |
▶ | if (svp) SvGETMAGIC(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) SvGETMAGIC(*svp); |
6 |
186 |
192 |
|
| 1366 |
192 |
▶ | if (svp && SvTRUE(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp && SvTRUE(*svp)) { |
6 |
186 |
192 |
| if (svp && SvTRUE(*svp)) { |
6 |
0 |
6 |
|
| 1367 |
6 |
| was_dot_call = 1; |
| 1368 |
|
| } else { |
| 1369 |
186 |
| svp = av_fetch(var, i++, FALSE); |
| 1370 |
186 |
| SvGETMAGIC(*svp); |
| 1371 |
186 |
| was_dot_call = sv_eq(*svp, sv_2mortal(newSVpv(".", 0))); |
| 1372 |
|
| } |
| 1373 |
|
| |
| 1374 |
192 |
| svp = av_fetch(var, i++, FALSE); |
| 1375 |
192 |
▶ | if (! svp) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (! svp) { |
0 |
192 |
192 |
|
| 1376 |
0 |
| ref = &PL_sv_undef; |
| 1377 |
0 |
| break; |
| 1378 |
|
| } |
| 1379 |
192 |
| SvGETMAGIC(*svp); |
| 1380 |
192 |
| name = (SV*)(*svp); |
| 1381 |
|
| STRLEN name_len; |
| 1382 |
192 |
| char* name_c = SvPV(name, name_len); |
| 1383 |
|
| |
| 1384 |
192 |
| svp = av_fetch(var, i++, FALSE); |
| 1385 |
192 |
▶ | if (! svp) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (! svp) { |
0 |
192 |
192 |
|
| 1386 |
0 |
| ref = &PL_sv_undef; |
| 1387 |
0 |
| break; |
| 1388 |
|
| } |
| 1389 |
192 |
| SvGETMAGIC(*svp); |
| 1390 |
192 |
▶ | args = (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) ? (AV*)SvRV(*svp) : (AV*)sv_2mortal((SV*)newAV()); |
Branch: 2 branches
| Branch | True | False | Total |
| args = (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) ? (AV*)SvRV(*svp) : (AV*)sv_2mortal((SV*)newAV()); |
0 |
192 |
192 |
| args = (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV) ? (AV*)SvRV(*svp) : (AV*)sv_2mortal((SV*)newAV()); |
0 |
0 |
0 |
|
| 1391 |
|
| |
| 1392 |
|
| /* allow for named portions of a variable name (foo.$name.bar) */ |
| 1393 |
192 |
▶ | if (SvROK(name)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(name)) { |
18 |
174 |
192 |
|
| 1394 |
18 |
▶ | if (SvTYPE(SvRV(name)) == SVt_PVAV) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(SvRV(name)) == SVt_PVAV) { |
18 |
0 |
18 |
|
| 1395 |
18 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
18 |
18 |
|
| 1396 |
18 |
▶ | XPUSHs(_self); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(_self); |
0 |
18 |
18 |
|
| 1397 |
18 |
▶ | XPUSHs(name); /* we could check if name is an array - but we will let the recursive call hit */ |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(name); /* we could check if name is an array - but we will let the recursive call hit */ |
0 |
18 |
18 |
|
| 1398 |
18 |
| PUTBACK; |
| 1399 |
18 |
| n = call_method("play_expr", G_SCALAR); |
| 1400 |
18 |
| SPAGAIN; |
| 1401 |
18 |
| name = POPs; |
| 1402 |
18 |
| name_c = SvPV(name, name_len); |
| 1403 |
|
| I32 j; |
| 1404 |
18 |
▶ | for (j = 1; j < n; j++) POPs; |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 1; j < n; j++) POPs; |
0 |
18 |
18 |
|
| 1405 |
18 |
| PUTBACK; |
| 1406 |
18 |
▶ | if (! sv_defined(name)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! sv_defined(name)) { |
18 |
0 |
18 |
| if (! sv_defined(name)) { |
0 |
18 |
18 |
|
| 1407 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1408 |
0 |
| XSRETURN(1); |
| 1409 |
|
| } |
| 1410 |
|
| } else { |
| 1411 |
0 |
| (void)die("Shouldn't get a .ref($name). during a vivify on chain"); |
| 1412 |
|
| } |
| 1413 |
|
| } |
| 1414 |
192 |
▶ | if (name_is_private(name_c)) { /* don't allow vars that begin with _ */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (name_is_private(name_c)) { /* don't allow vars that begin with _ */ |
0 |
192 |
192 |
|
| 1415 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1416 |
0 |
| XSRETURN(1); |
| 1417 |
|
| } |
| 1418 |
|
| |
| 1419 |
|
| /* scalar access */ |
| 1420 |
192 |
▶ | if (! SvROK(ref)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (! SvROK(ref)) { |
0 |
192 |
192 |
|
| 1421 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1422 |
0 |
| XSRETURN(1); |
| 1423 |
|
| |
| 1424 |
|
| /* method calls on objects */ |
| 1425 |
192 |
▶ | } else if (was_dot_call && sv_isobject(ref)) { |
Branch: 2 branches
| Branch | True | False | Total |
| } else if (was_dot_call && sv_isobject(ref)) { |
192 |
0 |
192 |
| } else if (was_dot_call && sv_isobject(ref)) { |
27 |
165 |
192 |
|
| 1426 |
|
| SV* type; |
| 1427 |
27 |
| HV* stash = SvSTASH((SV*)SvRV(ref)); |
| 1428 |
27 |
| GV* gv = gv_fetchmethod_autoload(stash, name_c, 1); |
| 1429 |
27 |
| bool lvalueish = FALSE; |
| 1430 |
27 |
▶ | if (hv_exists(self, "CALL_CONTEXT", 12) |
Branch: 1 branch
| Branch | True | False | Total |
| if (hv_exists(self, "CALL_CONTEXT", 12) |
27 |
0 |
27 |
|
| 1431 |
27 |
▶ | && (svp = hv_fetch(self, "CALL_CONTEXT", 12, FALSE))) { |
Branch: 1 branch
| Branch | True | False | Total |
| && (svp = hv_fetch(self, "CALL_CONTEXT", 12, FALSE))) { |
27 |
0 |
27 |
|
| 1432 |
27 |
| SvGETMAGIC(*svp); |
| 1433 |
27 |
| type = (SV*)(*svp); |
| 1434 |
|
| } |
| 1435 |
27 |
▶ | if (! gv && sv_defined(type) |
Branch: 3 branches
| Branch | True | False | Total |
| if (! gv && sv_defined(type) |
3 |
24 |
27 |
| if (! gv && sv_defined(type) |
3 |
0 |
3 |
| if (! gv && sv_defined(type) |
0 |
3 |
3 |
|
| 1436 |
0 |
▶ | && (sv_eq(type, sv_2mortal(newSVpv("item", 0))) || sv_eq(type, sv_2mortal(newSVpv("list", 0))))) { |
Branch: 2 branches
| Branch | True | False | Total |
| && (sv_eq(type, sv_2mortal(newSVpv("item", 0))) || sv_eq(type, sv_2mortal(newSVpv("list", 0))))) { |
0 |
0 |
0 |
| && (sv_eq(type, sv_2mortal(newSVpv("item", 0))) || sv_eq(type, sv_2mortal(newSVpv("list", 0))))) { |
0 |
0 |
0 |
|
| 1437 |
0 |
| char* package = (char*)sv_reftype(SvRV(ref), 1); |
| 1438 |
0 |
| croak("Can't locate object method \"%s\" via package %s", name_c, package); |
| 1439 |
|
| } |
| 1440 |
27 |
▶ | if (i >= var_len) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (i >= var_len) { |
18 |
9 |
27 |
|
| 1441 |
18 |
| lvalueish = TRUE; |
| 1442 |
18 |
| AV* newargs = newAV(); |
| 1443 |
|
| I32 j; |
| 1444 |
18 |
▶ | for (j = 0; j <= av_len(args); j++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (j = 0; j <= av_len(args); j++) { |
0 |
18 |
18 |
|
| 1445 |
0 |
| svp = av_fetch(args, j, FALSE); |
| 1446 |
0 |
▶ | if (svp) SvGETMAGIC(*svp); |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp) SvGETMAGIC(*svp); |
0 |
0 |
0 |
|
| 1447 |
0 |
▶ | av_push(newargs, svp ? *svp : &PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| av_push(newargs, svp ? *svp : &PL_sv_undef); |
0 |
0 |
0 |
|
| 1448 |
|
| } |
| 1449 |
18 |
| av_push(newargs, val); |
| 1450 |
18 |
| args = newargs; /* newRV_noinc((SV*)newargs); */ |
| 1451 |
|
| } |
| 1452 |
27 |
▶ | if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
27 |
0 |
27 |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
15 |
12 |
27 |
| if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("item", 0)))) { |
6 |
9 |
15 |
|
| 1453 |
6 |
| ref = call_sv_with_args((SV*)GvCV(gv), _self, args, G_SCALAR, ref, CALL_CTX_ITEM); |
| 1454 |
6 |
▶ | if (lvalueish || ! sv_defined(ref)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (lvalueish || ! sv_defined(ref)) { |
0 |
6 |
6 |
| if (lvalueish || ! sv_defined(ref)) { |
0 |
0 |
0 |
| if (lvalueish || ! sv_defined(ref)) { |
0 |
0 |
0 |
|
| 1455 |
6 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
6 |
6 |
|
| 1456 |
6 |
| XSRETURN(1); |
| 1457 |
|
| } |
| 1458 |
48 |
| continue; |
| 1459 |
21 |
▶ | } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
Branch: 3 branches
| Branch | True | False | Total |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
21 |
0 |
21 |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
9 |
12 |
21 |
| } else if (sv_defined(type) && sv_eq(type, sv_2mortal(newSVpv("list", 0)))) { |
9 |
0 |
9 |
|
| 1460 |
9 |
| ref = call_sv_with_args((SV*)GvCV(gv), _self, args, G_ARRAY, ref, CALL_CTX_LIST); |
| 1461 |
9 |
▶ | if (lvalueish || ! sv_defined(ref)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (lvalueish || ! sv_defined(ref)) { |
3 |
6 |
9 |
| if (lvalueish || ! sv_defined(ref)) { |
3 |
0 |
3 |
| if (lvalueish || ! sv_defined(ref)) { |
0 |
3 |
3 |
|
| 1462 |
6 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
6 |
6 |
|
| 1463 |
6 |
| XSRETURN(1); |
| 1464 |
|
| } |
| 1465 |
3 |
| continue; |
| 1466 |
12 |
▶ | } else if (gv) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (gv) { |
9 |
3 |
12 |
|
| 1467 |
9 |
| SV* newref = call_sv_with_args((SV*)GvCV(gv), _self, args, G_ARRAY | G_EVAL, ref, CALL_CTX_SMART); |
| 1468 |
9 |
▶ | if (!SvTRUE(ERRSV)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (!SvTRUE(ERRSV)) { |
9 |
0 |
9 |
| if (!SvTRUE(ERRSV)) { |
9 |
0 |
9 |
|
| 1469 |
9 |
| ref = newref; |
| 1470 |
9 |
▶ | if (lvalueish || ! sv_defined(ref)) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (lvalueish || ! sv_defined(ref)) { |
6 |
3 |
9 |
| if (lvalueish || ! sv_defined(ref)) { |
6 |
0 |
6 |
| if (lvalueish || ! sv_defined(ref)) { |
0 |
6 |
6 |
|
| 1471 |
3 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
3 |
3 |
|
| 1472 |
3 |
| XSRETURN(1); |
| 1473 |
|
| } |
| 1474 |
6 |
| continue; |
| 1475 |
|
| } |
| 1476 |
0 |
| SV* errsv = get_sv("@", 0); |
| 1477 |
0 |
▶ | if (SvROK(errsv)) (void)die(Nullch); /* rethrow */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(errsv)) (void)die(Nullch); /* rethrow */ |
0 |
0 |
0 |
|
| 1478 |
|
| /* |
| 1479 |
|
| char* package = (char*)sv_reftype(SvRV(ref), 1); |
| 1480 |
|
| croak("Can't locate object method \"%s\" via package %s", name_c, package); |
| 1481 |
|
| die $@ if $@ !~ /Can\'t locate object method "\Q$name\E" via package "\Q$class\E"/; |
| 1482 |
|
| */ |
| 1483 |
|
| /* now fail down to normal lookup */ |
| 1484 |
|
| } |
| 1485 |
|
| } |
| 1486 |
|
| |
| 1487 |
|
| |
| 1488 |
|
| /* hash member access */ |
| 1489 |
168 |
▶ | if (SvTYPE(SvRV(ref)) == SVt_PVHV) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvTYPE(SvRV(ref)) == SVt_PVHV) { |
150 |
18 |
168 |
|
| 1490 |
|
| |
| 1491 |
150 |
| HV* ref_hv = (HV*)SvRV(ref); |
| 1492 |
150 |
▶ | if (svp = hv_fetch(ref_hv, name_c, name_len, FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp = hv_fetch(ref_hv, name_c, name_len, FALSE)) |
39 |
111 |
150 |
|
| 1493 |
39 |
| SvGETMAGIC(*svp); |
| 1494 |
|
| |
| 1495 |
150 |
▶ | if (i > var_len) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (i > var_len) { |
117 |
33 |
150 |
|
| 1496 |
117 |
| SV* newval = newSVsv(val); |
| 1497 |
|
| |
| 1498 |
117 |
▶ | if (svp) SvSetSV_nosteal(*svp, newval); |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp) SvSetSV_nosteal(*svp, newval); |
36 |
81 |
117 |
| if (svp) SvSetSV_nosteal(*svp, newval); |
36 |
0 |
36 |
|
| 1499 |
81 |
| else hv_store(ref_hv, name_c, name_len, newval, 0); |
| 1500 |
|
| |
| 1501 |
117 |
▶ | XPUSHs(val); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(val); |
0 |
117 |
117 |
|
| 1502 |
117 |
| XSRETURN(1); |
| 1503 |
|
| } |
| 1504 |
|
| |
| 1505 |
33 |
▶ | if (! svp || ! SvROK(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! svp || ! SvROK(*svp)) { |
3 |
30 |
33 |
| if (! svp || ! SvROK(*svp)) { |
0 |
3 |
3 |
|
| 1506 |
30 |
| HV* newlevel = newHV(); |
| 1507 |
30 |
| hv_store(ref_hv, name_c, name_len, newRV_noinc((SV*)newlevel), 0); |
| 1508 |
30 |
| svp = hv_fetch(ref_hv, name_c, name_len, FALSE); |
| 1509 |
30 |
| SvGETMAGIC(*svp); |
| 1510 |
|
| } |
| 1511 |
33 |
| ref = *svp; |
| 1512 |
33 |
| continue; |
| 1513 |
|
| |
| 1514 |
|
| /* array access */ |
| 1515 |
18 |
▶ | } else if (SvTYPE(SvRV(ref)) == SVt_PVAV) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (SvTYPE(SvRV(ref)) == SVt_PVAV) { |
18 |
0 |
18 |
|
| 1516 |
|
| UV name_uv; |
| 1517 |
|
| int res; |
| 1518 |
18 |
▶ | if ((res = grok_number(name_c, name_len, &name_uv)) |
Branch: 1 branch
| Branch | True | False | Total |
| if ((res = grok_number(name_c, name_len, &name_uv)) |
18 |
0 |
18 |
|
| 1519 |
18 |
▶ | && res & IS_NUMBER_IN_UV) { /* $name =~ m{ ^ -? $QR_NUM $ }ox) { */ |
Branch: 1 branch
| Branch | True | False | Total |
| && res & IS_NUMBER_IN_UV) { /* $name =~ m{ ^ -? $QR_NUM $ }ox) { */ |
18 |
0 |
18 |
|
| 1520 |
|
| |
| 1521 |
18 |
| AV* ref_av = (AV*)SvRV(ref); |
| 1522 |
18 |
▶ | if (svp = av_fetch(ref_av, (int)SvNV(name), FALSE)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (svp = av_fetch(ref_av, (int)SvNV(name), FALSE)) |
9 |
9 |
18 |
|
| 1523 |
9 |
| SvGETMAGIC(*svp); |
| 1524 |
|
| |
| 1525 |
18 |
▶ | if (i > var_len) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (i > var_len) { |
12 |
6 |
18 |
|
| 1526 |
12 |
| SV* newval = newSVsv(val); |
| 1527 |
|
| |
| 1528 |
12 |
▶ | if (svp) SvSetSV_nosteal(*svp, newval); |
Branch: 2 branches
| Branch | True | False | Total |
| if (svp) SvSetSV_nosteal(*svp, newval); |
3 |
9 |
12 |
| if (svp) SvSetSV_nosteal(*svp, newval); |
3 |
0 |
3 |
|
| 1529 |
9 |
| else av_store(ref_av, (int)SvNV(name), newval); |
| 1530 |
|
| |
| 1531 |
12 |
▶ | XPUSHs(val); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(val); |
0 |
12 |
12 |
|
| 1532 |
12 |
| XSRETURN(1); |
| 1533 |
|
| } |
| 1534 |
|
| |
| 1535 |
6 |
▶ | if (! svp || ! SvROK(*svp)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (! svp || ! SvROK(*svp)) { |
6 |
0 |
6 |
| if (! svp || ! SvROK(*svp)) { |
0 |
6 |
6 |
|
| 1536 |
0 |
| HV* newlevel = newHV(); |
| 1537 |
0 |
| av_store(ref_av, (int)SvNV(name), newRV_noinc((SV*)newlevel)); |
| 1538 |
0 |
| svp = av_fetch(ref_av, (int)SvNV(name), FALSE); |
| 1539 |
0 |
| SvGETMAGIC(*svp); |
| 1540 |
|
| } |
| 1541 |
6 |
| ref = *svp; |
| 1542 |
6 |
| continue; |
| 1543 |
|
| |
| 1544 |
|
| } else { |
| 1545 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1546 |
0 |
| XSRETURN(1); |
| 1547 |
|
| } |
| 1548 |
|
| } else { |
| 1549 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1550 |
0 |
| XSRETURN(1); |
| 1551 |
|
| } |
| 1552 |
|
| } |
| 1553 |
|
| |
| 1554 |
0 |
▶ | XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 1555 |
0 |
| XSRETURN(1); |