| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
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
|
100
|
|
|
|
|
if(hv_fetchs(hints, "t::stages/permitfunc", 0)) |
|
17
|
|
|
|
|
|
|
return TRUE; |
|
18
|
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
|
return FALSE; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
|
static void check_stages(pTHX_ void *hookdata) |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
2
|
100
|
|
|
|
|
if(hv_fetchs(GvHV(PL_hintgv), "t::stages/check-capture", 0)) { |
|
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
|
|
|
|
|
|
|
register_xs_parse_keyword("stages", &hooks_stages, NULL); |