libpurple/plugins/perl/common/fallback/const-xs.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 15894
765ec644ac47
child 16238
33bf2fd32108
child 18068
b6554e3c8224
child 20478
46933dc62880
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 void
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 constant(sv)
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 PREINIT:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 #ifdef dXSTARG
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 dXSTARG; /* Faster if we have it. */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 #else
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 dTARGET;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 #endif
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 STRLEN len;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 int type;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 IV iv;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 /* NV nv; Uncomment this if you need to return NVs */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 /* const char *pv; Uncomment this if you need to return PVs */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 INPUT:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 SV * sv;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 const char * s = SvPV(sv, len);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 PPCODE:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 /* Change this to constant(aTHX_ s, len, &iv, &nv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 if you need to return both NVs and IVs */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 type = constant(aTHX_ s, len, &iv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 /* Return 1 or 2 items. First is error message, or undef if no error.
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 Second, if present, is found value */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 switch (type) {
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 case PERL_constant_NOTFOUND:
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
25 sv = sv_2mortal(newSVpvf("%s is not a valid Purple::DebugLevel macro", s));
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 PUSHs(sv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 case PERL_constant_NOTDEF:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 sv = sv_2mortal(newSVpvf(
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
30 "Your vendor has not defined Purple::DebugLevel macro %s, used", s));
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 PUSHs(sv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 case PERL_constant_ISIV:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 EXTEND(SP, 1);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 PUSHs(&PL_sv_undef);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 PUSHi(iv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 break;
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 /* Uncomment this if you need to return NOs
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 case PERL_constant_ISNO:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 EXTEND(SP, 1);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 PUSHs(&PL_sv_undef);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 PUSHs(&PL_sv_no);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 break; */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 /* Uncomment this if you need to return NVs
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 case PERL_constant_ISNV:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 EXTEND(SP, 1);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 PUSHs(&PL_sv_undef);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 PUSHn(nv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 break; */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 /* Uncomment this if you need to return PVs
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 case PERL_constant_ISPV:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 EXTEND(SP, 1);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 PUSHs(&PL_sv_undef);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 PUSHp(pv, strlen(pv));
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 break; */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 /* Uncomment this if you need to return PVNs
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 case PERL_constant_ISPVN:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 EXTEND(SP, 1);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 PUSHs(&PL_sv_undef);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 PUSHp(pv, iv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 break; */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 /* Uncomment this if you need to return SVs
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 case PERL_constant_ISSV:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 EXTEND(SP, 1);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 PUSHs(&PL_sv_undef);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 PUSHs(sv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 break; */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 /* Uncomment this if you need to return UNDEFs
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 case PERL_constant_ISUNDEF:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 break; */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 /* Uncomment this if you need to return UVs
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 case PERL_constant_ISUV:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 EXTEND(SP, 1);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 PUSHs(&PL_sv_undef);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 PUSHu((UV)iv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 break; */
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 /* Uncomment this if you need to return YESs
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 case PERL_constant_ISYES:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 EXTEND(SP, 1);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 PUSHs(&PL_sv_undef);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 PUSHs(&PL_sv_yes);
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 default:
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 sv = sv_2mortal(newSVpvf(
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
85 "Unexpected return type %d while processing Purple::DebugLevel macro %s, used",
6678
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 type, s));
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 PUSHs(sv);
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 }

mercurial