t/stages.xs

filter: Statementstmt 100% 16 / 16 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 20 / 20 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« t/probing.xs ↑ Summary t/structures.xs »
1 /* You may distribute under the terms of either the GNU General Public License
2 * or the Artistic License (the same terms as Perl itself)
3 *
4 * (C) Paul Evans, 2021 -- leonerd@leonerd.org.uk
5 */
6  
7 #include "EXTERN.h"
8 #include "perl.h"
9 #include "XSUB.h"
10  
11 #include "XSParseKeyword.h"
12  
13 3 static bool permit_stages(pTHX_ void *hookdata)
14 {
15 3 HV *hints = GvHV(PL_hintgv);
16 3 ▶ if(hv_fetchs(hints, "t::stages/permitfunc", 0))
Branch: 1 branch
BranchTrueFalseTotal
if(hv_fetchs(hints, "t::stages/permitfunc", 0)) 2 1 3
17 2 return TRUE;
18  
19 1 return FALSE;
20 }
21  
22 2 static void check_stages(pTHX_ void *hookdata)
23 {
24 2 ▶ if(hv_fetchs(GvHV(PL_hintgv), "t::stages/check-capture", 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if(hv_fetchs(GvHV(PL_hintgv), "t::stages/check-capture", 0)) { 1 1 2
25 1 sv_setsv(get_sv("t::stages::captured", GV_ADD), get_sv("main::VAR", 0));
26 }
27 2 }
28  
29 2 static int parse_stages(pTHX_ OP **out, void *hookdata)
30 {
31 /* Parse and ignore a block */
32 2 OP *block = parse_block(0);
33 2 op_free(block);
34  
35 2 *out = newSVOP(OP_CONST, 0, newSVpvs("STAGE"));
36 2 return KEYWORD_PLUGIN_EXPR;
37 }
38  
39 static const struct XSParseKeywordHooks hooks_stages = {
40 .permit_hintkey = "t::stages/permitkey",
41 .permit = &permit_stages,
42  
43 .check = &check_stages,
44  
45 .parse = &parse_stages,
46 };
47  
48 MODULE = t::stages PACKAGE = t::stages
49  
50 BOOT:
51 2 boot_xs_parse_keyword(0);
52  
53 2 register_xs_parse_keyword("stages", &hooks_stages, NULL);
« t/probing.xs ↑ Summary t/structures.xs »