comparison libpurple/plugins/perl/common/Status.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 08b9f27cf219
comparison
equal deleted inserted replaced
16700:79bc35a19de5 16739:39c7bb133a9f
39 39
40 */ 40 */
41 41
42 MODULE = Purple::Status PACKAGE = Purple::Presence PREFIX = purple_presence_ 42 MODULE = Purple::Status PACKAGE = Purple::Presence PREFIX = purple_presence_
43 PROTOTYPES: ENABLE 43 PROTOTYPES: ENABLE
44
45 BOOT:
46 {
47 HV *context_stash = gv_stashpv("Purple::Presence::Context", 1);
48 HV *primitive_stash = gv_stashpv("Purple::Status::Primitive", 1);
49
50 static const constiv *civ, context_const_iv[] = {
51 #define const_iv(name) {#name, (IV)PURPLE_PRESENCE_CONTEXT_##name}
52 const_iv(UNSET),
53 const_iv(ACCOUNT),
54 const_iv(CONV),
55 const_iv(BUDDY),
56 };
57 static const constiv primitive_const_iv[] = {
58 #undef const_iv
59 #define const_iv(name) {#name, (IV)PURPLE_STATUS_##name}
60 const_iv(UNSET),
61 const_iv(OFFLINE),
62 const_iv(AVAILABLE),
63 const_iv(UNAVAILABLE),
64 const_iv(INVISIBLE),
65 const_iv(AWAY),
66 const_iv(EXTENDED_AWAY),
67 const_iv(MOBILE),
68 };
69
70 for (civ = context_const_iv + sizeof(context_const_iv) / sizeof(context_const_iv[0]); civ-- > context_const_iv; )
71 newCONSTSUB(context_stash, (char *)civ->name, newSViv(civ->iv));
72
73 for (civ = primitive_const_iv + sizeof(primitive_const_iv) / sizeof(primitive_const_iv[0]); civ-- > primitive_const_iv; )
74 newCONSTSUB(primitive_stash, (char *)civ->name, newSViv(civ->iv));
75 }
44 76
45 void 77 void
46 purple_presence_add_list(presence, source_list) 78 purple_presence_add_list(presence, source_list)
47 Purple::Presence presence 79 Purple::Presence presence
48 SV *source_list 80 SV *source_list