lib/Syntax/Operator/Divides.xs

filter: Statementstmt 100% 14 / 14 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 16 / 16 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« hax/newOP_CUSTOM.c.inc ↑ Summary
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, 2016-2024 -- leonerd@leonerd.org.uk
5 */
6 #include "EXTERN.h"
7 #include "perl.h"
8 #include "XSUB.h"
9  
10 #include "XSParseInfix.h"
11  
12 #define HAVE_PERL_VERSION(R, V, S) \
13 (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
14  
15 #include "newOP_CUSTOM.c.inc"
16  
17 4 static OP *pp_divides(pTHX)
18 {
19 4 dSP;
20  
21 4 (PL_ppaddr[OP_MODULO])(aTHX);
22  
23 4 SPAGAIN;
24  
25 4 ▶ if(SvTRUE(TOPs)) {
Branch: 1 branch
BranchTrueFalseTotal
if(SvTRUE(TOPs)) { 2 2 4
26 2 *SP = &PL_sv_no;
27 }
28 else {
29 2 *SP = &PL_sv_yes;
30 }
31  
32 4 return NORMAL;
33 }
34  
35 7 static OP *new_op_divides(pTHX_ U32 flags, OP *lhs, OP *rhs, SV **parsedata, void *hookdata)
36 {
37 7 OP *ret = newBINOP_CUSTOM(&pp_divides, flags, lhs, rhs);
38 7 ret->op_targ = pad_alloc(OP_CUSTOM, SVs_PADTMP);
39 7 return ret;
40 }
41  
42 static const struct XSParseInfixHooks hooks_divides = {
43 .cls = XPI_CLS_MATCH_MISC,
44 .wrapper_func_name = "Syntax::Operator::Divides::is_divisor",
45 .new_op = &new_op_divides,
46 .ppaddr = &pp_divides,
47 };
48  
49 MODULE = Syntax::Operator::Divides PACKAGE = Syntax::Operator::Divides
50  
51 BOOT:
52 3 boot_xs_parse_infix(0.43);
53  
54 3 register_xs_parse_infix("Syntax::Operator::Divides::%%", &hooks_divides, NULL);
« hax/newOP_CUSTOM.c.inc ↑ Summary