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