constants.xs

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