Mercurial > pidgin.yaz
diff libpurple/plugins/perl/common/Request.xs @ 16750: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 | 08db93bbd798 |
children | 8e54f40a60f3 |
line wrap: on
line diff
--- a/libpurple/plugins/perl/common/Request.xs Mon Apr 30 05:06:29 2007 +0000 +++ b/libpurple/plugins/perl/common/Request.xs Tue May 01 02:34:22 2007 +0000 @@ -80,6 +80,41 @@ MODULE = Purple::Request PACKAGE = Purple::Request PREFIX = purple_request_ PROTOTYPES: ENABLE +BOOT: +{ + HV *request_stash = gv_stashpv("Purple::RequestType", 1); + HV *request_field_stash = gv_stashpv("Purple::RequestFieldType", 1); + + static const constiv *civ, request_const_iv[] = { +#define const_iv(name) {#name, (IV)PURPLE_REQUEST_##name} + const_iv(INPUT), + const_iv(CHOICE), + const_iv(ACTION), + const_iv(FIELDS), + const_iv(FILE), + const_iv(FOLDER), + }; + static const constiv request_field_const_iv[] = { +#undef const_iv +#define const_iv(name) {#name, (IV)PURPLE_REQUEST_FIELD_##name} + const_iv(NONE), + const_iv(STRING), + const_iv(INTEGER), + const_iv(BOOLEAN), + const_iv(CHOICE), + const_iv(LIST), + const_iv(LABEL), + const_iv(IMAGE), + const_iv(ACCOUNT), + }; + + for (civ = request_const_iv + sizeof(request_const_iv) / sizeof(request_const_iv[0]); civ-- > request_const_iv; ) + newCONSTSUB(request_stash, (char *)civ->name, newSViv(civ->iv)); + + for (civ = request_field_const_iv + sizeof(request_field_const_iv) / sizeof(request_field_const_iv[0]); civ-- > request_field_const_iv; ) + newCONSTSUB(request_field_stash, (char *)civ->name, newSViv(civ->iv)); +} + void * purple_request_input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, ok_cb, cancel_text, cancel_cb) Purple::Plugin handle