changeset 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 79bc35a19de5
children 8e54f40a60f3
files libpurple/plugins/perl/Makefile.am libpurple/plugins/perl/common/BuddyList.xs libpurple/plugins/perl/common/Cmds.xs libpurple/plugins/perl/common/Connection.xs libpurple/plugins/perl/common/Conversation.xs libpurple/plugins/perl/common/Debug.xs libpurple/plugins/perl/common/FT.xs libpurple/plugins/perl/common/Log.xs libpurple/plugins/perl/common/Makefile.PL.in libpurple/plugins/perl/common/Makefile.mingw libpurple/plugins/perl/common/Notify.xs libpurple/plugins/perl/common/Plugin.xs libpurple/plugins/perl/common/PluginPref.xs libpurple/plugins/perl/common/Pounce.xs libpurple/plugins/perl/common/Prefs.xs libpurple/plugins/perl/common/Proxy.xs libpurple/plugins/perl/common/Purple.xs libpurple/plugins/perl/common/Request.xs libpurple/plugins/perl/common/Roomlist.xs libpurple/plugins/perl/common/Sound.xs libpurple/plugins/perl/common/Status.xs libpurple/plugins/perl/common/module.h libpurple/plugins/perl/perl.c
diffstat 23 files changed, 536 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/perl/Makefile.am	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/Makefile.am	Tue May 01 02:34:22 2007 +0000
@@ -73,9 +73,9 @@
 	common/Util.xs \
 	common/XMLNode.xs \
 	common/module.h \
-	common/typemap \
-	common/fallback/const-c.inc \
-	common/fallback/const-xs.inc
+	common/typemap
+#	common/fallback/const-c.inc \
+#	common/fallback/const-xs.inc
 
 EXTRA_DIST = \
 	Makefile.mingw \
@@ -139,7 +139,7 @@
 	done
 
 	@rm -f Makefile
-	@rm -f common/const-c.inc common/const-xs.inc
+#	@rm -f common/const-c.inc common/const-xs.inc
 
 	@if test "x${top_srcdir}" != "x${top_builddir}"; then \
 		for f in ${common_sources}; do \
--- a/libpurple/plugins/perl/common/BuddyList.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/BuddyList.xs	Tue May 01 02:34:22 2007 +0000
@@ -4,6 +4,26 @@
 MODULE = Purple::BuddyList  PACKAGE = Purple  PREFIX = purple_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *stash = gv_stashpv("Purple::BuddyList::Node", 1);
+
+	static const constiv *civ, const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_BLIST_##name##_NODE}
+		const_iv(GROUP),
+		const_iv(CONTACT),
+		const_iv(BUDDY),
+		const_iv(CHAT),
+		const_iv(OTHER),
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_BLIST_NODE_FLAG_##name}
+		const_iv(NO_SAVE),
+	};
+
+	for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
+		newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 Purple::BuddyList
 purple_get_blist()
 
--- a/libpurple/plugins/perl/common/Cmds.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Cmds.xs	Tue May 01 02:34:22 2007 +0000
@@ -4,6 +4,63 @@
 MODULE = Purple::Cmd  PACKAGE = Purple::Cmd  PREFIX = purple_cmd_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *status_stash = gv_stashpv("Purple::Cmd::Status", 1);
