libpurple/plugins/perl/common/fallback/const-c.inc

Thu, 30 Oct 2008 22:40:49 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Thu, 30 Oct 2008 22:40:49 +0000
changeset 24569
5dbd0617a27d
parent 22143
778676c8ac77
permissions
-rw-r--r--

Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
to detect when we're still using deprecated functions internally (and by
extension, when we've deprecated something we shouldn't have). In the
course of developing this changeset, I fixed a few such cases.

Given that the plan is to switch from PURPLE_HIDE_STRUCTS to
PURPLE_DISABLE_DEPRECATED as each struct is fully dealt with, this will
also ensure we have no regressions on the struct hiding work.

Deprecated functions are still available to the respective .c file, to
avoid missing prototype errors. Also, Perl and DBus undef the
*_DISABLE_DEPRECATED defines as appropriate so that deprecated functions
will still be exported to Perl plugins and via DBus. (Otherwise, we'd
be breaking backwards compatibility.)

6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 #define PERL_constant_NOTFOUND 1
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 #define PERL_constant_NOTDEF 2
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 #define PERL_constant_ISIV 3
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 #define PERL_constant_ISNO 4
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 #define PERL_constant_ISNV 5
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 #define PERL_constant_ISPV 6
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 #define PERL_constant_ISPVN 7
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 #define PERL_constant_ISSV 8
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 #define PERL_constant_ISUNDEF 9
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 #define PERL_constant_ISUV 10
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 #define PERL_constant_ISYES 11
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 #ifndef NVTYPE
c633179afd00 [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. */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 #endif
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 #ifndef aTHX_
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 #define aTHX_ /* 5.6 or later define this for threading support. */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 #endif
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 #ifndef pTHX_
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 #define pTHX_ /* 5.6 or later define this for threading support. */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 #endif
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 static int
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 /* Initially switch on the length of the name. */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 /* When generated this function returned values for the list of names given
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 in this section of perl code. Rather than manually editing these functions
c633179afd00 [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
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 of code becoming inaccurate, we recommend that you edit this section of
c633179afd00 [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
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 then use to replace the originals.
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 Regenerate these constant functions by feeding this entire source file to
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 perl -x
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35
22143
778676c8ac77 Don't assume perl is at /usr/bin/perl, use /usr/bin/env instead. This is not
Richard Laager <rlaager@pidgin.im>
parents: 15894
diff changeset
36 #!/usr/bin/env perl -w
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 use ExtUtils::Constant qw (constant_types C_constant XS_constant);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 my $types = {map {($_, 1)} qw(IV)};
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 my @names = (qw(),
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
41 {name=>"PURPLE_DEBUG_ALL", type=>"IV", macro=>"1"},
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
42 {name=>"PURPLE_DEBUG_ERROR", type=>"IV", macro=>"1"},
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
43 {name=>"PURPLE_DEBUG_FATAL", type=>"IV", macro=>"1"},
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
44 {name=>"PURPLE_DEBUG_INFO", type=>"IV", macro=>"1"},
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
45 {name=>"PURPLE_DEBUG_MISC", type=>"IV", macro=>"1"},
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
46 {name=>"PURPLE_DEBUG_WARNING", type=>"IV", macro=>"1"});
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 print constant_types(); # macro defs
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
49 foreach (C_constant ("Purple::DebugLevel", 'constant', 'IV', $types, undef, 3, @names) ) {
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 print $_, "\n"; # C constant subs
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 print "#### XS Section:\n";
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
53 print XS_constant ("Purple::DebugLevel", $types);
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 __END__
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 switch (len) {
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 case 14:
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
59 if (memEQ(name, "PURPLE_DEBUG_ALL", 14)) {
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
60 *iv_return = PURPLE_DEBUG_ALL;
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 return PERL_constant_ISIV;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 case 15:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 /* Names all of length 15. */
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
66 /* PURPLE_DEBUG_INFO PURPLE_DEBUG_MISC */
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 /* Offset 11 gives the best switch position. */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 switch (name[11]) {
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 case 'I':
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
70 if (memEQ(name, "PURPLE_DEBUG_INFO", 15)) {
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 /* ^ */
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
72 *iv_return = PURPLE_DEBUG_INFO;
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 return PERL_constant_ISIV;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 case 'M':
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
77 if (memEQ(name, "PURPLE_DEBUG_MISC", 15)) {
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 /* ^ */
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
79 *iv_return = PURPLE_DEBUG_MISC;
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 return PERL_constant_ISIV;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 case 16:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 /* Names all of length 16. */
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
87 /* PURPLE_DEBUG_ERROR PURPLE_DEBUG_FATAL */
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 /* Offset 11 gives the best switch position. */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 switch (name[11]) {
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 case 'E':
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
91 if (memEQ(name, "PURPLE_DEBUG_ERROR", 16)) {
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 /* ^ */
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
93 *iv_return = PURPLE_DEBUG_ERROR;
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 return PERL_constant_ISIV;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 case 'F':
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
98 if (memEQ(name, "PURPLE_DEBUG_FATAL", 16)) {
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 /* ^ */
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
100 *iv_return = PURPLE_DEBUG_FATAL;
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 return PERL_constant_ISIV;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 case 18:
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
107 if (memEQ(name, "PURPLE_DEBUG_WARNING", 18)) {
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
108 *iv_return = PURPLE_DEBUG_WARNING;
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 return PERL_constant_ISIV;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 return PERL_constant_NOTFOUND;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 }
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115

mercurial