Sat, 27 Sep 2003 19:17:21 +0000
[gaim-migrate @ 7538]
This is Mr. Holland's Opus. And by Mr. Holland I mean Robot101. He
rewrote the coreish IM image support so that the binary data gets
ripped out in the prpl and put in an imgstore instead of just being
passed in the same huge as char string as the actual message. This
is good because it's prpl agnostic, or something. It also means
we don't have a silly length of "-1" with pretty much every send or
receive IM function.
It should be crash free, bug free, and memleak free, but additional
testing is always a good thing.
If you like good stuff then you'll love this patch. But don't take
my word for it--ba dun dunt!
| 6678 | 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 | ||
| 23 | static int | |
| 24 | constant (pTHX_ const char *name, STRLEN len, IV *iv_return) { | |
| 25 | /* Initially switch on the length of the name. */ | |
| 26 | /* When generated this function returned values for the list of names given | |
| 27 | in this section of perl code. Rather than manually editing these functions | |
| 28 | to add or remove constants, which would result in this comment and section | |
| 29 | of code becoming inaccurate, we recommend that you edit this section of | |
| 30 | code, and use it to regenerate a new set of constant functions which you | |
| 31 | then use to replace the originals. | |
| 32 | ||
| 33 | Regenerate these constant functions by feeding this entire source file to | |
| 34 | perl -x | |
| 35 | ||
| 36 | #!/usr/bin/perl -w | |
| 37 | use ExtUtils::Constant qw (constant_types C_constant XS_constant); | |
| 38 | ||
| 39 | my $types = {map {($_, 1)} qw(IV)}; | |
| 40 | my @names = (qw(), | |
| 41 | {name=>"GAIM_DEBUG_ALL", type=>"IV", macro=>"1"}, | |
| 42 | {name=>"GAIM_DEBUG_ERROR", type=>"IV", macro=>"1"}, | |
| 43 | {name=>"GAIM_DEBUG_FATAL", type=>"IV", macro=>"1"}, | |
| 44 | {name=>"GAIM_DEBUG_INFO", type=>"IV", macro=>"1"}, | |
| 45 | {name=>"GAIM_DEBUG_MISC", type=>"IV", macro=>"1"}, | |
| 46 | {name=>"GAIM_DEBUG_WARNING", type=>"IV", macro=>"1"}); | |
| 47 | ||
| 48 | print constant_types(); # macro defs | |
| 49 | foreach (C_constant ("Gaim::DebugLevel", 'constant', 'IV', $types, undef, 3, @names) ) { | |
| 50 | print $_, "\n"; # C constant subs | |
| 51 | } | |
| 52 | print "#### XS Section:\n"; | |
| 53 | print XS_constant ("Gaim::DebugLevel", $types); | |
| 54 | __END__ | |
| 55 | */ | |
| 56 | ||
| 57 | switch (len) { | |
| 58 | case 14: | |
| 59 | if (memEQ(name, "GAIM_DEBUG_ALL", 14)) { | |
| 60 | *iv_return = GAIM_DEBUG_ALL; | |
| 61 | return PERL_constant_ISIV; | |
| 62 | } | |
| 63 | break; | |
| 64 | case 15: | |
| 65 | /* Names all of length 15. */ | |
| 66 | /* GAIM_DEBUG_INFO GAIM_DEBUG_MISC */ | |
| 67 | /* Offset 11 gives the best switch position. */ | |
| 68 | switch (name[11]) { | |
| 69 | case 'I': | |
| 70 | if (memEQ(name, "GAIM_DEBUG_INFO", 15)) { | |
| 71 | /* ^ */ | |
| 72 | *iv_return = GAIM_DEBUG_INFO; | |
| 73 | return PERL_constant_ISIV; | |
| 74 | } | |
| 75 | break; | |
| 76 | case 'M': | |
| 77 | if (memEQ(name, "GAIM_DEBUG_MISC", 15)) { | |
| 78 | /* ^ */ | |
| 79 | *iv_return = GAIM_DEBUG_MISC; | |
| 80 | return PERL_constant_ISIV; | |
| 81 | } | |
| 82 | break; | |
| 83 | } | |
| 84 | break; | |
| 85 | case 16: | |
| 86 | /* Names all of length 16. */ | |
| 87 | /* GAIM_DEBUG_ERROR GAIM_DEBUG_FATAL */ | |
| 88 | /* Offset 11 gives the best switch position. */ | |
| 89 | switch (name[11]) { | |
| 90 | case 'E': | |
| 91 | if (memEQ(name, "GAIM_DEBUG_ERROR", 16)) { | |
| 92 | /* ^ */ | |
| 93 | *iv_return = GAIM_DEBUG_ERROR; | |
| 94 | return PERL_constant_ISIV; | |
| 95 | } | |
| 96 | break; | |
| 97 | case 'F': | |
| 98 | if (memEQ(name, "GAIM_DEBUG_FATAL", 16)) { | |
| 99 | /* ^ */ | |
| 100 | *iv_return = GAIM_DEBUG_FATAL; | |
| 101 | return PERL_constant_ISIV; | |
| 102 | } | |
| 103 | break; | |
| 104 | } | |
| 105 | break; | |
| 106 | case 18: | |
| 107 | if (memEQ(name, "GAIM_DEBUG_WARNING", 18)) { | |
| 108 | *iv_return = GAIM_DEBUG_WARNING; | |
| 109 | return PERL_constant_ISIV; | |
| 110 | } | |
| 111 | break; | |
| 112 | } | |
| 113 | return PERL_constant_NOTFOUND; | |
| 114 | } | |
| 115 |