+	HV *ret_stash = gv_stashpv("Purple::Cmd::Return", 1);
+	HV *p_stash = gv_stashpv("Purple::Cmd::Priority", 1);
+	HV *flag_stash = gv_stashpv("Purple::Cmd::Flag", 1);
+
+	static const constiv *civ, status_const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_CMD_STATUS_##name}
+		const_iv(OK),
+		const_iv(FAILED),
+		const_iv(NOT_FOUND),
+		const_iv(WRONG_ARGS),
+		const_iv(WRONG_PRPL),
+		const_iv(WRONG_TYPE),
+	};
+	static const constiv ret_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_CMD_RET_##name}
+		const_iv(OK),
+		const_iv(FAILED),
+		const_iv(CONTINUE),
+	};
+	static const constiv p_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_CMD_P_##name}
+		const_iv(VERY_LOW),
+		const_iv(LOW),
+		const_iv(DEFAULT),
+		const_iv(PRPL),
+		const_iv(PLUGIN),
+		const_iv(ALIAS),
+		const_iv(HIGH),
+		const_iv(VERY_HIGH),
+	};
+	static const constiv flag_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_CMD_FLAG_##name}
+		const_iv(IM),
+		const_iv(CHAT),
+		const_iv(PRPL_ONLY),
+		const_iv(ALLOW_WRONG_ARGS),
+	};
+
+	for (civ = status_const_iv + sizeof(status_const_iv) / sizeof(status_const_iv[0]); civ-- > status_const_iv;)
+		newCONSTSUB(status_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = ret_const_iv + sizeof(ret_const_iv) / sizeof(ret_const_iv[0]); civ-- > ret_const_iv;)
+		newCONSTSUB(ret_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = p_const_iv + sizeof(p_const_iv) / sizeof(p_const_iv[0]); civ-- > p_const_iv;)
+		newCONSTSUB(p_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = flag_const_iv + sizeof(flag_const_iv) / sizeof(flag_const_iv[0]); civ-- > flag_const_iv;)
+		newCONSTSUB(flag_stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 void
 purple_cmd_help(conv, command)
 	Purple::Conversation conv
--- a/libpurple/plugins/perl/common/Connection.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Connection.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,21 @@
 MODULE = Purple::Connection  PACKAGE = Purple::Connection  PREFIX = purple_connection_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *stash = gv_stashpv("Purple::Connection::State", 1);
+
+	static const constiv *civ, const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_##name}
+		const_iv(DISCONNECTED),
+		const_iv(CONNECTED),
+		const_iv(CONNECTING),
+	};
+
+	for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
+		newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 Purple::Account
 purple_connection_get_account(gc)
 	Purple::Connection gc
--- a/libpurple/plugins/perl/common/Conversation.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Conversation.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,93 @@
 MODULE = Purple::Conversation  PACKAGE = Purple  PREFIX = purple_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *type_stash = gv_stashpv("Purple::Conversation::Type", 1);
+	HV *update_stash = gv_stashpv("Purple::Conversation::Update::Type", 1);
+	HV *typing_stash = gv_stashpv("Purple::Conversation::TypingState", 1);
+	HV *flags_stash = gv_stashpv("Purple::Conversation::Flags", 1);
+	HV *cbflags_stash = gv_stashpv("Purple::Conversation::ChatBuddy::Flags", 1);
+
+	static const constiv *civ, type_const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_CONV_TYPE_##name}
+		const_iv(UNKNOWN),
+		const_iv(IM),
+		const_iv(CHAT),
+		const_iv(MISC),
+		const_iv(ANY),
+	};
+	static const constiv update_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_CONV_UPDATE_##name}
+		const_iv(ADD),
+		const_iv(REMOVE),
+		const_iv(ACCOUNT),
+		const_iv(TYPING),
+		const_iv(UNSEEN),
+		const_iv(LOGGING),
+		const_iv(TOPIC),
+/*
+		const_iv(ONLINE),
+		const_iv(OFFLINE),
+*/
+		const_iv(AWAY),
+		const_iv(ICON),
+		const_iv(TITLE),
+		const_iv(CHATLEFT),
+		const_iv(FEATURES),
+	};
+	static const constiv typing_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_##name}
+		const_iv(NOT_TYPING),
+		const_iv(TYPING),
+		const_iv(TYPED),
+	};
+	static const constiv flags_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_MESSAGE_##name}
+		const_iv(SEND),
+		const_iv(RECV),
+		const_iv(SYSTEM),
+		const_iv(AUTO_RESP),
+		const_iv(ACTIVE_ONLY),
+		const_iv(NICK),
+		const_iv(NO_LOG),
+		const_iv(WHISPER),
+		const_iv(ERROR),
+		const_iv(DELAYED),
+		const_iv(RAW),
+		const_iv(IMAGES),
+		const_iv(NOTIFY),
+	};
+	static const constiv cbflags_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_CBFLAGS_##name}
+		const_iv(NONE),
+		const_iv(VOICE),
+		const_iv(HALFOP),
+		const_iv(OP),
+		const_iv(FOUNDER),
+		const_iv(TYPING),
+	};
+
+	for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; )
+		newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = update_const_iv + sizeof(update_const_iv) / sizeof(update_const_iv[0]); civ-- > update_const_iv; )
+		newCONSTSUB(update_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = typing_const_iv + sizeof(typing_const_iv) / sizeof(typing_const_iv[0]); civ-- > typing_const_iv; )
+		newCONSTSUB(typing_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = flags_const_iv + sizeof(flags_const_iv) / sizeof(flags_const_iv[0]); civ-- > flags_const_iv; )
+		newCONSTSUB(flags_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = cbflags_const_iv + sizeof(cbflags_const_iv) / sizeof(cbflags_const_iv[0]); civ-- > cbflags_const_iv; )
+		newCONSTSUB(cbflags_stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 void
 purple_get_ims()
 PREINIT:
--- a/libpurple/plugins/perl/common/Debug.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Debug.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,24 @@
 MODULE = Purple::Debug  PACKAGE = Purple::Debug  PREFIX = purple_debug_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *stash = gv_stashpv("Purple::Debug", 1);
+
+	static const constiv *civ, const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_DEBUG_##name}
+		const_iv(ALL),
+		const_iv(MISC),
+		const_iv(INFO),
+		const_iv(WARNING),
+		const_iv(ERROR),
+		const_iv(FATAL),
+	};
+
+	for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
+		newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 void
 purple_debug(level, category, string)
 	Purple::DebugLevel level
