annotate plugins/perl/common/fallback/const-c.inc @ 9854:e389922bdea7

[gaim-migrate @ 10733] You betta chiggaty check yoself befo you wiggaty wreck yoself. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 24 Aug 2004 22:08:53 +0000
parents eb95f31fa4eb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6678
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 #define PERL_constant_NOTFOUND 1
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 #define PERL_constant_NOTDEF 2
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 #define PERL_constant_ISIV 3
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 #define PERL_constant_ISNO 4
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 #define PERL_constant_ISNV 5
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 #define PERL_constant_ISPV 6
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 #define PERL_constant_ISPVN 7
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 #define PERL_constant_ISSV 8
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 #define PERL_constant_ISUNDEF 9
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 #define PERL_constant_ISUV 10
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 #define PERL_constant_ISYES 11
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 #ifndef NVTYPE
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 #endif
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 #ifndef aTHX_
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 #define aTHX_ /* 5.6 or later define this for threading support. */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 #endif
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 #ifndef pTHX_
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 #define pTHX_ /* 5.6 or later define this for threading support. */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 #endif
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 static int
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 /* Initially switch on the length of the name. */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 /* When generated this function returned values for the list of names given
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 in this section of perl code. Rather than manually editing these functions
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 to add or remove constants, which would result in this comment and section
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 of code becoming inaccurate, we recommend that you edit this section of
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 code, and use it to regenerate a new set of constant functions which you
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 then use to replace the originals.
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 Regenerate these constant functions by feeding this entire source file to
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 perl -x
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 #!/usr/bin/perl -w
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 use ExtUtils::Constant qw (constant_types C_constant XS_constant);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 my $types = {map {($_, 1)} qw(IV)};
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 my @names = (qw(),
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 {name=>"GAIM_DEBUG_ALL", type=>"IV", macro=>"1"},
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 {name=>"GAIM_DEBUG_ERROR", type=>"IV", macro=>"1"},
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 {name=>"GAIM_DEBUG_FATAL", type=>"IV", macro=>"1"},
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 {name=>"GAIM_DEBUG_INFO", type=>"IV", macro=>"1"},
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 {name=>"GAIM_DEBUG_MISC", type=>"IV", macro=>"1"},
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 {name=>"GAIM_DEBUG_WARNING", type=>"IV", macro=>"1"});
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 print constant_types(); # macro defs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 foreach (C_constant ("Gaim::DebugLevel", 'constant', 'IV', $types, undef, 3, @names) ) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 print $_, "\n"; # C constant subs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 print "#### XS Section:\n";
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 print XS_constant ("Gaim::DebugLevel", $types);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 __END__
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 switch (len) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 case 14:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 if (memEQ(name, "GAIM_DEBUG_ALL", 14)) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 *iv_return = GAIM_DEBUG_ALL;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 return PERL_constant_ISIV;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 case 15:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 /* Names all of length 15. */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 /* GAIM_DEBUG_INFO GAIM_DEBUG_MISC */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 /* Offset 11 gives the best switch position. */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 switch (name[11]) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 case 'I':
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 if (memEQ(name, "GAIM_DEBUG_INFO", 15)) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 /* ^ */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 *iv_return = GAIM_DEBUG_INFO;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 return PERL_constant_ISIV;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 case 'M':
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 if (memEQ(name, "GAIM_DEBUG_MISC", 15)) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 /* ^ */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 *iv_return = GAIM_DEBUG_MISC;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 return PERL_constant_ISIV;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 case 16:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 /* Names all of length 16. */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 /* GAIM_DEBUG_ERROR GAIM_DEBUG_FATAL */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 /* Offset 11 gives the best switch position. */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 switch (name[11]) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 case 'E':
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 if (memEQ(name, "GAIM_DEBUG_ERROR", 16)) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 /* ^ */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 *iv_return = GAIM_DEBUG_ERROR;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 return PERL_constant_ISIV;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 case 'F':
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 if (memEQ(name, "GAIM_DEBUG_FATAL", 16)) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 /* ^ */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 *iv_return = GAIM_DEBUG_FATAL;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 return PERL_constant_ISIV;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 case 18:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 if (memEQ(name, "GAIM_DEBUG_WARNING", 18)) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 *iv_return = GAIM_DEBUG_WARNING;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 return PERL_constant_ISIV;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 return PERL_constant_NOTFOUND;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 }
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115