libpurple/plugins/perl/common/Log.xs

changeset 16773
e1171eb45f07
parent 15894
765ec644ac47
child 18068
b6554e3c8224
child 21737
fa92350ed598
--- 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

mercurial