--- a/libpurple/plugins/perl/common/FT.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/FT.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,36 @@
 MODULE = Purple::Xfer  PACKAGE = Purple::Xfer  PREFIX = purple_xfer_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *type_stash = gv_stashpv("Purple::Xfer::Type", 1);
+	HV *status_stash = gv_stashpv("Purple::Xfer::Status", 1);
+
+	static const constiv *civ, type_const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_XFER_##name}
+		const_iv(UNKNOWN),
+		const_iv(SEND),
+		const_iv(RECEIVE),
+	};
+	static const constiv status_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_XFER_STATUS_##name}
+		const_iv(UNKNOWN),
+		const_iv(NOT_STARTED),
+		const_iv(ACCEPTED),
+		const_iv(STARTED),
+		const_iv(DONE),
+		const_iv(CANCEL_LOCAL),
+		const_iv(CANCEL_REMOTE),
+	};
+
+	for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; )
+		newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = status_const_iv + sizeof(status_const_iv) / sizeof(status_const_iv[0]); civ-- > status_const_iv; )
+		newCONSTSUB(status_stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 Purple::Xfer
 purple_xfer_new(class, account, type, who)
 	Purple::Account account
--- a/libpurple/plugins/perl/common/Log.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Log.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,30 @@
 MODULE = Purple::Log  PACKAGE = Purple::Log  PREFIX = purple_log_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *type_stash = gv_stashpv("Purple::Log::Type", 1);
+	HV *flags_stash = gv_stashpv("Purple::Log:ReadFlags::", 1);
+
+	static const constiv *civ, type_const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_LOG_##name}
+		const_iv(IM),
+		const_iv(CHAT),
+		const_iv(SYSTEM),
+	};
+	static const constiv flags_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_LOG_READ_##name}
+		const_iv(NO_NEWLINE),
+	};
+
+	for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; )
+		newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = flags_const_iv + sizeof(flags_const_iv) / sizeof(flags_const_iv[0]); civ-- > flags_const_iv; )
+		newCONSTSUB(flags_stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 int
 purple_log_common_sizer(log)
 	Purple::Log log
--- a/libpurple/plugins/perl/common/Makefile.PL.in	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Makefile.PL.in	Tue May 01 02:34:22 2007 +0000
@@ -14,26 +14,3 @@
     'OBJECT'            => '$(O_FILES)', # link all the C files too
 #    'OPTIMIZE'          => '-g', # For debugging
 );
-
-if (eval {require ExtUtils::Constant; 1}) {
-	foreach (qw(PURPLE_DEBUG_ALL PURPLE_DEBUG_MISC PURPLE_DEBUG_INFO
-	            PURPLE_DEBUG_WARNING PURPLE_DEBUG_ERROR PURPLE_DEBUG_FATAL)) {
-		push @names, {name => $_, type => "IV", macro => 1};
-	}
-
-	ExtUtils::Constant::WriteConstants(
-		NAME    => 'Purple::DebugLevel',
-		NAMES   => \@names,
-		C_FILE  => 'const-c.inc',
-		XS_FILE => 'const-xs.inc'
-	);
-}
-else {
-	use File::Copy;
-	use File::Spec;
-
-	foreach my $file ('const-c.inc', 'const-xs.inc') {
-		my $fallback = File::Spec->catfile('fallback', $file);
-		copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
-	}
-}
--- a/libpurple/plugins/perl/common/Makefile.mingw	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Makefile.mingw	Tue May 01 02:34:22 2007 +0000
@@ -68,7 +68,7 @@
 				Util.xs \
 				XMLNode.xs
 
