This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlport updates from Pudge.
[perl5.git] / ext / I18N / Langinfo / fallback.c
CommitLineData
9a7df4f2
NC
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
17static int
18constant_5 (pTHX_ const char *name, IV *iv_return) {
19 /* When generated this function returned values for the list of names given
20 here. However, subsequent manual editing may have added or removed some.
21 DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7 D_FMT MON_1 MON_2 MON_3 MON_4
22 MON_5 MON_6 MON_7 MON_8 MON_9 NOSTR T_FMT */
23 /* Offset 4 gives the best switch position. */
24 switch (name[4]) {
25 case '1':
26 if (memEQ(name, "DAY_1", 5)) {
27 /* ^ */
28#ifdef DAY_1
29 *iv_return = DAY_1;
30 return PERL_constant_ISIV;
31#else
32 return PERL_constant_NOTDEF;
33#endif
34 }
35 if (memEQ(name, "MON_1", 5)) {
36 /* ^ */
37#ifdef MON_1
38 *iv_return = MON_1;
39 return PERL_constant_ISIV;
40#else
41 return PERL_constant_NOTDEF;
42#endif
43 }
44 break;
45 case '2':
46 if (memEQ(name, "DAY_2", 5)) {
47 /* ^ */
48#ifdef DAY_2
49 *iv_return = DAY_2;
50 return PERL_constant_ISIV;
51#else
52 return PERL_constant_NOTDEF;
53#endif
54 }
55 if (memEQ(name, "MON_2", 5)) {
56 /* ^ */
57#ifdef MON_2
58 *iv_return = MON_2;
59 return PERL_constant_ISIV;
60#else
61 return PERL_constant_NOTDEF;
62#endif
63 }
64 break;
65 case '3':
66 if (memEQ(name, "DAY_3", 5)) {
67 /* ^ */
68#ifdef DAY_3
69 *iv_return = DAY_3;
70 return PERL_constant_ISIV;
71#else
72 return PERL_constant_NOTDEF;
73#endif
74 }
75 if (memEQ(name, "MON_3", 5)) {
76 /* ^ */
77#ifdef MON_3
78 *iv_return = MON_3;
79 return PERL_constant_ISIV;
80#else
81 return PERL_constant_NOTDEF;
82#endif
83 }
84 break;
85 case '4':
86 if (memEQ(name, "DAY_4", 5)) {
87 /* ^ */
88#ifdef DAY_4
89 *iv_return = DAY_4;
90 return PERL_constant_ISIV;
91#else
92 return PERL_constant_NOTDEF;
93#endif
94 }
95 if (memEQ(name, "MON_4", 5)) {
96 /* ^ */
97#ifdef MON_4
98 *iv_return = MON_4;
99 return PERL_constant_ISIV;
100#else
101 return PERL_constant_NOTDEF;
102#endif
103 }
104 break;
105 case '5':
106 if (memEQ(name, "DAY_5", 5)) {
107 /* ^ */
108#ifdef DAY_5
109 *iv_return = DAY_5;
110 return PERL_constant_ISIV;
111#else
112 return PERL_constant_NOTDEF;
113#endif
114 }
115 if (memEQ(name, "MON_5", 5)) {
116 /* ^ */
117#ifdef MON_5
118 *iv_return = MON_5;
119 return PERL_constant_ISIV;
120#else
121 return PERL_constant_NOTDEF;
122#endif
123 }
124 break;
125 case '6':
126 if (memEQ(name, "DAY_6", 5)) {
127 /* ^ */
128#ifdef DAY_6
129 *iv_return = DAY_6;
130 return PERL_constant_ISIV;
131#else
132 return PERL_constant_NOTDEF;
133#endif
134 }
135 if (memEQ(name, "MON_6", 5)) {
136 /* ^ */
137#ifdef MON_6
138 *iv_return = MON_6;
139 return PERL_constant_ISIV;
140#else
141 return PERL_constant_NOTDEF;
142#endif
143 }
144 break;
145 case '7':
146 if (memEQ(name, "DAY_7", 5)) {
147 /* ^ */
148#ifdef DAY_7
149 *iv_return = DAY_7;
150 return PERL_constant_ISIV;
151#else
152 return PERL_constant_NOTDEF;
153#endif
154 }
155 if (memEQ(name, "MON_7", 5)) {
156 /* ^ */
157#ifdef MON_7
158 *iv_return = MON_7;
159 return PERL_constant_ISIV;
160#else
161 return PERL_constant_NOTDEF;
162#endif
163 }
164 break;
165 case '8':
166 if (memEQ(name, "MON_8", 5)) {
167 /* ^ */
168#ifdef MON_8
169 *iv_return = MON_8;
170 return PERL_constant_ISIV;
171#else
172 return PERL_constant_NOTDEF;
173#endif
174 }
175 break;
176 case '9':
177 if (memEQ(name, "MON_9", 5)) {
178 /* ^ */
179#ifdef MON_9
180 *iv_return = MON_9;
181 return PERL_constant_ISIV;
182#else
183 return PERL_constant_NOTDEF;
184#endif
185 }
186 break;
187 case 'R':
188 if (memEQ(name, "NOSTR", 5)) {
189 /* ^ */
190#ifdef NOSTR
191 *iv_return = NOSTR;
192 return PERL_constant_ISIV;
193#else
194 return PERL_constant_NOTDEF;
195#endif
196 }
197 break;
198 case 'T':
199 if (memEQ(name, "D_FMT", 5)) {
200 /* ^ */
201#ifdef D_FMT
202 *iv_return = D_FMT;
203 return PERL_constant_ISIV;
204#else
205 return PERL_constant_NOTDEF;
206#endif
207 }
208 if (memEQ(name, "T_FMT", 5)) {
209 /* ^ */
210#ifdef T_FMT
211 *iv_return = T_FMT;
212 return PERL_constant_ISIV;
213#else
214 return PERL_constant_NOTDEF;
215#endif
216 }
217 break;
218 }
219 return PERL_constant_NOTFOUND;
220}
221
222static int
223constant_6 (pTHX_ const char *name, IV *iv_return) {
224 /* When generated this function returned values for the list of names given
225 here. However, subsequent manual editing may have added or removed some.
226 AM_STR MON_10 MON_11 MON_12 NOEXPR PM_STR YESSTR */
227 /* Offset 0 gives the best switch position. */
228 switch (name[0]) {
229 case 'A':
230 if (memEQ(name, "AM_STR", 6)) {
231 /* ^ */
232#ifdef AM_STR
233 *iv_return = AM_STR;
234 return PERL_constant_ISIV;
235#else
236 return PERL_constant_NOTDEF;
237#endif
238 }
239 break;
240 case 'M':
241 if (memEQ(name, "MON_10", 6)) {
242 /* ^ */
243#ifdef MON_10
244 *iv_return = MON_10;
245 return PERL_constant_ISIV;
246#else
247 return PERL_constant_NOTDEF;
248#endif
249 }
250 if (memEQ(name, "MON_11", 6)) {
251 /* ^ */
252#ifdef MON_11
253 *iv_return = MON_11;
254 return PERL_constant_ISIV;
255#else
256 return PERL_constant_NOTDEF;
257#endif
258 }
259 if (memEQ(name, "MON_12", 6)) {
260 /* ^ */
261#ifdef MON_12
262 *iv_return = MON_12;
263 return PERL_constant_ISIV;
264#else
265 return PERL_constant_NOTDEF;
266#endif
267 }
268 break;
269 case 'N':
270 if (memEQ(name, "NOEXPR", 6)) {
271 /* ^ */
272#ifdef NOEXPR
273 *iv_return = NOEXPR;
274 return PERL_constant_ISIV;
275#else
276 return PERL_constant_NOTDEF;
277#endif
278 }
279 break;
280 case 'P':
281 if (memEQ(name, "PM_STR", 6)) {
282 /* ^ */
283#ifdef PM_STR
284 *iv_return = PM_STR;
285 return PERL_constant_ISIV;
286#else
287 return PERL_constant_NOTDEF;
288#endif
289 }
290 break;
291 case 'Y':
292 if (memEQ(name, "YESSTR", 6)) {
293 /* ^ */
294#ifdef YESSTR
295 *iv_return = YESSTR;
296 return PERL_constant_ISIV;
297#else
298 return PERL_constant_NOTDEF;
299#endif
300 }
301 break;
302 }
303 return PERL_constant_NOTFOUND;
304}
305
306static int
307constant_7 (pTHX_ const char *name, IV *iv_return) {
308 /* When generated this function returned values for the list of names given
309 here. However, subsequent manual editing may have added or removed some.
310 ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7 ABMON_1 ABMON_2
311 ABMON_3 ABMON_4 ABMON_5 ABMON_6 ABMON_7 ABMON_8 ABMON_9 CODESET D_T_FMT
312 THOUSEP YESEXPR */
313 /* Offset 6 gives the best switch position. */
314 switch (name[6]) {
315 case '1':
316 if (memEQ(name, "ABDAY_1", 7)) {
317 /* ^ */
318#ifdef ABDAY_1
319 *iv_return = ABDAY_1;
320 return PERL_constant_ISIV;
321#else
322 return PERL_constant_NOTDEF;
323#endif
324 }
325 if (memEQ(name, "ABMON_1", 7)) {
326 /* ^ */
327#ifdef ABMON_1
328 *iv_return = ABMON_1;
329 return PERL_constant_ISIV;
330#else
331 return PERL_constant_NOTDEF;
332#endif
333 }
334 break;
335 case '2':
336 if (memEQ(name, "ABDAY_2", 7)) {
337 /* ^ */
338#ifdef ABDAY_2
339 *iv_return = ABDAY_2;
340 return PERL_constant_ISIV;
341#else
342 return PERL_constant_NOTDEF;
343#endif
344 }
345 if (memEQ(name, "ABMON_2", 7)) {
346 /* ^ */
347#ifdef ABMON_2
348 *iv_return = ABMON_2;
349 return PERL_constant_ISIV;
350#else
351 return PERL_constant_NOTDEF;
352#endif
353 }
354 break;
355 case '3':
356 if (memEQ(name, "ABDAY_3", 7)) {
357 /* ^ */
358#ifdef ABDAY_3
359 *iv_return = ABDAY_3;
360 return PERL_constant_ISIV;
361#else
362 return PERL_constant_NOTDEF;
363#endif
364 }
365 if (memEQ(name, "ABMON_3", 7)) {
366 /* ^ */
367#ifdef ABMON_3
368 *iv_return = ABMON_3;
369 return PERL_constant_ISIV;
370#else
371 return PERL_constant_NOTDEF;
372#endif
373 }
374 break;
375 case '4':
376 if (memEQ(name, "ABDAY_4", 7)) {
377 /* ^ */
378#ifdef ABDAY_4
379 *iv_return = ABDAY_4;
380 return PERL_constant_ISIV;
381#else
382 return PERL_constant_NOTDEF;
383#endif
384 }
385 if (memEQ(name, "ABMON_4", 7)) {
386 /* ^ */
387#ifdef ABMON_4
388 *iv_return = ABMON_4;
389 return PERL_constant_ISIV;
390#else
391 return PERL_constant_NOTDEF;
392#endif
393 }
394 break;
395 case '5':
396 if (memEQ(name, "ABDAY_5", 7)) {
397 /* ^ */
398#ifdef ABDAY_5
399 *iv_return = ABDAY_5;
400 return PERL_constant_ISIV;
401#else
402 return PERL_constant_NOTDEF;
403#endif
404 }
405 if (memEQ(name, "ABMON_5", 7)) {
406 /* ^ */
407#ifdef ABMON_5
408 *iv_return = ABMON_5;
409 return PERL_constant_ISIV;
410#else
411 return PERL_constant_NOTDEF;
412#endif
413 }
414 break;
415 case '6':
416 if (memEQ(name, "ABDAY_6", 7)) {
417 /* ^ */
418#ifdef ABDAY_6
419 *iv_return = ABDAY_6;
420 return PERL_constant_ISIV;
421#else
422 return PERL_constant_NOTDEF;
423#endif
424 }
425 if (memEQ(name, "ABMON_6", 7)) {
426 /* ^ */
427#ifdef ABMON_6
428 *iv_return = ABMON_6;
429 return PERL_constant_ISIV;
430#else
431 return PERL_constant_NOTDEF;
432#endif
433 }
434 break;
435 case '7':
436 if (memEQ(name, "ABDAY_7", 7)) {
437 /* ^ */
438#ifdef ABDAY_7
439 *iv_return = ABDAY_7;
440 return PERL_constant_ISIV;
441#else
442 return PERL_constant_NOTDEF;
443#endif
444 }
445 if (memEQ(name, "ABMON_7", 7)) {
446 /* ^ */
447#ifdef ABMON_7
448 *iv_return = ABMON_7;
449 return PERL_constant_ISIV;
450#else
451 return PERL_constant_NOTDEF;
452#endif
453 }
454 break;
455 case '8':
456 if (memEQ(name, "ABMON_8", 7)) {
457 /* ^ */
458#ifdef ABMON_8
459 *iv_return = ABMON_8;
460 return PERL_constant_ISIV;
461#else
462 return PERL_constant_NOTDEF;
463#endif
464 }
465 break;
466 case '9':
467 if (memEQ(name, "ABMON_9", 7)) {
468 /* ^ */
469#ifdef ABMON_9
470 *iv_return = ABMON_9;
471 return PERL_constant_ISIV;
472#else
473 return PERL_constant_NOTDEF;
474#endif
475 }
476 break;
477 case 'P':
478 if (memEQ(name, "THOUSEP", 7)) {
479 /* ^ */
480#ifdef THOUSEP
481 *iv_return = THOUSEP;
482 return PERL_constant_ISIV;
483#else
484 return PERL_constant_NOTDEF;
485#endif
486 }
487 break;
488 case 'R':
489 if (memEQ(name, "YESEXPR", 7)) {
490 /* ^ */
491#ifdef YESEXPR
492 *iv_return = YESEXPR;
493 return PERL_constant_ISIV;
494#else
495 return PERL_constant_NOTDEF;
496#endif
497 }
498 break;
499 case 'T':
500 if (memEQ(name, "CODESET", 7)) {
501 /* ^ */
502#ifdef CODESET
503 *iv_return = CODESET;
504 return PERL_constant_ISIV;
505#else
506 return PERL_constant_NOTDEF;
507#endif
508 }
509 if (memEQ(name, "D_T_FMT", 7)) {
510 /* ^ */
511#ifdef D_T_FMT
512 *iv_return = D_T_FMT;
513 return PERL_constant_ISIV;
514#else
515 return PERL_constant_NOTDEF;
516#endif
517 }
518 break;
519 }
520 return PERL_constant_NOTFOUND;
521}
522
523static int
524constant_8 (pTHX_ const char *name, IV *iv_return) {
525 /* When generated this function returned values for the list of names given
526 here. However, subsequent manual editing may have added or removed some.
527 ABMON_10 ABMON_11 ABMON_12 CRNCYSTR */
528 /* Offset 7 gives the best switch position. */
529 switch (name[7]) {
530 case '0':
531 if (memEQ(name, "ABMON_10", 8)) {
532 /* ^ */
533#ifdef ABMON_10
534 *iv_return = ABMON_10;
535 return PERL_constant_ISIV;
536#else
537 return PERL_constant_NOTDEF;
538#endif
539 }
540 break;
541 case '1':
542 if (memEQ(name, "ABMON_11", 8)) {
543 /* ^ */
544#ifdef ABMON_11
545 *iv_return = ABMON_11;
546 return PERL_constant_ISIV;
547#else
548 return PERL_constant_NOTDEF;
549#endif
550 }
551 break;
552 case '2':
553 if (memEQ(name, "ABMON_12", 8)) {
554 /* ^ */
555#ifdef ABMON_12
556 *iv_return = ABMON_12;
557 return PERL_constant_ISIV;
558#else
559 return PERL_constant_NOTDEF;
560#endif
561 }
562 break;
563 case 'R':
564 if (memEQ(name, "CRNCYSTR", 8)) {
565 /* ^ */
566#ifdef CRNCYSTR
567 *iv_return = CRNCYSTR;
568 return PERL_constant_ISIV;
569#else
570 return PERL_constant_NOTDEF;
571#endif
572 }
573 break;
574 }
575 return PERL_constant_NOTFOUND;
576}
577
578static int
579constant_9 (pTHX_ const char *name, IV *iv_return) {
580 /* When generated this function returned values for the list of names given
581 here. However, subsequent manual editing may have added or removed some.
582 ERA_D_FMT ERA_T_FMT RADIXCHAR */
583 /* Offset 4 gives the best switch position. */
584 switch (name[4]) {
585 case 'D':
586 if (memEQ(name, "ERA_D_FMT", 9)) {
587 /* ^ */
588#ifdef ERA_D_FMT
589 *iv_return = ERA_D_FMT;
590 return PERL_constant_ISIV;
591#else
592 return PERL_constant_NOTDEF;
593#endif
594 }
595 break;
596 case 'T':
597 if (memEQ(name, "ERA_T_FMT", 9)) {
598 /* ^ */
599#ifdef ERA_T_FMT
600 *iv_return = ERA_T_FMT;
601 return PERL_constant_ISIV;
602#else
603 return PERL_constant_NOTDEF;
604#endif
605 }
606 break;
607 case 'X':
608 if (memEQ(name, "RADIXCHAR", 9)) {
609 /* ^ */
610#ifdef RADIXCHAR
611 *iv_return = RADIXCHAR;
612 return PERL_constant_ISIV;
613#else
614 return PERL_constant_NOTDEF;
615#endif
616 }
617 break;
618 }
619 return PERL_constant_NOTFOUND;
620}
621
622static int
623constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
624 /* Initially switch on the length of the name. */
625 /* When generated this function returned values for the list of names given
626 in this section of perl code. Rather than manually editing these functions
627 to add or remove constants, which would result in this comment and section
628 of code becoming inaccurate, we recommend that you edit this section of
629 code, and use it to regenerate a new set of constant functions which you
630 then use to replace the originals.
631
632 Regenerate these constant functions by feeding this entire source file to
633 perl -x
634
635#!../../../miniperl -w
636use ExtUtils::Constant qw (constant_types C_constant XS_constant);
637
638my $types = {map {($_, 1)} qw(IV)};
639my @names = (qw(ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7 ABMON_1
640 ABMON_10 ABMON_11 ABMON_12 ABMON_2 ABMON_3 ABMON_4 ABMON_5
641 ABMON_6 ABMON_7 ABMON_8 ABMON_9 ALT_DIGITS AM_STR CODESET
642 CRNCYSTR DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7 D_FMT D_T_FMT
643 ERA ERA_D_FMT ERA_D_T_FMT ERA_T_FMT MON_1 MON_10 MON_11 MON_12
644 MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 NOEXPR NOSTR
645 PM_STR RADIXCHAR THOUSEP T_FMT T_FMT_AMPM YESEXPR YESSTR));
646
647print constant_types(); # macro defs
648foreach (C_constant ("I18N::Langinfo", 'constant', 'IV', $types, undef, 3, @names) ) {
649 print $_, "\n"; # C constant subs
650}
651print "#### XS Section:\n";
652print XS_constant ("I18N::Langinfo", $types);
653__END__
654 */
655
656 switch (len) {
657 case 3:
658 if (memEQ(name, "ERA", 3)) {
659#ifdef ERA
660 *iv_return = ERA;
661 return PERL_constant_ISIV;
662#else
663 return PERL_constant_NOTDEF;
664#endif
665 }
666 break;
667 case 5:
668 return constant_5 (aTHX_ name, iv_return);
669 break;
670 case 6:
671 return constant_6 (aTHX_ name, iv_return);
672 break;
673 case 7:
674 return constant_7 (aTHX_ name, iv_return);
675 break;
676 case 8:
677 return constant_8 (aTHX_ name, iv_return);
678 break;
679 case 9:
680 return constant_9 (aTHX_ name, iv_return);
681 break;
682 case 10:
683 /* Names all of length 10. */
684 /* ALT_DIGITS T_FMT_AMPM */
685 /* Offset 7 gives the best switch position. */
686 switch (name[7]) {
687 case 'I':
688 if (memEQ(name, "ALT_DIGITS", 10)) {
689 /* ^ */
690#ifdef ALT_DIGITS
691 *iv_return = ALT_DIGITS;
692 return PERL_constant_ISIV;
693#else
694 return PERL_constant_NOTDEF;
695#endif
696 }
697 break;
698 case 'M':
699 if (memEQ(name, "T_FMT_AMPM", 10)) {
700 /* ^ */
701#ifdef T_FMT_AMPM
702 *iv_return = T_FMT_AMPM;
703 return PERL_constant_ISIV;
704#else
705 return PERL_constant_NOTDEF;
706#endif
707 }
708 break;
709 }
710 break;
711 case 11:
712 if (memEQ(name, "ERA_D_T_FMT", 11)) {
713#ifdef ERA_D_T_FMT
714 *iv_return = ERA_D_T_FMT;
715 return PERL_constant_ISIV;
716#else
717 return PERL_constant_NOTDEF;
718#endif
719 }
720 break;
721 }
722 return PERL_constant_NOTFOUND;
723}
724