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
14typedef 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
23static int
24constant_6 (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     DB_TXN R_LAST R_NEXT R_PREV */
28  /* Offset 2 gives the best switch position.  */
29  switch (name[2]) {
30  case 'L':
31    if (memEQ(name, "R_LAST", 6)) {
32    /*                 ^         */
33#ifdef R_LAST
34      *iv_return = R_LAST;
35      return PERL_constant_ISIV;
36#else
37      return PERL_constant_NOTDEF;
38#endif
39    }
40    break;
41  case 'N':
42    if (memEQ(name, "R_NEXT", 6)) {
43    /*                 ^         */
44#ifdef R_NEXT
45      *iv_return = R_NEXT;
46      return PERL_constant_ISIV;
47#else
48      return PERL_constant_NOTDEF;
49#endif
50    }
51    break;
52  case 'P':
53    if (memEQ(name, "R_PREV", 6)) {
54    /*                 ^         */
55#ifdef R_PREV
56      *iv_return = R_PREV;
57      return PERL_constant_ISIV;
58#else
59      return PERL_constant_NOTDEF;
60#endif
61    }
62    break;
63  case '_':
64    if (memEQ(name, "DB_TXN", 6)) {
65    /*                 ^         */
66#ifdef DB_TXN
67      *iv_return = DB_TXN;
68      return PERL_constant_ISIV;
69#else
70      return PERL_constant_NOTDEF;
71#endif
72    }
73    break;
74  }
75  return PERL_constant_NOTFOUND;
76}
77
78static int
79constant_7 (pTHX_ const char *name, IV *iv_return) {
80  /* When generated this function returned values for the list of names given
81     here.  However, subsequent manual editing may have added or removed some.
82     DB_LOCK R_FIRST R_NOKEY */
83  /* Offset 3 gives the best switch position.  */
84  switch (name[3]) {
85  case 'I':
86    if (memEQ(name, "R_FIRST", 7)) {
87    /*                  ^         */
88#ifdef R_FIRST
89      *iv_return = R_FIRST;
90      return PERL_constant_ISIV;
91#else
92      return PERL_constant_NOTDEF;
93#endif
94    }
95    break;
96  case 'L':
97    if (memEQ(name, "DB_LOCK", 7)) {
98    /*                  ^         */
99#ifdef DB_LOCK
100      *iv_return = DB_LOCK;
101      return PERL_constant_ISIV;
102#else
103      return PERL_constant_NOTDEF;
104#endif
105    }
106    break;
107  case 'O':
108    if (memEQ(name, "R_NOKEY", 7)) {
109    /*                  ^         */
110#ifdef R_NOKEY
111      *iv_return = R_NOKEY;
112      return PERL_constant_ISIV;
113#else
114      return PERL_constant_NOTDEF;
115#endif
116    }
117    break;
118  }
119  return PERL_constant_NOTFOUND;
120}
121
122static int
123constant_8 (pTHX_ const char *name, IV *iv_return) {
124  /* When generated this function returned values for the list of names given
125     here.  However, subsequent manual editing may have added or removed some.
126     DB_SHMEM R_CURSOR R_IAFTER */
127  /* Offset 5 gives the best switch position.  */
128  switch (name[5]) {
129  case 'M':
130    if (memEQ(name, "DB_SHMEM", 8)) {
131    /*                    ^        */
132#ifdef DB_SHMEM
133      *iv_return = DB_SHMEM;
134      return PERL_constant_ISIV;
135#else
136      return PERL_constant_NOTDEF;
137#endif
138    }
139    break;
140  case 'S':
141    if (memEQ(name, "R_CURSOR", 8)) {
142    /*                    ^        */
143#ifdef R_CURSOR
144      *iv_return = R_CURSOR;
145      return PERL_constant_ISIV;
146#else
147      return PERL_constant_NOTDEF;
148#endif
149    }
150    break;
151  case 'T':
152    if (memEQ(name, "R_IAFTER", 8)) {
153    /*                    ^        */
154#ifdef R_IAFTER
155      *iv_return = R_IAFTER;
156      return PERL_constant_ISIV;
157#else
158      return PERL_constant_NOTDEF;
159#endif
160    }
161    break;
162  }
163  return PERL_constant_NOTFOUND;
164}
165
166static int
167constant_9 (pTHX_ const char *name, IV *iv_return) {
168  /* When generated this function returned values for the list of names given
169     here.  However, subsequent manual editing may have added or removed some.
170     HASHMAGIC RET_ERROR R_IBEFORE */
171  /* Offset 7 gives the best switch position.  */
172  switch (name[7]) {
173  case 'I':
174    if (memEQ(name, "HASHMAGIC", 9)) {
175    /*                      ^       */
176#ifdef HASHMAGIC
177      *iv_return = HASHMAGIC;
178      return PERL_constant_ISIV;
179#else
180      return PERL_constant_NOTDEF;
181#endif
182    }
183    break;
184  case 'O':
185    if (memEQ(name, "RET_ERROR", 9)) {
186    /*                      ^       */
187#ifdef RET_ERROR
188      *iv_return = RET_ERROR;
189      return PERL_constant_ISIV;
190#else
191      return PERL_constant_NOTDEF;
192#endif
193    }
194    break;
195  case 'R':
196    if (memEQ(name, "R_IBEFORE", 9)) {
197    /*                      ^       */
198#ifdef R_IBEFORE
199      *iv_return = R_IBEFORE;
200      return PERL_constant_ISIV;
201#else
202      return PERL_constant_NOTDEF;
203#endif
204    }
205    break;
206  }
207  return PERL_constant_NOTFOUND;
208}
209
210static int
211constant_10 (pTHX_ const char *name, IV *iv_return) {
212  /* When generated this function returned values for the list of names given
213     here.  However, subsequent manual editing may have added or removed some.
214     BTREEMAGIC R_FIXEDLEN R_SNAPSHOT __R_UNUSED */
215  /* Offset 5 gives the best switch position.  */
216  switch (name[5]) {
217  case 'E':
218    if (memEQ(name, "R_FIXEDLEN", 10)) {
219    /*                    ^           */
220#ifdef R_FIXEDLEN
221      *iv_return = R_FIXEDLEN;
222      return PERL_constant_ISIV;
223#else
224      return PERL_constant_NOTDEF;
225#endif
226    }
227    break;
228  case 'M':
229    if (memEQ(name, "BTREEMAGIC", 10)) {
230    /*                    ^           */
231#ifdef BTREEMAGIC
232      *iv_return = BTREEMAGIC;
233      return PERL_constant_ISIV;
234#else
235      return PERL_constant_NOTDEF;
236#endif
237    }
238    break;
239  case 'N':
240    if (memEQ(name, "__R_UNUSED", 10)) {
241    /*                    ^           */
242#ifdef __R_UNUSED
243      *iv_return = __R_UNUSED;
244      return PERL_constant_ISIV;
245#else
246      return PERL_constant_NOTDEF;
247#endif
248    }
249    break;
250  case 'P':
251    if (memEQ(name, "R_SNAPSHOT", 10)) {
252    /*                    ^           */
253#ifdef R_SNAPSHOT
254      *iv_return = R_SNAPSHOT;
255      return PERL_constant_ISIV;
256#else
257      return PERL_constant_NOTDEF;
258#endif
259    }
260    break;
261  }
262  return PERL_constant_NOTFOUND;
263}
264
265static int
266constant_11 (pTHX_ const char *name, IV *iv_return) {
267  /* When generated this function returned values for the list of names given
268     here.  However, subsequent manual editing may have added or removed some.
269     HASHVERSION RET_SPECIAL RET_SUCCESS R_RECNOSYNC R_SETCURSOR */
270  /* Offset 10 gives the best switch position.  */
271  switch (name[10]) {
272  case 'C':
273    if (memEQ(name, "R_RECNOSYNC", 11)) {
274    /*                         ^       */
275#ifdef R_RECNOSYNC
276      *iv_return = R_RECNOSYNC;
277      return PERL_constant_ISIV;
278#else
279      return PERL_constant_NOTDEF;
280#endif
281    }
282    break;
283  case 'L':
284    if (memEQ(name, "RET_SPECIAL", 11)) {
285    /*                         ^       */
286#ifdef RET_SPECIAL
287      *iv_return = RET_SPECIAL;
288      return PERL_constant_ISIV;
289#else
290      return PERL_constant_NOTDEF;
291#endif
292    }
293    break;
294  case 'N':
295    if (memEQ(name, "HASHVERSION", 11)) {
296    /*                         ^       */
297#ifdef HASHVERSION
298      *iv_return = HASHVERSION;
299      return PERL_constant_ISIV;
300#else
301      return PERL_constant_NOTDEF;
302#endif
303    }
304    break;
305  case 'R':
306    if (memEQ(name, "R_SETCURSOR", 11)) {
307    /*                         ^       */
308#ifdef R_SETCURSOR
309      *iv_return = R_SETCURSOR;
310      return PERL_constant_ISIV;
311#else
312      return PERL_constant_NOTDEF;
313#endif
314    }
315    break;
316  case 'S':
317    if (memEQ(name, "RET_SUCCESS", 11)) {
318    /*                         ^       */
319#ifdef RET_SUCCESS
320      *iv_return = RET_SUCCESS;
321      return PERL_constant_ISIV;
322#else
323      return PERL_constant_NOTDEF;
324#endif
325    }
326    break;
327  }
328  return PERL_constant_NOTFOUND;
329}
330
331static int
332constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
333  /* Initially switch on the length of the name.  */
334  /* When generated this function returned values for the list of names given
335     in this section of perl code.  Rather than manually editing these functions
336     to add or remove constants, which would result in this comment and section
337     of code becoming inaccurate, we recommend that you edit this section of
338     code, and use it to regenerate a new set of constant functions which you
339     then use to replace the originals.
340
341     Regenerate these constant functions by feeding this entire source file to
342     perl -x
343
344#!bleedperl -w
345use ExtUtils::Constant qw (constant_types C_constant XS_constant);
346
347my $types = {map {($_, 1)} qw(IV)};
348my @names = (qw(BTREEMAGIC BTREEVERSION DB_LOCK DB_SHMEM DB_TXN HASHMAGIC
349	       HASHVERSION MAX_PAGE_NUMBER MAX_PAGE_OFFSET MAX_REC_NUMBER
350	       RET_ERROR RET_SPECIAL RET_SUCCESS R_CURSOR R_DUP R_FIRST
351	       R_FIXEDLEN R_IAFTER R_IBEFORE R_LAST R_NEXT R_NOKEY
352	       R_NOOVERWRITE R_PREV R_RECNOSYNC R_SETCURSOR R_SNAPSHOT
353	       __R_UNUSED));
354
355print constant_types(); # macro defs
356foreach (C_constant ("DB_File", 'constant', 'IV', $types, undef, 3, @names) ) {
357    print $_, "\n"; # C constant subs
358}
359print "#### XS Section:\n";
360print XS_constant ("DB_File", $types);
361__END__
362   */
363
364  switch (len) {
365  case 5:
366    if (memEQ(name, "R_DUP", 5)) {
367#ifdef R_DUP
368      *iv_return = R_DUP;
369      return PERL_constant_ISIV;
370#else
371      return PERL_constant_NOTDEF;
372#endif
373    }
374    break;
375  case 6:
376    return constant_6 (aTHX_ name, iv_return);
377    break;
378  case 7:
379    return constant_7 (aTHX_ name, iv_return);
380    break;
381  case 8:
382    return constant_8 (aTHX_ name, iv_return);
383    break;
384  case 9:
385    return constant_9 (aTHX_ name, iv_return);
386    break;
387  case 10:
388    return constant_10 (aTHX_ name, iv_return);
389    break;
390  case 11:
391    return constant_11 (aTHX_ name, iv_return);
392    break;
393  case 12:
394    if (memEQ(name, "BTREEVERSION", 12)) {
395#ifdef BTREEVERSION
396      *iv_return = BTREEVERSION;
397      return PERL_constant_ISIV;
398#else
399      return PERL_constant_NOTDEF;
400#endif
401    }
402    break;
403  case 13:
404    if (memEQ(name, "R_NOOVERWRITE", 13)) {
405#ifdef R_NOOVERWRITE
406      *iv_return = R_NOOVERWRITE;
407      return PERL_constant_ISIV;
408#else
409      return PERL_constant_NOTDEF;
410#endif
411    }
412    break;
413  case 14:
414    if (memEQ(name, "MAX_REC_NUMBER", 14)) {
415#ifdef MAX_REC_NUMBER
416      *iv_return = MAX_REC_NUMBER;
417      return PERL_constant_ISIV;
418#else
419      return PERL_constant_NOTDEF;
420#endif
421    }
422    break;
423  case 15:
424    /* Names all of length 15.  */
425    /* MAX_PAGE_NUMBER MAX_PAGE_OFFSET */
426    /* Offset 9 gives the best switch position.  */
427    switch (name[9]) {
428    case 'N':
429      if (memEQ(name, "MAX_PAGE_NUMBER", 15)) {
430      /*                        ^            */
431#ifdef MAX_PAGE_NUMBER
432        *iv_return = MAX_PAGE_NUMBER;
433        return PERL_constant_ISIV;
434#else
435        return PERL_constant_NOTDEF;
436#endif
437      }
438      break;
439    case 'O':
440      if (memEQ(name, "MAX_PAGE_OFFSET", 15)) {
441      /*                        ^            */
442#ifdef MAX_PAGE_OFFSET
443        *iv_return = MAX_PAGE_OFFSET;
444        return PERL_constant_ISIV;
445#else
446        return PERL_constant_NOTDEF;
447#endif
448      }
449      break;
450    }
451    break;
452  }
453  return PERL_constant_NOTFOUND;
454}
455
456