-FALLBACKS =	const-c.inc const-xs.inc
+#FALLBACKS =	const-c.inc const-xs.inc
 C_FILES = $(XS_FILES:%.xs=%.c)
 OBJECTS = $(C_FILES:%.c=%.o)
 
--- a/libpurple/plugins/perl/common/Notify.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Notify.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,47 @@
 MODULE = Purple::Notify  PACKAGE = Purple::Notify  PREFIX = purple_notify_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *type_stash = gv_stashpv("Purple::Notify::Type", 1);
+	HV *msg_type_stash = gv_stashpv("Purple::Notify:Msg", 1);
+	HV *user_info_stash = gv_stashpv("Purple::NotifyUserInfo::Type", 1);
+
+	static const constiv *civ, type_const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_NOTIFY_##name}
+		const_iv(MESSAGE),
+		const_iv(EMAIL),
+		const_iv(EMAILS),
+		const_iv(FORMATTED),
+		const_iv(SEARCHRESULTS),
+		const_iv(USERINFO),
+		const_iv(URI),
+	};
+	static const constiv msg_type_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_NOTIFY_MSG_##name}
+		const_iv(ERROR),
+		const_iv(WARNING),
+		const_iv(INFO),
+	};
+	static const constiv user_info_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_NOTIFY_USER_INFO_ENTRY_##name}
+		const_iv(PAIR),
+		const_iv(SECTION_BREAK),
+		const_iv(SECTION_HEADER),
+	};
+
+	for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; )
+		newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = msg_type_const_iv + sizeof(msg_type_const_iv) / sizeof(msg_type_const_iv[0]); civ-- > msg_type_const_iv; )
+		newCONSTSUB(msg_type_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = user_info_const_iv + sizeof(user_info_const_iv) / sizeof(user_info_const_iv[0]); civ-- > user_info_const_iv; )
+		newCONSTSUB(user_info_stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 void
 purple_notify_close(type, ui_handle)
 	Purple::NotifyType type
--- a/libpurple/plugins/perl/common/Plugin.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Plugin.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,22 @@
 MODULE = Purple::Plugin  PACKAGE = Purple::Plugin  PREFIX = purple_plugin_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *stash = gv_stashpv("Purple::Plugin::Type", 1);
+
+	static const constiv *civ, const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_PLUGIN_##name}
+		const_iv(UNKNOWN),
+		const_iv(STANDARD),
+		const_iv(LOADER),
+		const_iv(PROTOCOL),
+	};
+
+	for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
+		newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 Purple::Plugin
 purple_plugin_new(native, path)
 	gboolean native
--- a/libpurple/plugins/perl/common/PluginPref.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/PluginPref.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,33 @@
 MODULE = Purple::PluginPref  PACKAGE = Purple::PluginPref::Frame  PREFIX = purple_plugin_pref_frame_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *string_format_stash = gv_stashpv("Purple::String::Format::Type", 1);
