xref: /openbsd-src/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/fallback/constants.h (revision 898184e3e61f9129feb5978fad5a8c6865f00b92)
1b39c5158Smillert #define PERL_constant_NOTFOUND	1
2b39c5158Smillert #define PERL_constant_NOTDEF	2
3b39c5158Smillert #define PERL_constant_ISIV	3
4b39c5158Smillert #define PERL_constant_ISNO	4
5b39c5158Smillert #define PERL_constant_ISNV	5
6b39c5158Smillert #define PERL_constant_ISPV	6
7b39c5158Smillert #define PERL_constant_ISPVN	7
8b39c5158Smillert #define PERL_constant_ISSV	8
9b39c5158Smillert #define PERL_constant_ISUNDEF	9
10b39c5158Smillert #define PERL_constant_ISUV	10
11b39c5158Smillert #define PERL_constant_ISYES	11
12b39c5158Smillert 
13b39c5158Smillert #ifndef NVTYPE
14b39c5158Smillert typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it.  */
15b39c5158Smillert #endif
16b39c5158Smillert #ifndef aTHX_
17b39c5158Smillert #define aTHX_ /* 5.6 or later define this for threading support.  */
18b39c5158Smillert #endif
19b39c5158Smillert #ifndef pTHX_
20b39c5158Smillert #define pTHX_ /* 5.6 or later define this for threading support.  */
21b39c5158Smillert #endif
22b39c5158Smillert 
23b39c5158Smillert static int
constant_7(pTHX_ const char * name,IV * iv_return)24b39c5158Smillert constant_7 (pTHX_ const char *name, IV *iv_return) {
25b39c5158Smillert   /* When generated this function returned values for the list of names given
26b39c5158Smillert      here.  However, subsequent manual editing may have added or removed some.
27*898184e3Ssthen      OS_CODE Z_ASCII Z_BLOCK Z_ERRNO Z_FIXED Z_TREES */
28b39c5158Smillert   /* Offset 6 gives the best switch position.  */
29b39c5158Smillert   switch (name[6]) {
30b39c5158Smillert   case 'D':
31b39c5158Smillert     if (memEQ(name, "Z_FIXE", 6)) {
32b39c5158Smillert     /*                     D     */
33b39c5158Smillert #ifdef Z_FIXED
34b39c5158Smillert       *iv_return = Z_FIXED;
35b39c5158Smillert       return PERL_constant_ISIV;
36b39c5158Smillert #else
37b39c5158Smillert       return PERL_constant_NOTDEF;
38b39c5158Smillert #endif
39b39c5158Smillert     }
40b39c5158Smillert     break;
41b39c5158Smillert   case 'E':
42b39c5158Smillert     if (memEQ(name, "OS_COD", 6)) {
43b39c5158Smillert     /*                     E     */
44b39c5158Smillert #ifdef OS_CODE
45b39c5158Smillert       *iv_return = OS_CODE;
46b39c5158Smillert       return PERL_constant_ISIV;
47b39c5158Smillert #else
48b39c5158Smillert       return PERL_constant_NOTDEF;
49b39c5158Smillert #endif
50b39c5158Smillert     }
51b39c5158Smillert     break;
52b39c5158Smillert   case 'I':
53b39c5158Smillert     if (memEQ(name, "Z_ASCI", 6)) {
54b39c5158Smillert     /*                     I     */
55b39c5158Smillert #ifdef Z_ASCII
56b39c5158Smillert       *iv_return = Z_ASCII;
57b39c5158Smillert       return PERL_constant_ISIV;
58b39c5158Smillert #else
59b39c5158Smillert       return PERL_constant_NOTDEF;
60b39c5158Smillert #endif
61b39c5158Smillert     }
62b39c5158Smillert     break;
63b39c5158Smillert   case 'K':
64b39c5158Smillert     if (memEQ(name, "Z_BLOC", 6)) {
65b39c5158Smillert     /*                     K     */
66b39c5158Smillert #ifdef Z_BLOCK
67b39c5158Smillert       *iv_return = Z_BLOCK;
68b39c5158Smillert       return PERL_constant_ISIV;
69b39c5158Smillert #else
70b39c5158Smillert       return PERL_constant_NOTDEF;
71b39c5158Smillert #endif
72b39c5158Smillert     }
73b39c5158Smillert     break;
74b39c5158Smillert   case 'O':
75b39c5158Smillert     if (memEQ(name, "Z_ERRN", 6)) {
76b39c5158Smillert     /*                     O     */
77b39c5158Smillert #ifdef Z_ERRNO
78b39c5158Smillert       *iv_return = Z_ERRNO;
79b39c5158Smillert       return PERL_constant_ISIV;
80b39c5158Smillert #else
81b39c5158Smillert       return PERL_constant_NOTDEF;
82b39c5158Smillert #endif
83b39c5158Smillert     }
84b39c5158Smillert     break;
85*898184e3Ssthen   case 'S':
86*898184e3Ssthen     if (memEQ(name, "Z_TREE", 6)) {
87*898184e3Ssthen     /*                     S     */
88*898184e3Ssthen #if ZLIB_VERNUM >= 0x1240
89*898184e3Ssthen       *iv_return = Z_TREES;
90*898184e3Ssthen       return PERL_constant_ISIV;
91*898184e3Ssthen #else
92*898184e3Ssthen       return PERL_constant_NOTDEF;
93*898184e3Ssthen #endif
94*898184e3Ssthen     }
95*898184e3Ssthen     break;
96b39c5158Smillert   }
97b39c5158Smillert   return PERL_constant_NOTFOUND;
98b39c5158Smillert }
99b39c5158Smillert 
100b39c5158Smillert static int
constant_9(pTHX_ const char * name,IV * iv_return)101b39c5158Smillert constant_9 (pTHX_ const char *name, IV *iv_return) {
102b39c5158Smillert   /* When generated this function returned values for the list of names given
103b39c5158Smillert      here.  However, subsequent manual editing may have added or removed some.
104b39c5158Smillert      DEF_WBITS MAX_WBITS Z_UNKNOWN */
105b39c5158Smillert   /* Offset 2 gives the best switch position.  */
106b39c5158Smillert   switch (name[2]) {
107b39c5158Smillert   case 'F':
108b39c5158Smillert     if (memEQ(name, "DEF_WBITS", 9)) {
109b39c5158Smillert     /*                 ^            */
110b39c5158Smillert #ifdef DEF_WBITS
111b39c5158Smillert       *iv_return = DEF_WBITS;
112b39c5158Smillert       return PERL_constant_ISIV;
113b39c5158Smillert #else
114b39c5158Smillert       return PERL_constant_NOTDEF;
115b39c5158Smillert #endif
116b39c5158Smillert     }
117b39c5158Smillert     break;
118b39c5158Smillert   case 'U':
119b39c5158Smillert     if (memEQ(name, "Z_UNKNOWN", 9)) {
120b39c5158Smillert     /*                 ^            */
121b39c5158Smillert #ifdef Z_UNKNOWN
122b39c5158Smillert       *iv_return = Z_UNKNOWN;
123b39c5158Smillert       return PERL_constant_ISIV;
124b39c5158Smillert #else
125b39c5158Smillert       return PERL_constant_NOTDEF;
126b39c5158Smillert #endif
127b39c5158Smillert     }
128b39c5158Smillert     break;
129b39c5158Smillert   case 'X':
130b39c5158Smillert     if (memEQ(name, "MAX_WBITS", 9)) {
131b39c5158Smillert     /*                 ^            */
132b39c5158Smillert #ifdef MAX_WBITS
133b39c5158Smillert       *iv_return = MAX_WBITS;
134b39c5158Smillert       return PERL_constant_ISIV;
135b39c5158Smillert #else
136b39c5158Smillert       return PERL_constant_NOTDEF;
137b39c5158Smillert #endif
138b39c5158Smillert     }
139b39c5158Smillert     break;
140b39c5158Smillert   }
141b39c5158Smillert   return PERL_constant_NOTFOUND;
142b39c5158Smillert }
143b39c5158Smillert 
144b39c5158Smillert static int
constant_10(pTHX_ const char * name,IV * iv_return)145b39c5158Smillert constant_10 (pTHX_ const char *name, IV *iv_return) {
146b39c5158Smillert   /* When generated this function returned values for the list of names given
147b39c5158Smillert      here.  However, subsequent manual editing may have added or removed some.
148b39c5158Smillert      Z_DEFLATED Z_FILTERED Z_NO_FLUSH */
149b39c5158Smillert   /* Offset 7 gives the best switch position.  */
150b39c5158Smillert   switch (name[7]) {
151b39c5158Smillert   case 'R':
152b39c5158Smillert     if (memEQ(name, "Z_FILTERED", 10)) {
153b39c5158Smillert     /*                      ^         */
154b39c5158Smillert #ifdef Z_FILTERED
155b39c5158Smillert       *iv_return = Z_FILTERED;
156b39c5158Smillert       return PERL_constant_ISIV;
157b39c5158Smillert #else
158b39c5158Smillert       return PERL_constant_NOTDEF;
159b39c5158Smillert #endif
160b39c5158Smillert     }
161b39c5158Smillert     break;
162b39c5158Smillert   case 'T':
163b39c5158Smillert     if (memEQ(name, "Z_DEFLATED", 10)) {
164b39c5158Smillert     /*                      ^         */
165b39c5158Smillert #ifdef Z_DEFLATED
166b39c5158Smillert       *iv_return = Z_DEFLATED;
167b39c5158Smillert       return PERL_constant_ISIV;
168b39c5158Smillert #else
169b39c5158Smillert       return PERL_constant_NOTDEF;
170b39c5158Smillert #endif
171b39c5158Smillert     }
172b39c5158Smillert     break;
173b39c5158Smillert   case 'U':
174b39c5158Smillert     if (memEQ(name, "Z_NO_FLUSH", 10)) {
175b39c5158Smillert     /*                      ^         */
176b39c5158Smillert #ifdef Z_NO_FLUSH
177b39c5158Smillert       *iv_return = Z_NO_FLUSH;
178b39c5158Smillert       return PERL_constant_ISIV;
179b39c5158Smillert #else
180b39c5158Smillert       return PERL_constant_NOTDEF;
181b39c5158Smillert #endif
182b39c5158Smillert     }
183b39c5158Smillert     break;
184b39c5158Smillert   }
185b39c5158Smillert   return PERL_constant_NOTFOUND;
186b39c5158Smillert }
187b39c5158Smillert 
188b39c5158Smillert static int
constant_11(pTHX_ const char * name,IV * iv_return)189b39c5158Smillert constant_11 (pTHX_ const char *name, IV *iv_return) {
190b39c5158Smillert   /* When generated this function returned values for the list of names given
191b39c5158Smillert      here.  However, subsequent manual editing may have added or removed some.
192b39c5158Smillert      Z_BUF_ERROR Z_MEM_ERROR Z_NEED_DICT */
193b39c5158Smillert   /* Offset 4 gives the best switch position.  */
194b39c5158Smillert   switch (name[4]) {
195b39c5158Smillert   case 'E':
196b39c5158Smillert     if (memEQ(name, "Z_NEED_DICT", 11)) {
197b39c5158Smillert     /*                   ^             */
198b39c5158Smillert #ifdef Z_NEED_DICT
199b39c5158Smillert       *iv_return = Z_NEED_DICT;
200b39c5158Smillert       return PERL_constant_ISIV;
201b39c5158Smillert #else
202b39c5158Smillert       return PERL_constant_NOTDEF;
203b39c5158Smillert #endif
204b39c5158Smillert     }
205b39c5158Smillert     break;
206b39c5158Smillert   case 'F':
207b39c5158Smillert     if (memEQ(name, "Z_BUF_ERROR", 11)) {
208b39c5158Smillert     /*                   ^             */
209b39c5158Smillert #ifdef Z_BUF_ERROR
210b39c5158Smillert       *iv_return = Z_BUF_ERROR;
211b39c5158Smillert       return PERL_constant_ISIV;
212b39c5158Smillert #else
213b39c5158Smillert       return PERL_constant_NOTDEF;
214b39c5158Smillert #endif
215b39c5158Smillert     }
216b39c5158Smillert     break;
217b39c5158Smillert   case 'M':
218b39c5158Smillert     if (memEQ(name, "Z_MEM_ERROR", 11)) {
219b39c5158Smillert     /*                   ^             */
220b39c5158Smillert #ifdef Z_MEM_ERROR
221b39c5158Smillert       *iv_return = Z_MEM_ERROR;
222b39c5158Smillert       return PERL_constant_ISIV;
223b39c5158Smillert #else
224b39c5158Smillert       return PERL_constant_NOTDEF;
225b39c5158Smillert #endif
226b39c5158Smillert     }
227b39c5158Smillert     break;
228b39c5158Smillert   }
229b39c5158Smillert   return PERL_constant_NOTFOUND;
230b39c5158Smillert }
231b39c5158Smillert 
232b39c5158Smillert static int
constant_12(pTHX_ const char * name,IV * iv_return,const char ** pv_return)233b39c5158Smillert constant_12 (pTHX_ const char *name, IV *iv_return, const char **pv_return) {
234b39c5158Smillert   /* When generated this function returned values for the list of names given
235b39c5158Smillert      here.  However, subsequent manual editing may have added or removed some.
236b39c5158Smillert      ZLIB_VERSION Z_BEST_SPEED Z_DATA_ERROR Z_FULL_FLUSH Z_STREAM_END
237b39c5158Smillert      Z_SYNC_FLUSH */
238b39c5158Smillert   /* Offset 4 gives the best switch position.  */
239b39c5158Smillert   switch (name[4]) {
240b39c5158Smillert   case 'L':
241b39c5158Smillert     if (memEQ(name, "Z_FULL_FLUSH", 12)) {
242b39c5158Smillert     /*                   ^              */
243b39c5158Smillert #ifdef Z_FULL_FLUSH
244b39c5158Smillert       *iv_return = Z_FULL_FLUSH;
245b39c5158Smillert       return PERL_constant_ISIV;
246b39c5158Smillert #else
247b39c5158Smillert       return PERL_constant_NOTDEF;
248b39c5158Smillert #endif
249b39c5158Smillert     }
250b39c5158Smillert     break;
251b39c5158Smillert   case 'N':
252b39c5158Smillert     if (memEQ(name, "Z_SYNC_FLUSH", 12)) {
253b39c5158Smillert     /*                   ^              */
254b39c5158Smillert #ifdef Z_SYNC_FLUSH
255b39c5158Smillert       *iv_return = Z_SYNC_FLUSH;
256b39c5158Smillert       return PERL_constant_ISIV;
257b39c5158Smillert #else
258b39c5158Smillert       return PERL_constant_NOTDEF;
259b39c5158Smillert #endif
260b39c5158Smillert     }
261b39c5158Smillert     break;
262b39c5158Smillert   case 'R':
263b39c5158Smillert     if (memEQ(name, "Z_STREAM_END", 12)) {
264b39c5158Smillert     /*                   ^              */
265b39c5158Smillert #ifdef Z_STREAM_END
266b39c5158Smillert       *iv_return = Z_STREAM_END;
267b39c5158Smillert       return PERL_constant_ISIV;
268b39c5158Smillert #else
269b39c5158Smillert       return PERL_constant_NOTDEF;
270b39c5158Smillert #endif
271b39c5158Smillert     }
272b39c5158Smillert     break;
273b39c5158Smillert   case 'S':
274b39c5158Smillert     if (memEQ(name, "Z_BEST_SPEED", 12)) {
275b39c5158Smillert     /*                   ^              */
276b39c5158Smillert #ifdef Z_BEST_SPEED
277b39c5158Smillert       *iv_return = Z_BEST_SPEED;
278b39c5158Smillert       return PERL_constant_ISIV;
279b39c5158Smillert #else
280b39c5158Smillert       return PERL_constant_NOTDEF;
281b39c5158Smillert #endif
282b39c5158Smillert     }
283b39c5158Smillert     break;
284b39c5158Smillert   case 'T':
285b39c5158Smillert     if (memEQ(name, "Z_DATA_ERROR", 12)) {
286b39c5158Smillert     /*                   ^              */
287b39c5158Smillert #ifdef Z_DATA_ERROR
288b39c5158Smillert       *iv_return = Z_DATA_ERROR;
289b39c5158Smillert       return PERL_constant_ISIV;
290b39c5158Smillert #else
291b39c5158Smillert       return PERL_constant_NOTDEF;
292b39c5158Smillert #endif
293b39c5158Smillert     }
294b39c5158Smillert     break;
295b39c5158Smillert   case '_':
296b39c5158Smillert     if (memEQ(name, "ZLIB_VERSION", 12)) {
297b39c5158Smillert     /*                   ^              */
298b39c5158Smillert #ifdef ZLIB_VERSION
299b39c5158Smillert       *pv_return = ZLIB_VERSION;
300b39c5158Smillert       return PERL_constant_ISPV;
301b39c5158Smillert #else
302b39c5158Smillert       return PERL_constant_NOTDEF;
303b39c5158Smillert #endif
304b39c5158Smillert     }
305b39c5158Smillert     break;
306b39c5158Smillert   }
307b39c5158Smillert   return PERL_constant_NOTFOUND;
308b39c5158Smillert }
309b39c5158Smillert 
310b39c5158Smillert static int
constant(pTHX_ const char * name,STRLEN len,IV * iv_return,const char ** pv_return)311b39c5158Smillert constant (pTHX_ const char *name, STRLEN len, IV *iv_return, const char **pv_return) {
312b39c5158Smillert   /* Initially switch on the length of the name.  */
313b39c5158Smillert   /* When generated this function returned values for the list of names given
314b39c5158Smillert      in this section of perl code.  Rather than manually editing these functions
315b39c5158Smillert      to add or remove constants, which would result in this comment and section
316b39c5158Smillert      of code becoming inaccurate, we recommend that you edit this section of
317b39c5158Smillert      code, and use it to regenerate a new set of constant functions which you
318b39c5158Smillert      then use to replace the originals.
319b39c5158Smillert 
320b39c5158Smillert      Regenerate these constant functions by feeding this entire source file to
321b39c5158Smillert      perl -x
322b39c5158Smillert 
323*898184e3Ssthen #!/linux-shared/base/perl/install/bin/perl -w
324b39c5158Smillert use ExtUtils::Constant qw (constant_types C_constant XS_constant);
325b39c5158Smillert 
326b39c5158Smillert my $types = {map {($_, 1)} qw(IV PV)};
327b39c5158Smillert my @names = (qw(DEF_WBITS MAX_MEM_LEVEL MAX_WBITS OS_CODE Z_ASCII
328b39c5158Smillert 	       Z_BEST_COMPRESSION Z_BEST_SPEED Z_BINARY Z_BLOCK Z_BUF_ERROR
329b39c5158Smillert 	       Z_DATA_ERROR Z_DEFAULT_COMPRESSION Z_DEFAULT_STRATEGY Z_DEFLATED
330b39c5158Smillert 	       Z_ERRNO Z_FILTERED Z_FINISH Z_FIXED Z_FULL_FLUSH Z_HUFFMAN_ONLY
331b39c5158Smillert 	       Z_MEM_ERROR Z_NEED_DICT Z_NO_COMPRESSION Z_NO_FLUSH Z_NULL Z_OK
332b39c5158Smillert 	       Z_PARTIAL_FLUSH Z_RLE Z_STREAM_END Z_STREAM_ERROR Z_SYNC_FLUSH
333b39c5158Smillert 	       Z_UNKNOWN Z_VERSION_ERROR),
334*898184e3Ssthen             {name=>"ZLIB_VERSION", type=>"PV"},
335*898184e3Ssthen             {name=>"Z_TREES", type=>"IV", macro=>["#if ZLIB_VERNUM >= 0x1240\n", "#endif\n"]});
336b39c5158Smillert 
337*898184e3Ssthen print constant_types(), "\n"; # macro defs
338b39c5158Smillert foreach (C_constant ("Zlib", 'constant', 'IV', $types, undef, 3, @names) ) {
339b39c5158Smillert     print $_, "\n"; # C constant subs
340b39c5158Smillert }
341*898184e3Ssthen print "\n#### XS Section:\n";
342b39c5158Smillert print XS_constant ("Zlib", $types);
343b39c5158Smillert __END__
344b39c5158Smillert    */
345b39c5158Smillert 
346b39c5158Smillert   switch (len) {
347b39c5158Smillert   case 4:
348b39c5158Smillert     if (memEQ(name, "Z_OK", 4)) {
349b39c5158Smillert #ifdef Z_OK
350b39c5158Smillert       *iv_return = Z_OK;
351b39c5158Smillert       return PERL_constant_ISIV;
352b39c5158Smillert #else
353b39c5158Smillert       return PERL_constant_NOTDEF;
354b39c5158Smillert #endif
355b39c5158Smillert     }
356b39c5158Smillert     break;
357b39c5158Smillert   case 5:
358b39c5158Smillert     if (memEQ(name, "Z_RLE", 5)) {
359b39c5158Smillert #ifdef Z_RLE
360b39c5158Smillert       *iv_return = Z_RLE;
361b39c5158Smillert       return PERL_constant_ISIV;
362b39c5158Smillert #else
363b39c5158Smillert       return PERL_constant_NOTDEF;
364b39c5158Smillert #endif
365b39c5158Smillert     }
366b39c5158Smillert     break;
367b39c5158Smillert   case 6:
368b39c5158Smillert     if (memEQ(name, "Z_NULL", 6)) {
369b39c5158Smillert #ifdef Z_NULL
370b39c5158Smillert       *iv_return = Z_NULL;
371b39c5158Smillert       return PERL_constant_ISIV;
372b39c5158Smillert #else
373b39c5158Smillert       return PERL_constant_NOTDEF;
374b39c5158Smillert #endif
375b39c5158Smillert     }
376b39c5158Smillert     break;
377b39c5158Smillert   case 7:
378b39c5158Smillert     return constant_7 (aTHX_ name, iv_return);
379b39c5158Smillert     break;
380b39c5158Smillert   case 8:
381b39c5158Smillert     /* Names all of length 8.  */
382b39c5158Smillert     /* Z_BINARY Z_FINISH */
383b39c5158Smillert     /* Offset 6 gives the best switch position.  */
384b39c5158Smillert     switch (name[6]) {
385b39c5158Smillert     case 'R':
386b39c5158Smillert       if (memEQ(name, "Z_BINARY", 8)) {
387b39c5158Smillert       /*                     ^       */
388b39c5158Smillert #ifdef Z_BINARY
389b39c5158Smillert         *iv_return = Z_BINARY;
390b39c5158Smillert         return PERL_constant_ISIV;
391b39c5158Smillert #else
392b39c5158Smillert         return PERL_constant_NOTDEF;
393b39c5158Smillert #endif
394b39c5158Smillert       }
395b39c5158Smillert       break;
396b39c5158Smillert     case 'S':
397b39c5158Smillert       if (memEQ(name, "Z_FINISH", 8)) {
398b39c5158Smillert       /*                     ^       */
399b39c5158Smillert #ifdef Z_FINISH
400b39c5158Smillert         *iv_return = Z_FINISH;
401b39c5158Smillert         return PERL_constant_ISIV;
402b39c5158Smillert #else
403b39c5158Smillert         return PERL_constant_NOTDEF;
404b39c5158Smillert #endif
405b39c5158Smillert       }
406b39c5158Smillert       break;
407b39c5158Smillert     }
408b39c5158Smillert     break;
409b39c5158Smillert   case 9:
410b39c5158Smillert     return constant_9 (aTHX_ name, iv_return);
411b39c5158Smillert     break;
412b39c5158Smillert   case 10:
413b39c5158Smillert     return constant_10 (aTHX_ name, iv_return);
414b39c5158Smillert     break;
415b39c5158Smillert   case 11:
416b39c5158Smillert     return constant_11 (aTHX_ name, iv_return);
417b39c5158Smillert     break;
418b39c5158Smillert   case 12:
419b39c5158Smillert     return constant_12 (aTHX_ name, iv_return, pv_return);
420b39c5158Smillert     break;
421b39c5158Smillert   case 13:
422b39c5158Smillert     if (memEQ(name, "MAX_MEM_LEVEL", 13)) {
423b39c5158Smillert #ifdef MAX_MEM_LEVEL
424b39c5158Smillert       *iv_return = MAX_MEM_LEVEL;
425b39c5158Smillert       return PERL_constant_ISIV;
426b39c5158Smillert #else
427b39c5158Smillert       return PERL_constant_NOTDEF;
428b39c5158Smillert #endif
429b39c5158Smillert     }
430b39c5158Smillert     break;
431b39c5158Smillert   case 14:
432b39c5158Smillert     /* Names all of length 14.  */
433b39c5158Smillert     /* Z_HUFFMAN_ONLY Z_STREAM_ERROR */
434b39c5158Smillert     /* Offset 3 gives the best switch position.  */
435b39c5158Smillert     switch (name[3]) {
436b39c5158Smillert     case 'T':
437b39c5158Smillert       if (memEQ(name, "Z_STREAM_ERROR", 14)) {
438b39c5158Smillert       /*                  ^                 */
439b39c5158Smillert #ifdef Z_STREAM_ERROR
440b39c5158Smillert         *iv_return = Z_STREAM_ERROR;
441b39c5158Smillert         return PERL_constant_ISIV;
442b39c5158Smillert #else
443b39c5158Smillert         return PERL_constant_NOTDEF;
444b39c5158Smillert #endif
445b39c5158Smillert       }
446b39c5158Smillert       break;
447b39c5158Smillert     case 'U':
448b39c5158Smillert       if (memEQ(name, "Z_HUFFMAN_ONLY", 14)) {
449b39c5158Smillert       /*                  ^                 */
450b39c5158Smillert #ifdef Z_HUFFMAN_ONLY
451b39c5158Smillert         *iv_return = Z_HUFFMAN_ONLY;
452b39c5158Smillert         return PERL_constant_ISIV;
453b39c5158Smillert #else
454b39c5158Smillert         return PERL_constant_NOTDEF;
455b39c5158Smillert #endif
456b39c5158Smillert       }
457b39c5158Smillert       break;
458b39c5158Smillert     }
459b39c5158Smillert     break;
460b39c5158Smillert   case 15:
461b39c5158Smillert     /* Names all of length 15.  */
462b39c5158Smillert     /* Z_PARTIAL_FLUSH Z_VERSION_ERROR */
463b39c5158Smillert     /* Offset 5 gives the best switch position.  */
464b39c5158Smillert     switch (name[5]) {
465b39c5158Smillert     case 'S':
466b39c5158Smillert       if (memEQ(name, "Z_VERSION_ERROR", 15)) {
467b39c5158Smillert       /*                    ^                */
468b39c5158Smillert #ifdef Z_VERSION_ERROR
469b39c5158Smillert         *iv_return = Z_VERSION_ERROR;
470b39c5158Smillert         return PERL_constant_ISIV;
471b39c5158Smillert #else
472b39c5158Smillert         return PERL_constant_NOTDEF;
473b39c5158Smillert #endif
474b39c5158Smillert       }
475b39c5158Smillert       break;
476b39c5158Smillert     case 'T':
477b39c5158Smillert       if (memEQ(name, "Z_PARTIAL_FLUSH", 15)) {
478b39c5158Smillert       /*                    ^                */
479b39c5158Smillert #ifdef Z_PARTIAL_FLUSH
480b39c5158Smillert         *iv_return = Z_PARTIAL_FLUSH;
481b39c5158Smillert         return PERL_constant_ISIV;
482b39c5158Smillert #else
483b39c5158Smillert         return PERL_constant_NOTDEF;
484b39c5158Smillert #endif
485b39c5158Smillert       }
486b39c5158Smillert       break;
487b39c5158Smillert     }
488b39c5158Smillert     break;
489b39c5158Smillert   case 16:
490b39c5158Smillert     if (memEQ(name, "Z_NO_COMPRESSION", 16)) {
491b39c5158Smillert #ifdef Z_NO_COMPRESSION
492b39c5158Smillert       *iv_return = Z_NO_COMPRESSION;
493b39c5158Smillert       return PERL_constant_ISIV;
494b39c5158Smillert #else
495b39c5158Smillert       return PERL_constant_NOTDEF;
496b39c5158Smillert #endif
497b39c5158Smillert     }
498b39c5158Smillert     break;
499b39c5158Smillert   case 18:
500b39c5158Smillert     /* Names all of length 18.  */
501b39c5158Smillert     /* Z_BEST_COMPRESSION Z_DEFAULT_STRATEGY */
502b39c5158Smillert     /* Offset 14 gives the best switch position.  */
503b39c5158Smillert     switch (name[14]) {
504b39c5158Smillert     case 'S':
505b39c5158Smillert       if (memEQ(name, "Z_BEST_COMPRESSION", 18)) {
506b39c5158Smillert       /*                             ^          */
507b39c5158Smillert #ifdef Z_BEST_COMPRESSION
508b39c5158Smillert         *iv_return = Z_BEST_COMPRESSION;
509b39c5158Smillert         return PERL_constant_ISIV;
510b39c5158Smillert #else
511b39c5158Smillert         return PERL_constant_NOTDEF;
512b39c5158Smillert #endif
513b39c5158Smillert       }
514b39c5158Smillert       break;
515b39c5158Smillert     case 'T':
516b39c5158Smillert       if (memEQ(name, "Z_DEFAULT_STRATEGY", 18)) {
517b39c5158Smillert       /*                             ^          */
518b39c5158Smillert #ifdef Z_DEFAULT_STRATEGY
519b39c5158Smillert         *iv_return = Z_DEFAULT_STRATEGY;
520b39c5158Smillert         return PERL_constant_ISIV;
521b39c5158Smillert #else
522b39c5158Smillert         return PERL_constant_NOTDEF;
523b39c5158Smillert #endif
524b39c5158Smillert       }
525b39c5158Smillert       break;
526b39c5158Smillert     }
527b39c5158Smillert     break;
528b39c5158Smillert   case 21:
529b39c5158Smillert     if (memEQ(name, "Z_DEFAULT_COMPRESSION", 21)) {
530b39c5158Smillert #ifdef Z_DEFAULT_COMPRESSION
531b39c5158Smillert       *iv_return = Z_DEFAULT_COMPRESSION;
532b39c5158Smillert       return PERL_constant_ISIV;
533b39c5158Smillert #else
534b39c5158Smillert       return PERL_constant_NOTDEF;
535b39c5158Smillert #endif
536b39c5158Smillert     }
537b39c5158Smillert     break;
538b39c5158Smillert   }
539b39c5158Smillert   return PERL_constant_NOTFOUND;
540b39c5158Smillert }
541b39c5158Smillert 
542