File Coverage

const-c.inc
Criterion Covered Total %
statement 17 23 73.9
branch 4 8 50.0
condition n/a
subroutine n/a
pod n/a
total 21 31 67.7


line stmt bran cond sub pod time code
1             #define PERL_constant_NOTFOUND 1
2             #define PERL_constant_NOTDEF 2
3             #define PERL_constant_ISIV 3
4             #define PERL_constant_ISNO 4
5             #define PERL_constant_ISNV 5
6             #define PERL_constant_ISPV 6
7             #define PERL_constant_ISPVN 7
8             #define PERL_constant_ISSV 8
9             #define PERL_constant_ISUNDEF 9
10             #define PERL_constant_ISUV 10
11             #define PERL_constant_ISYES 11
12              
13             #ifndef NVTYPE
14             typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
15             #endif
16             #ifndef aTHX_
17             #define aTHX_ /* 5.6 or later define this for threading support. */
18             #endif
19             #ifndef pTHX_
20             #define pTHX_ /* 5.6 or later define this for threading support. */
21             #endif
22              
23             static int
24 3           constant_13 (pTHX_ const char *name, IV *iv_return) {
25             /* When generated this function returned values for the list of names given
26             here. However, subsequent manual editing may have added or removed some.
27             SPLICE_F_GIFT SPLICE_F_MORE SPLICE_F_MOVE */
28             /* Offset 11 gives the best switch position. */
29 3           switch (name[11]) {
30             case 'F':
31 1 50         if (memEQ(name, "SPLICE_F_GIFT", 13)) {
32             /* ^ */
33             #ifdef SPLICE_F_GIFT
34 1           *iv_return = SPLICE_F_GIFT;
35 1           return PERL_constant_ISIV;
36             #else
37             return PERL_constant_NOTDEF;
38             #endif
39             }
40 0           break;
41             case 'R':
42 1 50         if (memEQ(name, "SPLICE_F_MORE", 13)) {
43             /* ^ */
44             #ifdef SPLICE_F_MORE
45 1           *iv_return = SPLICE_F_MORE;
46 1           return PERL_constant_ISIV;
47             #else
48             return PERL_constant_NOTDEF;
49             #endif
50             }
51 0           break;
52             case 'V':
53 1 50         if (memEQ(name, "SPLICE_F_MOVE", 13)) {
54             /* ^ */
55             #ifdef SPLICE_F_MOVE
56 1           *iv_return = SPLICE_F_MOVE;
57 1           return PERL_constant_ISIV;
58             #else
59             return PERL_constant_NOTDEF;
60             #endif
61             }
62 0           break;
63             }
64 0           return PERL_constant_NOTFOUND;
65             }
66              
67             static int
68 4           constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
69             /* Initially switch on the length of the name. */
70             /* When generated this function returned values for the list of names given
71             in this section of perl code. Rather than manually editing these functions
72             to add or remove constants, which would result in this comment and section
73             of code becoming inaccurate, we recommend that you edit this section of
74             code, and use it to regenerate a new set of constant functions which you
75             then use to replace the originals.
76              
77             Regenerate these constant functions by feeding this entire source file to
78             perl -x
79              
80             #!/usr/local/bin/perl -w
81             use ExtUtils::Constant qw (constant_types C_constant XS_constant);
82              
83             my $types = {map {($_, 1)} qw(IV)};
84             my @names = (qw(SPLICE_F_GIFT SPLICE_F_MORE SPLICE_F_MOVE SPLICE_F_NONBLOCK));
85              
86             print constant_types(), "\n"; # macro defs
87             foreach (C_constant ("Linux::PipeMagic", 'constant', 'IV', $types, undef, 3, @names) ) {
88             print $_, "\n"; # C constant subs
89             }
90             print "\n#### XS Section:\n";
91             print XS_constant ("Linux::PipeMagic", $types);
92             __END__