+	HV *plugin_pref_stash = gv_stashpv("Purple::PluginPref::Type", 1);
+
+	static const constiv *civ, string_format_const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_STRING_FORMAT_TYPE_##name}
+		const_iv(NONE),
+		const_iv(MULTILINE),
+		const_iv(HTML),
+	};
+	static const constiv plugin_pref_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_PLUGIN_PREF_##name}
+		const_iv(NONE),
+		const_iv(CHOICE),
+		const_iv(INFO),
+		const_iv(STRING_FORMAT),
+	};
+
+	for (civ = string_format_const_iv + sizeof(string_format_const_iv) / sizeof(string_format_const_iv[0]); civ-- > string_format_const_iv; )
+		newCONSTSUB(string_format_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = plugin_pref_const_iv + sizeof(plugin_pref_const_iv) / sizeof(plugin_pref_const_iv[0]); civ-- > plugin_pref_const_iv; )
+		newCONSTSUB(plugin_pref_stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 void
 purple_plugin_pref_frame_add(frame, pref)
 	Purple::PluginPref::Frame frame
--- a/libpurple/plugins/perl/common/Pounce.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Pounce.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,39 @@
 MODULE = Purple::Pounce  PACKAGE = Purple::Pounce  PREFIX = purple_pounce_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *event_stash = gv_stashpv("Purple::Pounce::Event", 1);
+	HV *option_stash = gv_stashpv("Purple::Pounce::Option", 1);
+
+	static const constiv *civ, event_const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_POUNCE_##name}
+		const_iv(NONE),
+		const_iv(SIGNON),
+		const_iv(SIGNOFF),
+		const_iv(AWAY),
+		const_iv(AWAY_RETURN),
+		const_iv(IDLE),
+		const_iv(IDLE_RETURN),
+		const_iv(TYPING),
+		const_iv(TYPED),
+		const_iv(TYPING_STOPPED),
+		const_iv(MESSAGE_RECEIVED),
+	};
+	static const constiv option_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_POUNCE_OPTION_##name}
+		const_iv(NONE),
+		const_iv(AWAY),
+	};
+
+	for (civ = event_const_iv + sizeof(event_const_iv) / sizeof(event_const_iv[0]); civ-- > event_const_iv; )
+		newCONSTSUB(event_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = option_const_iv + sizeof(option_const_iv) / sizeof(option_const_iv[0]); civ-- > option_const_iv; )
+		newCONSTSUB(option_stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 void
 purple_pounce_action_register(pounce, name)
 	Purple::Pounce pounce
--- a/libpurple/plugins/perl/common/Prefs.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Prefs.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,25 @@
 MODULE = Purple::Prefs  PACKAGE = Purple::Prefs  PREFIX = purple_prefs_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *stash = gv_stashpv("Purple::Pref::Type", 1);
+
+	static const constiv *civ, const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_PREF_##name}
+		const_iv(NONE),
+		const_iv(BOOLEAN),
+		const_iv(INT),
+		const_iv(STRING),
+		const_iv(STRING_LIST),
+		const_iv(PATH),
+		const_iv(PATH_LIST),
+	};
+
+	for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
+		newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 void
 purple_prefs_add_bool(name, value)
 	const char *name
--- a/libpurple/plugins/perl/common/Proxy.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Proxy.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,24 @@
 MODULE = Purple::Proxy  PACKAGE = Purple::Proxy  PREFIX = purple_proxy_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *stash = gv_stashpv("Purple::ProxyType::", 1);
+
+	static const constiv *civ, const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_PROXY_##name}
+		const_iv(USE_GLOBAL),
+		const_iv(NONE),
+		const_iv(HTTP),
+		const_iv(SOCKS4),
+		const_iv(SOCKS5),
+		const_iv(USE_ENVVAR),
+	};
+
+	for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
+		newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 Purple::ProxyInfo
 purple_global_proxy_get_info()
 
--- a/libpurple/plugins/perl/common/Purple.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Purple.xs	Tue May 01 02:34:22 2007 +0000
@@ -1,6 +1,5 @@
 #include "module.h"
 #include "../perl-handlers.h"
-#include "const-c.inc"
 
 /* Prototypes for the BOOT section below. */
 PURPLE_PERL_BOOT_PROTO(Account);
@@ -40,8 +39,6 @@
 MODULE = Purple PACKAGE = Purple PREFIX = purple_
 PROTOTYPES: ENABLE
 
-INCLUDE: const-xs.inc
-
 BOOT:
 	PURPLE_PERL_BOOT(Account);
 	PURPLE_PERL_BOOT(Account__Option);
--- 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
--- a/libpurple/plugins/perl/common/Roomlist.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Roomlist.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,31 @@
 MODULE = Purple::Roomlist  PACKAGE = Purple::Roomlist  PREFIX = purple_roomlist_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *room_stash = gv_stashpv("Purple::Roomlist::Room::Type", 1);
