#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_2 (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. KB KC KD KE KF KG KH KI KJ KM KS KT KU KV KZ XD XT */ /* Offset 1 gives the best switch position. */ switch (name[1]) { case 'B': if (name[0] == 'K') { #ifdef KB *iv_return = KB; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'C': if (name[0] == 'K') { #ifdef KC *iv_return = KC; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'D': if (name[0] == 'K') { #ifdef KD *iv_return = KD; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (name[0] == 'X') { #ifdef XD *iv_return = XD; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'E': if (name[0] == 'K') { #ifdef KE *iv_return = KE; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'F': if (name[0] == 'K') { #ifdef KF *iv_return = KF; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'G': if (name[0] == 'K') { #ifdef KG *iv_return = KG; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'H': if (name[0] == 'K') { #ifdef KH *iv_return = KH; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'I': if (name[0] == 'K') { #ifdef KI *iv_return = KI; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'J': if (name[0] == 'K') { #ifdef KJ *iv_return = KJ; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'M': if (name[0] == 'K') { #ifdef KM *iv_return = KM; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'S': if (name[0] == 'K') { #ifdef KS *iv_return = KS; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'T': if (name[0] == 'K') { #ifdef KT *iv_return = KT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } if (name[0] == 'X') { #ifdef XT *iv_return = XT; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'U': if (name[0] == 'K') { #ifdef KU *iv_return = KU; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'V': if (name[0] == 'K') { #ifdef KV *iv_return = KV; return PERL_constant_ISIV; #else return PERL_constant_NOTDEF; #endif } break; case 'Z': if (name[0] == 'K') { #ifdef KZ *iv_return = KZ; 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 #!/usr/bin/perl -w use ExtUtils::Constant qw (constant_types C_constant XS_constant); my $types = {map {($_, 1)} qw(IV)}; my @names = (qw(KB KC KD KE KF KG KH KI KJ KM KS KT KU KV KZ XD XT)); print constant_types(); # macro defs foreach (C_constant ("K", 'constant', 'IV', $types, undef, 3, @names) ) { print $_, "\n"; # C constant subs } print "#### XS Section:\n"; print XS_constant ("K", $types); __END__ */ switch (len) { case 2: return constant_2 (aTHX_ name, iv_return); break; } return PERL_constant_NOTFOUND; }