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
14 typedef 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 static int
func_ord_by_type_1(pTHX_ const char * name,IV * iv_return)23 func_ord_by_type_1 (pTHX_ const char *name, IV *iv_return) {
24   /* When generated this function returned values for the list of names given
25      here.  However, subsequent manual editing may have added or removed some.
26      G L p */
27   /* Offset 0 gives the best switch position.  */
28   switch (name[0]) {
29   case 'G':
30     {
31       *iv_return = 18;
32       return PERL_constant_ISIV;
33     }
34     break;
35   case 'L':
36     {
37       *iv_return = 11;
38       return PERL_constant_ISIV;
39     }
40     break;
41   case 'p':
42     {
43       *iv_return = 0;
44       return PERL_constant_ISIV;
45     }
46     break;
47   }
48   return PERL_constant_NOTFOUND;
49 }
50 static int
func_ord_by_type_2(pTHX_ const char * name,IV * iv_return)51 func_ord_by_type_2 (pTHX_ const char *name, IV *iv_return) {
52   /* When generated this function returned values for the list of names given
53      here.  However, subsequent manual editing may have added or removed some.
54      GG GL Gp LG lG ls vS */
55   /* Offset 1 gives the best switch position.  */
56   switch (name[1]) {
57   case 'G':
58     if (name[0] == 'G') {
59       *iv_return = 2;
60       return PERL_constant_ISIV;
61     }
62     if (name[0] == 'L') {
63       *iv_return = 24;
64       return PERL_constant_ISIV;
65     }
66     if (name[0] == 'l') {
67       *iv_return = 10;
68       return PERL_constant_ISIV;
69     }
70     break;
71   case 'L':
72     if (name[0] == 'G') {
73       *iv_return = 23;
74       return PERL_constant_ISIV;
75     }
76     break;
77   case 'S':
78     if (name[0] == 'v') {
79       *iv_return = 85;
80       return PERL_constant_ISIV;
81     }
82     break;
83   case 'p':
84     if (name[0] == 'G') {
85       *iv_return = 1;
86       return PERL_constant_ISIV;
87     }
88     break;
89   case 's':
90     if (name[0] == 'l') {
91       *iv_return = 16;
92       return PERL_constant_ISIV;
93     }
94     break;
95   }
96   return PERL_constant_NOTFOUND;
97 }
98 static int
func_ord_by_type_3(pTHX_ const char * name,IV * iv_return)99 func_ord_by_type_3 (pTHX_ const char *name, IV *iv_return) {
100   /* When generated this function returned values for the list of names given
101      here.  However, subsequent manual editing may have added or removed some.
102      GDn GGG GGL GGp GVE GVI GnG GnP lGG vLL vLs */
103   /* Offset 2 gives the best switch position.  */
104   switch (name[2]) {
105   case 'E':
106     if (name[0] == 'G' && name[1] == 'V') {
107       *iv_return = 22;
108       return PERL_constant_ISIV;
109     }
110     break;
111   case 'G':
112     if (name[0] == 'G' && name[1] == 'G') {
113       *iv_return = 3;
114       return PERL_constant_ISIV;
115     }
116     if (name[0] == 'G' && name[1] == 'n') {
117       *iv_return = 26;
118       return PERL_constant_ISIV;
119     }
120     if (name[0] == 'l' && name[1] == 'G') {
121       *iv_return = 20;
122       return PERL_constant_ISIV;
123     }
124     break;
125   case 'I':
126     if (name[0] == 'G' && name[1] == 'V') {
127       *iv_return = 22;
128       return PERL_constant_ISIV;
129     }
130     break;
131   case 'L':
132     if (name[0] == 'G' && name[1] == 'G') {
133       *iv_return = 32;
134       return PERL_constant_ISIV;
135     }
136     if (name[0] == 'v' && name[1] == 'L') {
137       *iv_return = 19;
138       return PERL_constant_ISIV;
139     }
140     break;
141   case 'P':
142     if (name[0] == 'G' && name[1] == 'n') {
143       *iv_return = 12;
144       return PERL_constant_ISIV;
145     }
146     break;
147   case 'n':
148     if (name[0] == 'G' && name[1] == 'D') {
149       *iv_return = 14;
150       return PERL_constant_ISIV;
151     }
152     break;
153   case 'p':
154     if (name[0] == 'G' && name[1] == 'G') {
155       *iv_return = 29;
156       return PERL_constant_ISIV;
157     }
158     break;
159   case 's':
160     if (name[0] == 'v' && name[1] == 'L') {
161       *iv_return = 57;
162       return PERL_constant_ISIV;
163     }
164     break;
165   }
166   return PERL_constant_NOTFOUND;
167 }
168 static int
func_ord_by_type_4(pTHX_ const char * name,IV * iv_return)169 func_ord_by_type_4 (pTHX_ const char *name, IV *iv_return) {
170   /* When generated this function returned values for the list of names given
171      here.  However, subsequent manual editing may have added or removed some.
172      GGGG lGGG vGVE vGVI vLGG vLLL */
173   /* Offset 3 gives the best switch position.  */
174   switch (name[3]) {
175   case 'E':
176     if (memEQ(name, "vGV", 3)) {
177     /*                  E     */
178       *iv_return = 84;
179       return PERL_constant_ISIV;
180     }
181     break;
182   case 'G':
183     if (memEQ(name, "GGG", 3)) {
184     /*                  G     */
185       *iv_return = 4;
186       return PERL_constant_ISIV;
187     }
188     if (memEQ(name, "lGG", 3)) {
189     /*                  G     */
190       *iv_return = 30;
191       return PERL_constant_ISIV;
192     }
193     if (memEQ(name, "vLG", 3)) {
194     /*                  G     */
195       *iv_return = 35;
196       return PERL_constant_ISIV;
197     }
198     break;
199   case 'I':
200     if (memEQ(name, "vGV", 3)) {
201     /*                  I     */
202       *iv_return = 84;
203       return PERL_constant_ISIV;
204     }
205     break;
206   case 'L':
207     if (memEQ(name, "vLL", 3)) {
208     /*                  L     */
209       *iv_return = 34;
210       return PERL_constant_ISIV;
211     }
212     break;
213   }
214   return PERL_constant_NOTFOUND;
215 }
216 static int
func_ord_by_type_5(pTHX_ const char * name,IV * iv_return)217 func_ord_by_type_5 (pTHX_ const char *name, IV *iv_return) {
218   /* When generated this function returned values for the list of names given
219      here.  However, subsequent manual editing may have added or removed some.
220      GDVDE GDVDI "V=GEp" "V=GIp" */
221   /* Offset 3 gives the best switch position.  */
222   switch (name[3]) {
223   case 'D':
224     if (memEQ(name, "GDVDE", 5)) {
225     /*                  ^       */
226       *iv_return = 28;
227       return PERL_constant_ISIV;
228     }
229     if (memEQ(name, "GDVDI", 5)) {
230     /*                  ^       */
231       *iv_return = 28;
232       return PERL_constant_ISIV;
233     }
234     break;
235   case 'E':
236     if (memEQ(name, "V=GEp", 5)) {
237     /*                  ^       */
238       *iv_return = 27;
239       return PERL_constant_ISIV;
240     }
241     break;
242   case 'I':
243     if (memEQ(name, "V=GIp", 5)) {
244     /*                  ^       */
245       *iv_return = 27;
246       return PERL_constant_ISIV;
247     }
248     break;
249   }
250   return PERL_constant_NOTFOUND;
251 }
252 static int
func_ord_by_type_6(pTHX_ const char * name,IV * iv_return)253 func_ord_by_type_6 (pTHX_ const char *name, IV *iv_return) {
254   /* When generated this function returned values for the list of names given
255      here.  However, subsequent manual editing may have added or removed some.
256      "V=GGEp" "V=GGIp" vLGGGG "vV=GGE" "vV=GGI" */
257   /* Offset 5 gives the best switch position.  */
258   switch (name[5]) {
259   case 'E':
260     if (memEQ(name, "vV=GG", 5)) {
261     /*                    E     */
262       *iv_return = 83;
263       return PERL_constant_ISIV;
264     }
265     break;
266   case 'G':
267     if (memEQ(name, "vLGGG", 5)) {
268     /*                    G     */
269       *iv_return = 59;
270       return PERL_constant_ISIV;
271     }
272     break;
273   case 'I':
274     if (memEQ(name, "vV=GG", 5)) {
275     /*                    I     */
276       *iv_return = 83;
277       return PERL_constant_ISIV;
278     }
279     break;
280   case 'p':
281     if (memEQ(name, "V=GGE", 5)) {
282     /*                    p     */
283       *iv_return = 37;
284       return PERL_constant_ISIV;
285     }
286     if (memEQ(name, "V=GGI", 5)) {
287     /*                    p     */
288       *iv_return = 37;
289       return PERL_constant_ISIV;
290     }
291     break;
292   }
293   return PERL_constant_NOTFOUND;
294 }
295 static int
func_ord_by_type_7(pTHX_ const char * name,IV * iv_return)296 func_ord_by_type_7 (pTHX_ const char *name, IV *iv_return) {
297   /* When generated this function returned values for the list of names given
298      here.  However, subsequent manual editing may have added or removed some.
299      "GDGDGD&" "GGD0,L," "LGD0,L," "V=GGEDG" "V=GGIDG" "vV=GGGE" "vV=GGGI" */
300   /* Offset 6 gives the best switch position.  */
301   switch (name[6]) {
302   case '&':
303     if (memEQ(name, "GDGDGD", 6)) {
304     /*                     &     */
305       *iv_return = 31;
306       return PERL_constant_ISIV;
307     }
308     break;
309   case ',':
310     if (memEQ(name, "GGD0,L", 6)) {
311     /*                     ,     */
312       *iv_return = 25;
313       return PERL_constant_ISIV;
314     }
315     if (memEQ(name, "LGD0,L", 6)) {
316     /*                     ,     */
317       *iv_return = 45;
318       return PERL_constant_ISIV;
319     }
320     break;
321   case 'E':
322     if (memEQ(name, "vV=GGG", 6)) {
323     /*                     E     */
324       *iv_return = 86;
325       return PERL_constant_ISIV;
326     }
327     break;
328   case 'G':
329     if (memEQ(name, "V=GGED", 6)) {
330     /*                     G     */
331       *iv_return = 47;
332       return PERL_constant_ISIV;
333     }
334     if (memEQ(name, "V=GGID", 6)) {
335     /*                     G     */
336       *iv_return = 47;
337       return PERL_constant_ISIV;
338     }
339     break;
340   case 'I':
341     if (memEQ(name, "vV=GGG", 6)) {
342     /*                     I     */
343       *iv_return = 86;
344       return PERL_constant_ISIV;
345     }
346     break;
347   }
348   return PERL_constant_NOTFOUND;
349 }
350 static int
func_ord_by_type_8(pTHX_ const char * name,IV * iv_return)351 func_ord_by_type_8 (pTHX_ const char *name, IV *iv_return) {
352   /* When generated this function returned values for the list of names given
353      here.  However, subsequent manual editing may have added or removed some.
354      "GD0,L,DG" GGDVDVDE GGDVDVDI */
355   /* Offset 7 gives the best switch position.  */
356   switch (name[7]) {
357   case 'E':
358     if (memEQ(name, "GGDVDVD", 7)) {
359     /*                      E     */
360       *iv_return = 49;
361       return PERL_constant_ISIV;
362     }
363     break;
364   case 'G':
365     if (memEQ(name, "GD0,L,D", 7)) {
366     /*                      G     */
367       *iv_return = 13;
368       return PERL_constant_ISIV;
369     }
370     break;
371   case 'I':
372     if (memEQ(name, "GGDVDVD", 7)) {
373     /*                      I     */
374       *iv_return = 49;
375       return PERL_constant_ISIV;
376     }
377     break;
378   }
379   return PERL_constant_NOTFOUND;
380 }
381 static int
func_ord_by_type_17(pTHX_ const char * name,IV * iv_return)382 func_ord_by_type_17 (pTHX_ const char *name, IV *iv_return) {
383   /* When generated this function returned values for the list of names given
384      here.  However, subsequent manual editing may have added or removed some.
385      "GD0,G,D0,G,D0,L,p" "LV=GGEpD0,L,D0,L," "LV=GGIpD0,L,D0,L," */
386   /* Offset 5 gives the best switch position.  */
387   switch (name[5]) {
388   case ',':
389     if (memEQ(name, "GD0,G,D0,G,D0,L,p", 17)) {
390     /*                    ^                  */
391       *iv_return = 62;
392       return PERL_constant_ISIV;
393     }
394     break;
395   case 'E':
396     if (memEQ(name, "LV=GGEpD0,L,D0,L,", 17)) {
397     /*                    ^                  */
398       *iv_return = 73;
399       return PERL_constant_ISIV;
400     }
401     break;
402   case 'I':
403     if (memEQ(name, "LV=GGIpD0,L,D0,L,", 17)) {
404     /*                    ^                  */
405       *iv_return = 73;
406       return PERL_constant_ISIV;
407     }
408     break;
409   }
410   return PERL_constant_NOTFOUND;
411 }
412 static int
func_ord_by_type(pTHX_ const char * name,STRLEN len,IV * iv_return)413 func_ord_by_type (pTHX_ const char *name, STRLEN len, IV *iv_return) {
414   /* Initially switch on the length of the name.  */
415   /* When generated this function returned values for the list of names given
416      in this section of perl code.  Rather than manually editing these functions
417      to add or remove constants, which would result in this comment and section
418      of code becoming inaccurate, we recommend that you edit this section of
419      code, and use it to regenerate a new set of constant functions which you
420      then use to replace the originals.
421 
422      Regenerate these constant functions by feeding this entire source file to
423      perl -x
424 
425 #!i:/emx.add/BIN/perl.exe -w
426 use ExtUtils::Constant qw (constant_types C_constant XS_constant);
427 
428 my $types = {map {($_, 1)} qw(IV)};
429 my @names = (qw(),
430             {name=>"G", type=>"IV", macro=>"1", value=>"18"},
431             {name=>"GD0,G,D0,G,D0,L,p", type=>"IV", macro=>"1", value=>"62"},
432             {name=>"GD0,L,D0,G,", type=>"IV", macro=>"1", value=>"13"},
433             {name=>"GD0,L,DG", type=>"IV", macro=>"1", value=>"13"},
434             {name=>"GD0,L,DGp", type=>"IV", macro=>"1", value=>"96"},
435             {name=>"GDGDGD&", type=>"IV", macro=>"1", value=>"31"},
436             {name=>"GDGDGD0,L,p", type=>"IV", macro=>"1", value=>"62"},
437             {name=>"GDVDE", type=>"IV", macro=>"1", value=>"28"},
438             {name=>"GDVDI", type=>"IV", macro=>"1", value=>"28"},
439             {name=>"GDn", type=>"IV", macro=>"1", value=>"14"},
440             {name=>"GG", type=>"IV", macro=>"1", value=>"2"},
441             {name=>"GGD0,L,", type=>"IV", macro=>"1", value=>"25"},
442             {name=>"GGDVDVDE", type=>"IV", macro=>"1", value=>"49"},
443             {name=>"GGDVDVDI", type=>"IV", macro=>"1", value=>"49"},
444             {name=>"GGG", type=>"IV", macro=>"1", value=>"3"},
445             {name=>"GGGD0,L,p", type=>"IV", macro=>"1", value=>"33"},
446             {name=>"GGGG", type=>"IV", macro=>"1", value=>"4"},
447             {name=>"GGL", type=>"IV", macro=>"1", value=>"32"},
448             {name=>"GGp", type=>"IV", macro=>"1", value=>"29"},
449             {name=>"GL", type=>"IV", macro=>"1", value=>"23"},
450             {name=>"GVE", type=>"IV", macro=>"1", value=>"22"},
451             {name=>"GVI", type=>"IV", macro=>"1", value=>"22"},
452             {name=>"GnG", type=>"IV", macro=>"1", value=>"26"},
453             {name=>"GnP", type=>"IV", macro=>"1", value=>"12"},
454             {name=>"Gp", type=>"IV", macro=>"1", value=>"1"},
455             {name=>"L", type=>"IV", macro=>"1", value=>"11"},
456             {name=>"LG", type=>"IV", macro=>"1", value=>"24"},
457             {name=>"LGD0,L,", type=>"IV", macro=>"1", value=>"45"},
458             {name=>"LV=GGEpD0,L,D0,L,", type=>"IV", macro=>"1", value=>"73"},
459             {name=>"LV=GGIpD0,L,D0,L,", type=>"IV", macro=>"1", value=>"73"},
460             {name=>"V=GEp", type=>"IV", macro=>"1", value=>"27"},
461             {name=>"V=GGEDG", type=>"IV", macro=>"1", value=>"47"},
462             {name=>"V=GGEp", type=>"IV", macro=>"1", value=>"37"},
463             {name=>"V=GGIDG", type=>"IV", macro=>"1", value=>"47"},
464             {name=>"V=GGIp", type=>"IV", macro=>"1", value=>"37"},
465             {name=>"V=GIp", type=>"IV", macro=>"1", value=>"27"},
466             {name=>"lG", type=>"IV", macro=>"1", value=>"10"},
467             {name=>"lGG", type=>"IV", macro=>"1", value=>"20"},
468             {name=>"lGGG", type=>"IV", macro=>"1", value=>"30"},
469             {name=>"ls", type=>"IV", macro=>"1", value=>"16"},
470             {name=>"p", type=>"IV", macro=>"1", value=>"0"},
471             {name=>"vGVE", type=>"IV", macro=>"1", value=>"84"},
472             {name=>"vGVI", type=>"IV", macro=>"1", value=>"84"},
473             {name=>"vLGG", type=>"IV", macro=>"1", value=>"35"},
474             {name=>"vLGGGG", type=>"IV", macro=>"1", value=>"59"},
475             {name=>"vLL", type=>"IV", macro=>"1", value=>"19"},
476             {name=>"vLLL", type=>"IV", macro=>"1", value=>"34"},
477             {name=>"vLs", type=>"IV", macro=>"1", value=>"57"},
478             {name=>"vS", type=>"IV", macro=>"1", value=>"85"},
479             {name=>"vV=GED0,L,", type=>"IV", macro=>"1", value=>"87"},
480             {name=>"vV=GGE", type=>"IV", macro=>"1", value=>"83"},
481             {name=>"vV=GGGE", type=>"IV", macro=>"1", value=>"86"},
482             {name=>"vV=GGGI", type=>"IV", macro=>"1", value=>"86"},
483             {name=>"vV=GGI", type=>"IV", macro=>"1", value=>"83"},
484             {name=>"vV=GID0,L,", type=>"IV", macro=>"1", value=>"87"});
485 
486 print constant_types(); # macro defs
487 foreach (C_constant ("Math::Pari::func_type", 'func_ord_by_type', 'IV', $types, undef, 3, @names) ) {
488     print $_, "\n"; # C constant subs
489 }
490 print "#### XS Section:\n";
491 print XS_constant ("Math::Pari::func_type", $types);
492 __END__
493    */
494 
495   switch (len) {
496   case 1:
497     return func_ord_by_type_1 (aTHX_ name, iv_return);
498     break;
499   case 2:
500     return func_ord_by_type_2 (aTHX_ name, iv_return);
501     break;
502   case 3:
503     return func_ord_by_type_3 (aTHX_ name, iv_return);
504     break;
505   case 4:
506     return func_ord_by_type_4 (aTHX_ name, iv_return);
507     break;
508   case 5:
509     return func_ord_by_type_5 (aTHX_ name, iv_return);
510     break;
511   case 6:
512     return func_ord_by_type_6 (aTHX_ name, iv_return);
513     break;
514   case 7:
515     return func_ord_by_type_7 (aTHX_ name, iv_return);
516     break;
517   case 8:
518     return func_ord_by_type_8 (aTHX_ name, iv_return);
519     break;
520   case 9:
521     /* Names all of length 9.  */
522     /* "GD0,L,DGp" "GGGD0,L,p" */
523     /* Offset 1 gives the best switch position.  */
524     switch (name[1]) {
525     case 'D':
526       if (memEQ(name, "GD0,L,DGp", 9)) {
527       /*                ^             */
528         *iv_return = 96;
529         return PERL_constant_ISIV;
530       }
531       break;
532     case 'G':
533       if (memEQ(name, "GGGD0,L,p", 9)) {
534       /*                ^             */
535         *iv_return = 33;
536         return PERL_constant_ISIV;
537       }
538       break;
539     }
540     break;
541   case 10:
542     /* Names all of length 10.  */
543     /* "vV=GED0,L," "vV=GID0,L," */
544     /* Offset 4 gives the best switch position.  */
545     switch (name[4]) {
546     case 'E':
547       if (memEQ(name, "vV=GED0,L,", 10)) {
548       /*                   ^            */
549         *iv_return = 87;
550         return PERL_constant_ISIV;
551       }
552       break;
553     case 'I':
554       if (memEQ(name, "vV=GID0,L,", 10)) {
555       /*                   ^            */
556         *iv_return = 87;
557         return PERL_constant_ISIV;
558       }
559       break;
560     }
561     break;
562   case 11:
563     /* Names all of length 11.  */
564     /* "GD0,L,D0,G," "GDGDGD0,L,p" */
565     /* Offset 7 gives the best switch position.  */
566     switch (name[7]) {
567     case ',':
568       if (memEQ(name, "GDGDGD0,L,p", 11)) {
569       /*                      ^          */
570         *iv_return = 62;
571         return PERL_constant_ISIV;
572       }
573       break;
574     case '0':
575       if (memEQ(name, "GD0,L,D0,G,", 11)) {
576       /*                      ^          */
577         *iv_return = 13;
578         return PERL_constant_ISIV;
579       }
580       break;
581     }
582     break;
583   case 17:
584     return func_ord_by_type_17 (aTHX_ name, iv_return);
585     break;
586   }
587   return PERL_constant_NOTFOUND;
588 }
589 
590