File Coverage

const-c-error.inc
Criterion Covered Total %
statement 78 107 72.9
branch 22 44 50.0
condition n/a
subroutine n/a
pod n/a
total 100 151 66.2


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 5           _error_constant_8 (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             EMSGSIZE EMTHREAD ENETDOWN ENOTCONN ENOTSOCK */
28             /* Offset 6 gives the best switch position. */
29 5           switch (name[6]) {
30             case 'A':
31 1 50         if (memEQ(name, "EMTHREAD", 8)) {
32             /* ^ */
33             #ifdef EMTHREAD
34 1           *iv_return = EMTHREAD;
35 1           return PERL_constant_ISIV;
36             #else
37             return PERL_constant_NOTDEF;
38             #endif
39             }
40 0           break;
41             case 'C':
42 1 50         if (memEQ(name, "ENOTSOCK", 8)) {
43             /* ^ */
44             #ifdef ENOTSOCK
45 1           *iv_return = ENOTSOCK;
46 1           return PERL_constant_ISIV;
47             #else
48             return PERL_constant_NOTDEF;
49             #endif
50             }
51 0           break;
52             case 'N':
53 1 50         if (memEQ(name, "ENOTCONN", 8)) {
54             /* ^ */
55             #ifdef ENOTCONN
56 1           *iv_return = ENOTCONN;
57 1           return PERL_constant_ISIV;
58             #else
59             return PERL_constant_NOTDEF;
60             #endif
61             }
62 0           break;
63             case 'W':
64 1 50         if (memEQ(name, "ENETDOWN", 8)) {
65             /* ^ */
66             #ifdef ENETDOWN
67 1           *iv_return = ENETDOWN;
68 1           return PERL_constant_ISIV;
69             #else
70             return PERL_constant_NOTDEF;
71             #endif
72             }
73 0           break;
74             case 'Z':
75 1 50         if (memEQ(name, "EMSGSIZE", 8)) {
76             /* ^ */
77             #ifdef EMSGSIZE
78 1           *iv_return = EMSGSIZE;
79 1           return PERL_constant_ISIV;
80             #else
81             return PERL_constant_NOTDEF;
82             #endif
83             }
84 0           break;
85             }
86 0           return PERL_constant_NOTFOUND;
87             }
88              
89             static int
90 4           _error_constant_12 (pTHX_ const char *name, IV *iv_return) {
91             /* When generated this function returned values for the list of names given
92             here. However, subsequent manual editing may have added or removed some.
93             EAFNOSUPPORT ECONNABORTED ECONNREFUSED EHOSTUNREACH */
94             /* Offset 7 gives the best switch position. */
95 4           switch (name[7]) {
96             case 'F':
97 1 50         if (memEQ(name, "ECONNREFUSED", 12)) {
98             /* ^ */
99             #ifdef ECONNREFUSED
100 1           *iv_return = ECONNREFUSED;
101 1           return PERL_constant_ISIV;
102             #else
103             return PERL_constant_NOTDEF;
104             #endif
105             }
106 0           break;
107             case 'O':
108 1 50         if (memEQ(name, "ECONNABORTED", 12)) {
109             /* ^ */
110             #ifdef ECONNABORTED
111 1           *iv_return = ECONNABORTED;
112 1           return PERL_constant_ISIV;
113             #else
114             return PERL_constant_NOTDEF;
115             #endif
116             }
117 0           break;
118             case 'P':
119 1 50         if (memEQ(name, "EAFNOSUPPORT", 12)) {
120             /* ^ */
121             #ifdef EAFNOSUPPORT
122 1           *iv_return = EAFNOSUPPORT;
123 1           return PERL_constant_ISIV;
124             #else
125             return PERL_constant_NOTDEF;
126             #endif
127             }
128 0           break;
129             case 'R':
130 1 50         if (memEQ(name, "EHOSTUNREACH", 12)) {
131             /* ^ */
132             #ifdef EHOSTUNREACH
133 1           *iv_return = EHOSTUNREACH;
134 1           return PERL_constant_ISIV;
135             #else
136             return PERL_constant_NOTDEF;
137             #endif
138             }
139 0           break;
140             }
141 0           return PERL_constant_NOTFOUND;
142             }
143              
144             static int
145 23           _error_constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
146             /* Initially switch on the length of the name. */
147             /* When generated this function returned values for the list of names given
148             in this section of perl code. Rather than manually editing these functions
149             to add or remove constants, which would result in this comment and section
150             of code becoming inaccurate, we recommend that you edit this section of
151             code, and use it to regenerate a new set of constant functions which you
152             then use to replace the originals.
153              
154             Regenerate these constant functions by feeding this entire source file to
155             perl -x
156              
157             #!/usr/local/bin/perl -w
158             use ExtUtils::Constant qw (constant_types C_constant XS_constant);
159              
160             my $types = {map {($_, 1)} qw(IV)};
161             my @names = (qw(EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT ECONNABORTED ECONNREFUSED
162             ECONNRESET EFSM EHOSTUNREACH EINPROGRESS EMSGSIZE EMTHREAD
163             ENETDOWN ENETRESET ENETUNREACH ENOBUFS ENOCOMPATPROTO ENOTCONN
164             ENOTSOCK ENOTSUP EPROTONOSUPPORT ETERM ETIMEDOUT));
165              
166             print constant_types(), "\n"; # macro defs
167             foreach (C_constant ("ZMQ::Raw::Error", '_error_constant', 'IV', $types, undef, 3, @names) ) {
168             print $_, "\n"; # C constant subs
169             }
170             print "\n#### XS Section:\n";
171             print XS_constant ("ZMQ::Raw::Error", $types);
172             __END__