Debian Codegraph @

t/parts.xs

raw
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, 2020 -- [email protected]
5 */
6
7 #include "EXTERN.h"
8 #include "perl.h"
9 #include "XSUB.h"
10
11 #include "XSParseSublike.h"
12
13 static bool parts_permit(pTHX_ void *_);
14
15 static struct XSParseSublikeHooks parse_parts_hooks = {
16 .ver = XSPARSESUBLIKE_ABI_VERSION,
17 .permit = parts_permit,
18 };
19
20 static bool parts_permit(pTHX_ void *_)
21 {
22 parse_parts_hooks.require_parts = 0;
23 parse_parts_hooks.skip_parts = 0;
24
25 if(hv_fetchs(GvHV(PL_hintgv), "t::parts/require-name", 0))
26 parse_parts_hooks.require_parts |= XS_PARSE_SUBLIKE_PART_NAME;
27 if(hv_fetchs(GvHV(PL_hintgv), "t::parts/skip-name", 0))
28 parse_parts_hooks.skip_parts |= XS_PARSE_SUBLIKE_PART_NAME;
29
30 if(hv_fetchs(GvHV(PL_hintgv), "t::parts/skip-attrs", 0))
31 parse_parts_hooks.skip_parts |= XS_PARSE_SUBLIKE_PART_ATTRS;
32
33 if(hv_fetchs(GvHV(PL_hintgv), "t::parts/skip-signature", 0))
34 parse_parts_hooks.skip_parts |= XS_PARSE_SUBLIKE_PART_SIGNATURE;
35
36 return TRUE;
37 }
38
39 MODULE = t::parts PACKAGE = t::parts
40
41 BOOT:
42 boot_xs_parse_sublike(0);
43
44 register_xs_parse_sublike("parts", &parse_parts_hooks, NULL);