annotate plugins/perl/common/fallback/const-xs.inc @ 13729:74033e0831bc

[gaim-migrate @ 16140] Get rid of an assertion warning when saving an account without an alias that did not previous have an alias. Yay for --enable-fatal-asserts committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 07 May 2006 17:40:42 +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 void
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 constant(sv)
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 PREINIT:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 #ifdef dXSTARG
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 dXSTARG; /* Faster if we have it. */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 #else
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 dTARGET;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 #endif
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 STRLEN len;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 int type;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 IV iv;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 /* NV nv; Uncomment this if you need to return NVs */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 /* const char *pv; Uncomment this if you need to return PVs */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 INPUT:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 SV * sv;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 const char * s = SvPV(sv, len);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 PPCODE:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 /* Change this to constant(aTHX_ s, len, &iv, &nv);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 if you need to return both NVs and IVs */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 type = constant(aTHX_ s, len, &iv);
eb95f31fa4eb [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.
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 Second, if present, is found value */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 switch (type) {
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 case PERL_constant_NOTFOUND:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 sv = sv_2mortal(newSVpvf("%s is not a valid Gaim::DebugLevel macro", s));
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 PUSHs(sv);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 case PERL_constant_NOTDEF:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 sv = sv_2mortal(newSVpvf(
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 "Your vendor has not defined Gaim::DebugLevel macro %s, used", s));
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 PUSHs(sv);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 case PERL_constant_ISIV:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 EXTEND(SP, 1);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 PUSHs(&PL_sv_undef);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 PUSHi(iv);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 break;
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 /* Uncomment this if you need to return NOs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 case PERL_constant_ISNO:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 EXTEND(SP, 1);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 PUSHs(&PL_sv_undef);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 PUSHs(&PL_sv_no);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 break; */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 /* Uncomment this if you need to return NVs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 case PERL_constant_ISNV:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 EXTEND(SP, 1);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 PUSHs(&PL_sv_undef);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 PUSHn(nv);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 break; */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 /* Uncomment this if you need to return PVs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 case PERL_constant_ISPV:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 EXTEND(SP, 1);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 PUSHs(&PL_sv_undef);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 PUSHp(pv, strlen(pv));
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 break; */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 /* Uncomment this if you need to return PVNs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 case PERL_constant_ISPVN:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 EXTEND(SP, 1);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 PUSHs(&PL_sv_undef);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 PUSHp(pv, iv);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 break; */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 /* Uncomment this if you need to return SVs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 case PERL_constant_ISSV:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 EXTEND(SP, 1);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 PUSHs(&PL_sv_undef);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 PUSHs(sv);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 break; */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 /* Uncomment this if you need to return UNDEFs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 case PERL_constant_ISUNDEF:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 break; */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 /* Uncomment this if you need to return UVs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 case PERL_constant_ISUV:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 EXTEND(SP, 1);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 PUSHs(&PL_sv_undef);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 PUSHu((UV)iv);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 break; */
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 /* Uncomment this if you need to return YESs
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 case PERL_constant_ISYES:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 EXTEND(SP, 1);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 PUSHs(&PL_sv_undef);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 PUSHs(&PL_sv_yes);
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 default:
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 sv = sv_2mortal(newSVpvf(
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 "Unexpected return type %d while processing Gaim::DebugLevel macro %s, used",
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 type, s));
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 PUSHs(sv);
eb95f31fa4eb [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 }