+	HV *field_stash = gv_stashpv("Purple::Roomlist::Field::Type", 1);
+
+	static const constiv *civ, room_const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_ROOMLIST_ROOMTYPE_##name}
+		const_iv(CATEGORY),
+		const_iv(ROOM),
+	};
+	static const constiv field_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_ROOMLIST_FIELD_##name}
+		const_iv(BOOL),
+		const_iv(INT),
+		const_iv(STRING),
+	};
+
+	for (civ = room_const_iv + sizeof(room_const_iv) / sizeof(room_const_iv[0]); civ-- > room_const_iv; )
+		newCONSTSUB(room_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = field_const_iv + sizeof(field_const_iv) / sizeof(field_const_iv[0]); civ-- > field_const_iv; )
+		newCONSTSUB(field_stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 void 
 purple_roomlist_cancel_get_list(list)
 	Purple::Roomlist list
--- a/libpurple/plugins/perl/common/Sound.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Sound.xs	Tue May 01 02:34:22 2007 +0000
@@ -3,6 +3,29 @@
 MODULE = Purple::Sound  PACKAGE = Purple::Sound  PREFIX = purple_sound_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *stash = gv_stashpv("Purple::SoundEventID", 1);
+
+	static const constiv *civ, const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_SOUND_##name}
+		const_iv(BUDDY_ARRIVE),
+		const_iv(BUDDY_LEAVE),
+		const_iv(RECEIVE),
+		const_iv(FIRST_RECEIVE),
+		const_iv(SEND),
+		const_iv(CHAT_JOIN),
+		const_iv(CHAT_LEAVE),
+		const_iv(CHAT_YOU_SAY),
+		const_iv(CHAT_SAY),
+		const_iv(POUNCE_DEFAULT),
+		const_iv(CHAT_NICK),
+	};
+
+	for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
+		newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 Purple::Sound::UiOps
 purple_sound_get_ui_ops()
 
--- a/libpurple/plugins/perl/common/Status.xs	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/Status.xs	Tue May 01 02:34:22 2007 +0000
@@ -42,6 +42,38 @@
 MODULE = Purple::Status  PACKAGE = Purple::Presence  PREFIX = purple_presence_
 PROTOTYPES: ENABLE
 
+BOOT:
+{
+	HV *context_stash = gv_stashpv("Purple::Presence::Context", 1);
+	HV *primitive_stash = gv_stashpv("Purple::Status::Primitive", 1);
+
+	static const constiv *civ, context_const_iv[] = {
+#define const_iv(name) {#name, (IV)PURPLE_PRESENCE_CONTEXT_##name}
+		const_iv(UNSET),
+		const_iv(ACCOUNT),
+		const_iv(CONV),
+		const_iv(BUDDY),
+	};
+	static const constiv primitive_const_iv[] = {
+#undef const_iv
+#define const_iv(name) {#name, (IV)PURPLE_STATUS_##name}
+		const_iv(UNSET),
+		const_iv(OFFLINE),
+		const_iv(AVAILABLE),
+		const_iv(UNAVAILABLE),
+		const_iv(INVISIBLE),
+		const_iv(AWAY),
+		const_iv(EXTENDED_AWAY),
+		const_iv(MOBILE),
+	};
+
+	for (civ = context_const_iv + sizeof(context_const_iv) / sizeof(context_const_iv[0]); civ-- > context_const_iv; )
+		newCONSTSUB(context_stash, (char *)civ->name, newSViv(civ->iv));
+
+	for (civ = primitive_const_iv + sizeof(primitive_const_iv) / sizeof(primitive_const_iv[0]); civ-- > primitive_const_iv; )
+		newCONSTSUB(primitive_stash, (char *)civ->name, newSViv(civ->iv));
+}
+
 void
 purple_presence_add_list(presence, source_list)
 	Purple::Presence presence
--- a/libpurple/plugins/perl/common/module.h	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/common/module.h	Tue May 01 02:34:22 2007 +0000
@@ -276,3 +276,7 @@
 
 typedef gchar gchar_own;
 
+typedef struct _constiv {
+	const char *name;
+	IV iv;
+} constiv;
--- a/libpurple/plugins/perl/perl.c	Mon Apr 30 05:06:29 2007 +0000
+++ b/libpurple/plugins/perl/perl.c	Tue May 01 02:34:22 2007 +0000
@@ -102,8 +102,13 @@
 static PurplePluginUiInfo ui_info =
 {
 	purple_perl_get_plugin_frame,
-	0,   /* page_num (Reserved) */
-	NULL /* frame (Reserved)    */
+	0,    /* page_num (Reserved) */
+	NULL, /* frame (Reserved)    */
+	/* padding */
+	NULL,
+	NULL,
+	NULL,
+	NULL
 };
 
 #ifdef PURPLE_GTKPERL