lib/Linux/RTC/const-xs.inc

filter: Statementstmt 63.1% 12 / 19 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 64.0% 16 / 25 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« lib/Linux/RTC/Ioctl.xs ↑ Summary lib/Linux/RTC/const-c.inc »
1 void
2 constant(sv)
3 PREINIT:
4 #ifdef dXSTARG
5 33 ▶ dXSTARG; /* Faster if we have it. */
Branch: 1 branch
BranchTrueFalseTotal
dXSTARG; /* Faster if we have it. */ 33 0 33
6 #else
7 dTARGET;
8 #endif
9 STRLEN len;
10 int type;
11 IV iv;
12 /* NV nv; Uncomment this if you need to return NVs */
13 /* const char *pv; Uncomment this if you need to return PVs */
14 INPUT:
15 SV * sv;
16 const char * s = SvPV(sv, len);
17 PPCODE:
18 /* Change this to constant(aTHX_ s, len, &iv, &nv);
19 if you need to return both NVs and IVs */
20 33 type = constant(aTHX_ s, len, &iv);
21 /* Return 1 or 2 items. First is error message, or undef if no error.
22 Second, if present, is found value */
23 33 switch (type) {
24 5 case PERL_constant_NOTFOUND:
25 sv =
26 5 sv_2mortal(newSVpvf("%s is not a valid Linux::RTC::Ioctl macro", s));
27 5 PUSHs(sv);
28 5 break;
29 0 case PERL_constant_NOTDEF:
30 0 sv = sv_2mortal(newSVpvf(
31 "Your vendor has not defined Linux::RTC::Ioctl macro %s, used",
32 s));
33 0 PUSHs(sv);
34 0 break;
35 /* Uncomment this if you need to return IVs
36 case PERL_constant_ISIV:
37 EXTEND(SP, 1);
38 PUSHs(&PL_sv_undef);
39 PUSHi(iv);
40 break; */
41 /* Uncomment this if you need to return NOs
42 case PERL_constant_ISNO:
43 EXTEND(SP, 1);
44 PUSHs(&PL_sv_undef);
45 PUSHs(&PL_sv_no);
46 break; */
47 /* Uncomment this if you need to return NVs
48 case PERL_constant_ISNV:
49 EXTEND(SP, 1);
50 PUSHs(&PL_sv_undef);
51 PUSHn(nv);
52 break; */
53 /* Uncomment this if you need to return PVs
54 case PERL_constant_ISPV:
55 EXTEND(SP, 1);
56 PUSHs(&PL_sv_undef);
57 PUSHp(pv, strlen(pv));
58 break; */
59 /* Uncomment this if you need to return PVNs
60 case PERL_constant_ISPVN:
61 EXTEND(SP, 1);
62 PUSHs(&PL_sv_undef);
63 PUSHp(pv, iv);
64 break; */
65 /* Uncomment this if you need to return SVs
66 case PERL_constant_ISSV:
67 EXTEND(SP, 1);
68 PUSHs(&PL_sv_undef);
69 PUSHs(sv);
70 break; */
71 /* Uncomment this if you need to return UNDEFs
72 case PERL_constant_ISUNDEF:
73 break; */
74 28 case PERL_constant_ISUV:
75 28 ▶ EXTEND(SP, 1);
Branch: 1 branch
BranchTrueFalseTotal
EXTEND(SP, 1); 0 28 28
76 28 PUSHs(&PL_sv_undef);
77 28 ▶ PUSHu((UV)iv);
Branch: 1 branch
BranchTrueFalseTotal
PUSHu((UV)iv); 27 1 28
78 28 break;
79 /* Uncomment this if you need to return YESs
80 case PERL_constant_ISYES:
81 EXTEND(SP, 1);
82 PUSHs(&PL_sv_undef);
83 PUSHs(&PL_sv_yes);
84 break; */
85 0 default:
86 0 sv = sv_2mortal(newSVpvf(
87 "Unexpected return type %d while processing Linux::RTC::Ioctl macro %s, used",
88 type, s));
89 0 PUSHs(sv);
90 }
« lib/Linux/RTC/Ioctl.xs ↑ Summary lib/Linux/RTC/const-c.inc »