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
14 typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
17 #define aTHX_ /* 5.6 or later define this for threading support. */
20 #define pTHX_ /* 5.6 or later define this for threading support. */
24 constant_7 (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 OS_CODE Z_ASCII Z_BLOCK Z_ERRNO Z_FIXED */
28 /* Offset 6 gives the best switch position. */
31 if (memEQ(name, "Z_FIXE", 6)) {
35 return PERL_constant_ISIV;
37 return PERL_constant_NOTDEF;
42 if (memEQ(name, "OS_COD", 6)) {
46 return PERL_constant_ISIV;
48 return PERL_constant_NOTDEF;
53 if (memEQ(name, "Z_ASCI", 6)) {
57 return PERL_constant_ISIV;
59 return PERL_constant_NOTDEF;
64 if (memEQ(name, "Z_BLOC", 6)) {
68 return PERL_constant_ISIV;
70 return PERL_constant_NOTDEF;
75 if (memEQ(name, "Z_ERRN", 6)) {
79 return PERL_constant_ISIV;
81 return PERL_constant_NOTDEF;
86 return PERL_constant_NOTFOUND;
90 constant_9 (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 DEF_WBITS MAX_WBITS Z_UNKNOWN */
94 /* Offset 2 gives the best switch position. */
97 if (memEQ(name, "DEF_WBITS", 9)) {
100 *iv_return = DEF_WBITS;
101 return PERL_constant_ISIV;
103 return PERL_constant_NOTDEF;
108 if (memEQ(name, "Z_UNKNOWN", 9)) {
111 *iv_return = Z_UNKNOWN;
112 return PERL_constant_ISIV;
114 return PERL_constant_NOTDEF;
119 if (memEQ(name, "MAX_WBITS", 9)) {
122 *iv_return = MAX_WBITS;
123 return PERL_constant_ISIV;
125 return PERL_constant_NOTDEF;
130 return PERL_constant_NOTFOUND;
134 constant_10 (pTHX_ const char *name, IV *iv_return) {
135 /* When generated this function returned values for the list of names given
136 here. However, subsequent manual editing may have added or removed some.
137 Z_DEFLATED Z_FILTERED Z_NO_FLUSH */
138 /* Offset 7 gives the best switch position. */
141 if (memEQ(name, "Z_FILTERED", 10)) {
144 *iv_return = Z_FILTERED;
145 return PERL_constant_ISIV;
147 return PERL_constant_NOTDEF;
152 if (memEQ(name, "Z_DEFLATED", 10)) {
155 *iv_return = Z_DEFLATED;
156 return PERL_constant_ISIV;
158 return PERL_constant_NOTDEF;
163 if (memEQ(name, "Z_NO_FLUSH", 10)) {
166 *iv_return = Z_NO_FLUSH;
167 return PERL_constant_ISIV;
169 return PERL_constant_NOTDEF;
174 return PERL_constant_NOTFOUND;
178 constant_11 (pTHX_ const char *name, IV *iv_return) {
179 /* When generated this function returned values for the list of names given
180 here. However, subsequent manual editing may have added or removed some.
181 Z_BUF_ERROR Z_MEM_ERROR Z_NEED_DICT */
182 /* Offset 4 gives the best switch position. */
185 if (memEQ(name, "Z_NEED_DICT", 11)) {
188 *iv_return = Z_NEED_DICT;
189 return PERL_constant_ISIV;
191 return PERL_constant_NOTDEF;
196 if (memEQ(name, "Z_BUF_ERROR", 11)) {
199 *iv_return = Z_BUF_ERROR;
200 return PERL_constant_ISIV;
202 return PERL_constant_NOTDEF;
207 if (memEQ(name, "Z_MEM_ERROR", 11)) {
210 *iv_return = Z_MEM_ERROR;
211 return PERL_constant_ISIV;
213 return PERL_constant_NOTDEF;
218 return PERL_constant_NOTFOUND;
222 constant_12 (pTHX_ const char *name, IV *iv_return, const char **pv_return) {
223 /* When generated this function returned values for the list of names given
224 here. However, subsequent manual editing may have added or removed some.
225 ZLIB_VERSION Z_BEST_SPEED Z_DATA_ERROR Z_FULL_FLUSH Z_STREAM_END
227 /* Offset 4 gives the best switch position. */
230 if (memEQ(name, "Z_FULL_FLUSH", 12)) {
233 *iv_return = Z_FULL_FLUSH;
234 return PERL_constant_ISIV;
236 return PERL_constant_NOTDEF;
241 if (memEQ(name, "Z_SYNC_FLUSH", 12)) {
244 *iv_return = Z_SYNC_FLUSH;
245 return PERL_constant_ISIV;
247 return PERL_constant_NOTDEF;
252 if (memEQ(name, "Z_STREAM_END", 12)) {
255 *iv_return = Z_STREAM_END;
256 return PERL_constant_ISIV;
258 return PERL_constant_NOTDEF;
263 if (memEQ(name, "Z_BEST_SPEED", 12)) {
266 *iv_return = Z_BEST_SPEED;
267 return PERL_constant_ISIV;
269 return PERL_constant_NOTDEF;
274 if (memEQ(name, "Z_DATA_ERROR", 12)) {
277 *iv_return = Z_DATA_ERROR;
278 return PERL_constant_ISIV;
280 return PERL_constant_NOTDEF;
285 if (memEQ(name, "ZLIB_VERSION", 12)) {
288 *pv_return = ZLIB_VERSION;
289 return PERL_constant_ISPV;
291 return PERL_constant_NOTDEF;
296 return PERL_constant_NOTFOUND;
300 constant (pTHX_ const char *name, STRLEN len, IV *iv_return, const char **pv_return) {
301 /* Initially switch on the length of the name. */
302 /* When generated this function returned values for the list of names given
303 in this section of perl code. Rather than manually editing these functions
304 to add or remove constants, which would result in this comment and section
305 of code becoming inaccurate, we recommend that you edit this section of
306 code, and use it to regenerate a new set of constant functions which you
307 then use to replace the originals.
309 Regenerate these constant functions by feeding this entire source file to
312 #!/usr/bin/perl5.8.6 -w
313 use ExtUtils::Constant qw (constant_types C_constant XS_constant);
315 my $types = {map {($_, 1)} qw(IV PV)};
316 my @names = (qw(DEF_WBITS MAX_MEM_LEVEL MAX_WBITS OS_CODE Z_ASCII
317 Z_BEST_COMPRESSION Z_BEST_SPEED Z_BINARY Z_BLOCK Z_BUF_ERROR
318 Z_DATA_ERROR Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY Z_DEFLATED
319 Z_ERRNO Z_FILTERED Z_FINISH Z_FIXED Z_FULL_FLUSH Z_HUFFMAN_ONLY
320 Z_MEM_ERROR Z_NEED_DICT Z_NO_COMPRESSION Z_NO_FLUSH Z_NULL Z_OK
321 Z_PARTIAL_FLUSH Z_RLE Z_STREAM_END Z_STREAM_ERROR Z_SYNC_FLUSH
322 Z_UNKNOWN Z_VERSION_ERROR),
323 {name=>"ZLIB_VERSION", type=>"PV"});
325 print constant_types(); # macro defs
326 foreach (C_constant ("Zlib", 'constant', 'IV', $types, undef, 3, @names) ) {
327 print $_, "\n"; # C constant subs
329 print "#### XS Section:\n";
330 print XS_constant ("Zlib", $types);
336 if (memEQ(name, "Z_OK", 4)) {
339 return PERL_constant_ISIV;
341 return PERL_constant_NOTDEF;
346 if (memEQ(name, "Z_RLE", 5)) {
349 return PERL_constant_ISIV;
351 return PERL_constant_NOTDEF;
356 if (memEQ(name, "Z_NULL", 6)) {
359 return PERL_constant_ISIV;
361 return PERL_constant_NOTDEF;
366 return constant_7 (aTHX_ name, iv_return);
369 /* Names all of length 8. */
370 /* Z_BINARY Z_FINISH */
371 /* Offset 6 gives the best switch position. */
374 if (memEQ(name, "Z_BINARY", 8)) {
377 *iv_return = Z_BINARY;
378 return PERL_constant_ISIV;
380 return PERL_constant_NOTDEF;
385 if (memEQ(name, "Z_FINISH", 8)) {
388 *iv_return = Z_FINISH;
389 return PERL_constant_ISIV;
391 return PERL_constant_NOTDEF;
398 return constant_9 (aTHX_ name, iv_return);
401 return constant_10 (aTHX_ name, iv_return);
404 return constant_11 (aTHX_ name, iv_return);
407 return constant_12 (aTHX_ name, iv_return, pv_return);
410 if (memEQ(name, "MAX_MEM_LEVEL", 13)) {
412 *iv_return = MAX_MEM_LEVEL;
413 return PERL_constant_ISIV;
415 return PERL_constant_NOTDEF;
420 /* Names all of length 14. */
421 /* Z_HUFFMAN_ONLY Z_STREAM_ERROR */
422 /* Offset 3 gives the best switch position. */
425 if (memEQ(name, "Z_STREAM_ERROR", 14)) {
427 #ifdef Z_STREAM_ERROR
428 *iv_return = Z_STREAM_ERROR;
429 return PERL_constant_ISIV;
431 return PERL_constant_NOTDEF;
436 if (memEQ(name, "Z_HUFFMAN_ONLY", 14)) {
438 #ifdef Z_HUFFMAN_ONLY
439 *iv_return = Z_HUFFMAN_ONLY;
440 return PERL_constant_ISIV;
442 return PERL_constant_NOTDEF;
449 /* Names all of length 15. */
450 /* Z_PARTIAL_FLUSH Z_VERSION_ERROR */
451 /* Offset 5 gives the best switch position. */
454 if (memEQ(name, "Z_VERSION_ERROR", 15)) {
456 #ifdef Z_VERSION_ERROR
457 *iv_return = Z_VERSION_ERROR;
458 return PERL_constant_ISIV;
460 return PERL_constant_NOTDEF;
465 if (memEQ(name, "Z_PARTIAL_FLUSH", 15)) {
467 #ifdef Z_PARTIAL_FLUSH
468 *iv_return = Z_PARTIAL_FLUSH;
469 return PERL_constant_ISIV;
471 return PERL_constant_NOTDEF;
478 if (memEQ(name, "Z_NO_COMPRESSION", 16)) {
479 #ifdef Z_NO_COMPRESSION
480 *iv_return = Z_NO_COMPRESSION;
481 return PERL_constant_ISIV;
483 return PERL_constant_NOTDEF;
488 /* Names all of length 18. */
489 /* Z_BEST_COMPRESSION Z_DEFAULT_STRATEGY */
490 /* Offset 14 gives the best switch position. */
493 if (memEQ(name, "Z_BEST_COMPRESSION", 18)) {
495 #ifdef Z_BEST_COMPRESSION
496 *iv_return = Z_BEST_COMPRESSION;
497 return PERL_constant_ISIV;
499 return PERL_constant_NOTDEF;
504 if (memEQ(name, "Z_DEFAULT_STRATEGY", 18)) {
506 #ifdef Z_DEFAULT_STRATEGY
507 *iv_return = Z_DEFAULT_STRATEGY;
508 return PERL_constant_ISIV;
510 return PERL_constant_NOTDEF;
517 if (memEQ(name, "Z_DEFAULT_COMPRESSION", 21)) {
518 #ifdef Z_DEFAULT_COMPRESSION
519 *iv_return = Z_DEFAULT_COMPRESSION;
520 return PERL_constant_ISIV;
522 return PERL_constant_NOTDEF;
527 return PERL_constant_NOTFOUND;