comparison libpurple/plugins/perl/common/Pounce.xs @ 16739:39c7bb133a9f

Remove the const-c and const-xs stuff and replace it with real constants exposed to perl.
author Etan Reisner <pidgin@unreliablesource.net>
date Tue, 01 May 2007 02:34:22 +0000
parents 2f8274ce570a
children 4dc66862203f
comparison
equal deleted inserted replaced
16700:79bc35a19de5 16739:39c7bb133a9f
1 #include "module.h" 1 #include "module.h"
2 2
3 MODULE = Purple::Pounce PACKAGE = Purple::Pounce PREFIX = purple_pounce_ 3 MODULE = Purple::Pounce PACKAGE = Purple::Pounce PREFIX = purple_pounce_
4 PROTOTYPES: ENABLE 4 PROTOTYPES: ENABLE
5
6 BOOT:
7 {
8 HV *event_stash = gv_stashpv("Purple::Pounce::Event", 1);
9 HV *option_stash = gv_stashpv("Purple::Pounce::Option", 1);
10
11 static const constiv *civ, event_const_iv[] = {
12 #define const_iv(name) {#name, (IV)PURPLE_POUNCE_##name}
13 const_iv(NONE),
14 const_iv(SIGNON),
15 const_iv(SIGNOFF),
16 const_iv(AWAY),
17 const_iv(AWAY_RETURN),
18 const_iv(IDLE),
19 const_iv(IDLE_RETURN),
20 const_iv(TYPING),
21 const_iv(TYPED),
22 const_iv(TYPING_STOPPED),
23 const_iv(MESSAGE_RECEIVED),
24 };
25 static const constiv option_const_iv[] = {
26 #undef const_iv
27 #define const_iv(name) {#name, (IV)PURPLE_POUNCE_OPTION_##name}
28 const_iv(NONE),
29 const_iv(AWAY),
30 };
31
32 for (civ = event_const_iv + sizeof(event_const_iv) / sizeof(event_const_iv[0]); civ-- > event_const_iv; )
33 newCONSTSUB(event_stash, (char *)civ->name, newSViv(civ->iv));
34
35 for (civ = option_const_iv + sizeof(option_const_iv) / sizeof(option_const_iv[0]); civ-- > option_const_iv; )
36 newCONSTSUB(option_stash, (char *)civ->name, newSViv(civ->iv));
37 }
5 38
6 void 39 void
7 purple_pounce_action_register(pounce, name) 40 purple_pounce_action_register(pounce, name)
8 Purple::Pounce pounce 41 Purple::Pounce pounce
9 const char *name 42 const char *name