plugins/perl/common/fallback/const-xs.inc

Sun, 17 Oct 2004 23:55:49 +0000

author
Sean Egan <seanegan@pidgin.im>
date
Sun, 17 Oct 2004 23:55:49 +0000
changeset 10108
0897c42d6cb9
parent 6678
c633179afd00
permissions
-rw-r--r--

[gaim-migrate @ 11141]
Two things:
a. Added Enter as a gtk_binding to GtkIMHtml. This fixes everything.
Input methods now work. The "Enter sends" and "Ctrl-Enter sends" preferences
were removed and defaulted to yes and no respectively, BUT, in a very super-cool
turn of events, you can now add your own bindings to .gtkrc to make WHATEVER
YOU WANT send. Awesome. Someone should use g_signal_accumulator_true_handled
or something to make profiles and away messages able to insert newlines.

b. Removed "Use multi-colored screennames in chats," defaulted to yes, and
wrote a nifty algorithm to automatically adjust the colors to accomodate the
background (see http://gaim.sf.net/sean/porn-chat.png). People should play
around and tweak it a bit. The algorithm takes into consideration the
luminosity of the current background and the base hue to use for the screenname
in generating the new colors. Note that it does this while maintaining the hues.
Someone should optimize this so it skips over the floating point arithmatic when
the background color is white.

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:
c633179afd00 [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));
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(
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 "Your vendor has not defined Gaim::DebugLevel macro %s, used", s));
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(
c633179afd00 [gaim-migrate @ 7203]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 "Unexpected return type %d while processing Gaim::DebugLevel macro %s, used",
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