Commit | Line | Data |
bdb7fd9f |
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 | constant (pTHX_ const char *name, STRLEN len, IV *iv_return) { |
25 | /* Initially switch on the length of the name. */ |
26 | /* When generated this function returned values for the list of names given |
27 | in this section of perl code. Rather than manually editing these functions |
28 | to add or remove constants, which would result in this comment and section |
29 | of code becoming inaccurate, we recommend that you edit this section of |
30 | code, and use it to regenerate a new set of constant functions which you |
31 | then use to replace the originals. |
32 | |
33 | Regenerate these constant functions by feeding this entire source file to |
34 | perl -x |
35 | |
36 | #!/spare/local/perls/5.8.6/bin/perl5.8.6 -w |
37 | use ExtUtils::Constant qw (constant_types C_constant XS_constant); |
38 | |
39 | my $types = {map {($_, 1)} qw(IV)}; |
40 | my @names = (qw(BZ_CONFIG_ERROR BZ_DATA_ERROR BZ_DATA_ERROR_MAGIC BZ_FINISH |
41 | BZ_FINISH_OK BZ_FLUSH BZ_FLUSH_OK BZ_IO_ERROR BZ_MEM_ERROR BZ_OK |
42 | BZ_OUTBUFF_FULL BZ_PARAM_ERROR BZ_RUN BZ_RUN_OK |
43 | BZ_SEQUENCE_ERROR BZ_STREAM_END BZ_UNEXPECTED_EOF)); |
44 | |
45 | print constant_types(); # macro defs |
46 | foreach (C_constant ("Bzip2", 'constant', 'IV', $types, undef, 3, @names) ) { |
47 | print $_, "\n"; # C constant subs |
48 | } |
49 | print "#### XS Section:\n"; |
50 | print XS_constant ("Bzip2", $types); |
51 | __END__ |
52 | */ |
53 | |
54 | switch (len) { |
55 | case 5: |
56 | if (memEQ(name, "BZ_OK", 5)) { |
57 | #ifdef BZ_OK |
58 | *iv_return = BZ_OK; |
59 | return PERL_constant_ISIV; |
60 | #else |
61 | return PERL_constant_NOTDEF; |
62 | #endif |
63 | } |
64 | break; |
65 | case 6: |
66 | if (memEQ(name, "BZ_RUN", 6)) { |
67 | #ifdef BZ_RUN |
68 | *iv_return = BZ_RUN; |
69 | return PERL_constant_ISIV; |
70 | #else |
71 | return PERL_constant_NOTDEF; |
72 | #endif |
73 | } |
74 | break; |
75 | case 8: |
76 | if (memEQ(name, "BZ_FLUSH", 8)) { |
77 | #ifdef BZ_FLUSH |
78 | *iv_return = BZ_FLUSH; |
79 | return PERL_constant_ISIV; |
80 | #else |
81 | return PERL_constant_NOTDEF; |
82 | #endif |
83 | } |
84 | break; |
85 | case 9: |
86 | /* Names all of length 9. */ |
87 | /* BZ_FINISH BZ_RUN_OK */ |
88 | /* Offset 8 gives the best switch position. */ |
89 | switch (name[8]) { |
90 | case 'H': |
91 | if (memEQ(name, "BZ_FINIS", 8)) { |
92 | /* H */ |
93 | #ifdef BZ_FINISH |
94 | *iv_return = BZ_FINISH; |
95 | return PERL_constant_ISIV; |
96 | #else |
97 | return PERL_constant_NOTDEF; |
98 | #endif |
99 | } |
100 | break; |
101 | case 'K': |
102 | if (memEQ(name, "BZ_RUN_O", 8)) { |
103 | /* K */ |
104 | #ifdef BZ_RUN_OK |
105 | *iv_return = BZ_RUN_OK; |
106 | return PERL_constant_ISIV; |
107 | #else |
108 | return PERL_constant_NOTDEF; |
109 | #endif |
110 | } |
111 | break; |
112 | } |
113 | break; |
114 | case 11: |
115 | /* Names all of length 11. */ |
116 | /* BZ_FLUSH_OK BZ_IO_ERROR */ |
117 | /* Offset 3 gives the best switch position. */ |
118 | switch (name[3]) { |
119 | case 'F': |
120 | if (memEQ(name, "BZ_FLUSH_OK", 11)) { |
121 | /* ^ */ |
122 | #ifdef BZ_FLUSH_OK |
123 | *iv_return = BZ_FLUSH_OK; |
124 | return PERL_constant_ISIV; |
125 | #else |
126 | return PERL_constant_NOTDEF; |
127 | #endif |
128 | } |
129 | break; |
130 | case 'I': |
131 | if (memEQ(name, "BZ_IO_ERROR", 11)) { |
132 | /* ^ */ |
133 | #ifdef BZ_IO_ERROR |
134 | *iv_return = BZ_IO_ERROR; |
135 | return PERL_constant_ISIV; |
136 | #else |
137 | return PERL_constant_NOTDEF; |
138 | #endif |
139 | } |
140 | break; |
141 | } |
142 | break; |
143 | case 12: |
144 | /* Names all of length 12. */ |
145 | /* BZ_FINISH_OK BZ_MEM_ERROR */ |
146 | /* Offset 5 gives the best switch position. */ |
147 | switch (name[5]) { |
148 | case 'M': |
149 | if (memEQ(name, "BZ_MEM_ERROR", 12)) { |
150 | /* ^ */ |
151 | #ifdef BZ_MEM_ERROR |
152 | *iv_return = BZ_MEM_ERROR; |
153 | return PERL_constant_ISIV; |
154 | #else |
155 | return PERL_constant_NOTDEF; |
156 | #endif |
157 | } |
158 | break; |
159 | case 'N': |
160 | if (memEQ(name, "BZ_FINISH_OK", 12)) { |
161 | /* ^ */ |
162 | #ifdef BZ_FINISH_OK |
163 | *iv_return = BZ_FINISH_OK; |
164 | return PERL_constant_ISIV; |
165 | #else |
166 | return PERL_constant_NOTDEF; |
167 | #endif |
168 | } |
169 | break; |
170 | } |
171 | break; |
172 | case 13: |
173 | /* Names all of length 13. */ |
174 | /* BZ_DATA_ERROR BZ_STREAM_END */ |
175 | /* Offset 11 gives the best switch position. */ |
176 | switch (name[11]) { |
177 | case 'N': |
178 | if (memEQ(name, "BZ_STREAM_END", 13)) { |
179 | /* ^ */ |
180 | #ifdef BZ_STREAM_END |
181 | *iv_return = BZ_STREAM_END; |
182 | return PERL_constant_ISIV; |
183 | #else |
184 | return PERL_constant_NOTDEF; |
185 | #endif |
186 | } |
187 | break; |
188 | case 'O': |
189 | if (memEQ(name, "BZ_DATA_ERROR", 13)) { |
190 | /* ^ */ |
191 | #ifdef BZ_DATA_ERROR |
192 | *iv_return = BZ_DATA_ERROR; |
193 | return PERL_constant_ISIV; |
194 | #else |
195 | return PERL_constant_NOTDEF; |
196 | #endif |
197 | } |
198 | break; |
199 | } |
200 | break; |
201 | case 14: |
202 | if (memEQ(name, "BZ_PARAM_ERROR", 14)) { |
203 | #ifdef BZ_PARAM_ERROR |
204 | *iv_return = BZ_PARAM_ERROR; |
205 | return PERL_constant_ISIV; |
206 | #else |
207 | return PERL_constant_NOTDEF; |
208 | #endif |
209 | } |
210 | break; |
211 | case 15: |
212 | /* Names all of length 15. */ |
213 | /* BZ_CONFIG_ERROR BZ_OUTBUFF_FULL */ |
214 | /* Offset 8 gives the best switch position. */ |
215 | switch (name[8]) { |
216 | case 'F': |
217 | if (memEQ(name, "BZ_OUTBUFF_FULL", 15)) { |
218 | /* ^ */ |
219 | #ifdef BZ_OUTBUFF_FULL |
220 | *iv_return = BZ_OUTBUFF_FULL; |
221 | return PERL_constant_ISIV; |
222 | #else |
223 | return PERL_constant_NOTDEF; |
224 | #endif |
225 | } |
226 | break; |
227 | case 'G': |
228 | if (memEQ(name, "BZ_CONFIG_ERROR", 15)) { |
229 | /* ^ */ |
230 | #ifdef BZ_CONFIG_ERROR |
231 | *iv_return = BZ_CONFIG_ERROR; |
232 | return PERL_constant_ISIV; |
233 | #else |
234 | return PERL_constant_NOTDEF; |
235 | #endif |
236 | } |
237 | break; |
238 | } |
239 | break; |
240 | case 17: |
241 | /* Names all of length 17. */ |
242 | /* BZ_SEQUENCE_ERROR BZ_UNEXPECTED_EOF */ |
243 | /* Offset 12 gives the best switch position. */ |
244 | switch (name[12]) { |
245 | case 'D': |
246 | if (memEQ(name, "BZ_UNEXPECTED_EOF", 17)) { |
247 | /* ^ */ |
248 | #ifdef BZ_UNEXPECTED_EOF |
249 | *iv_return = BZ_UNEXPECTED_EOF; |
250 | return PERL_constant_ISIV; |
251 | #else |
252 | return PERL_constant_NOTDEF; |
253 | #endif |
254 | } |
255 | break; |
256 | case 'E': |
257 | if (memEQ(name, "BZ_SEQUENCE_ERROR", 17)) { |
258 | /* ^ */ |
259 | #ifdef BZ_SEQUENCE_ERROR |
260 | *iv_return = BZ_SEQUENCE_ERROR; |
261 | return PERL_constant_ISIV; |
262 | #else |
263 | return PERL_constant_NOTDEF; |
264 | #endif |
265 | } |
266 | break; |
267 | } |
268 | break; |
269 | case 19: |
270 | if (memEQ(name, "BZ_DATA_ERROR_MAGIC", 19)) { |
271 | #ifdef BZ_DATA_ERROR_MAGIC |
272 | *iv_return = BZ_DATA_ERROR_MAGIC; |
273 | return PERL_constant_ISIV; |
274 | #else |
275 | return PERL_constant_NOTDEF; |
276 | #endif |
277 | } |
278 | break; |
279 | } |
280 | return PERL_constant_NOTFOUND; |
281 | } |
282 | |