# HG changeset patch # User Christian Hammond # Date 1061687312 0 # Node ID 7f5f57dd5cac276509db08adac6842cc37f5c109 # Parent ed11e3f8ba21fcea4f1e4d5b3f9956dc9a2fb150 [gaim-migrate @ 7110] I'm breaking debug. I cannot for the life of me figure out the enum stuff in perl XSUB. Everything is ending up 0 (in other words, it's probably not finding them). So, people can use debug_info and such. committer: Tailor Script diff -r ed11e3f8ba21 -r 7f5f57dd5cac plugins/perl/common/Gaim.pm --- a/plugins/perl/common/Gaim.pm Sat Aug 23 23:09:14 2003 +0000 +++ b/plugins/perl/common/Gaim.pm Sun Aug 24 01:08:32 2003 +0000 @@ -3,8 +3,10 @@ use 5.008; use strict; use warnings; +use Carp; require Exporter; +use AutoLoader; our @ISA = qw(Exporter); @@ -27,6 +29,25 @@ our $VERSION = '0.01'; +sub AUTOLOAD { + # This AUTOLOAD is used to 'autoload' constants from the constant() + # XS function. + + my $constname; + our $AUTOLOAD; + ($constname = $AUTOLOAD) =~ s/.*:://; + croak "&Gaim::constant not defined" if $constname eq 'constant'; + my ($error, $val) = constant($constname); + if ($error) { croak $error; } + { + no strict 'refs'; + + *$AUTOLOAD = sub { $val }; + } + + goto &$AUTOLOAD; +} + require XSLoader; XSLoader::load('Gaim', $VERSION); @@ -79,7 +100,7 @@ =head1 AUTHOR -Christian Hammond, Echipx86@localdomainE +Christian Hammond, Echipx86@gnupdate.orgE =head1 COPYRIGHT AND LICENSE diff -r ed11e3f8ba21 -r 7f5f57dd5cac plugins/perl/common/Gaim.xs --- a/plugins/perl/common/Gaim.xs Sat Aug 23 23:09:14 2003 +0000 +++ b/plugins/perl/common/Gaim.xs Sun Aug 24 01:08:32 2003 +0000 @@ -1,9 +1,13 @@ #include "module.h" #include "../perl-handlers.h" -MODULE = Gaim PACKAGE = Gaim +#include "const-c.inc" + +MODULE = Gaim PACKAGE = Gaim PREFIX = gaim_ PROTOTYPES: ENABLE +INCLUDE: const-xs.inc + void timeout_add(plugin, seconds, callback, data) Gaim::Plugin plugin @@ -32,23 +36,10 @@ gaim_perl_signal_disconnect(plugin, instance, signal); void -debug(level, category, string) - const char *level +gaim_debug(level, category, string) + Gaim::DebugLevel level const char *category const char *string -CODE: - if (!strcmp(level, "misc")) - gaim_debug(GAIM_DEBUG_MISC, category, string); - else if (!strcmp(level, "info")) - gaim_debug(GAIM_DEBUG_INFO, category, string); - else if (!strcmp(level, "warning")) - gaim_debug(GAIM_DEBUG_WARNING, category, string); - else if (!strcmp(level, "error")) - gaim_debug(GAIM_DEBUG_ERROR, category, string); - else if (!strcmp(level, "fatal")) - gaim_debug(GAIM_DEBUG_FATAL, category, string); - else - croak("Unknown debug level type '%s'", level); void debug_misc(category, string) diff -r ed11e3f8ba21 -r 7f5f57dd5cac plugins/perl/common/Makefile.PL.in --- a/plugins/perl/common/Makefile.PL.in Sat Aug 23 23:09:14 2003 +0000 +++ b/plugins/perl/common/Makefile.PL.in Sun Aug 24 01:08:32 2003 +0000 @@ -14,3 +14,15 @@ 'INC' => '-I. -I@top_srcdir@ -I@top_srcdir@/src @GLIB_CFLAGS@', # e.g., '-I. -I/usr/include/other' 'OBJECT' => '$(O_FILES)', # link all the C files too ); + +if (eval {require ExtUtils::Constant; 1}) { + foreach (qw(GAIM_DEBUG_ALL GAIM_DEBUG_MISC GAIM_DEBUG_INFO + GAIM_DEBUG_WARNING GAIM_DEBUG_ERROR GAIM_DEBUG_FATAL)) { + push @names, {name => $_, type => "IV", macro => 1}; + } + + ExtUtils::Constant::WriteConstants( + NAME => 'Gaim::DebugLevel', + NAMES => \@names + ); +} diff -r ed11e3f8ba21 -r 7f5f57dd5cac plugins/perl/common/module.h --- a/plugins/perl/common/module.h Sat Aug 23 23:09:14 2003 +0000 +++ b/plugins/perl/common/module.h Sun Aug 24 01:08:32 2003 +0000 @@ -18,7 +18,10 @@ typedef GaimAccount * Gaim__Account; typedef GaimConnection * Gaim__Connection; +typedef GaimConversation *Gaim__Conversation; typedef GaimPlugin * Gaim__Plugin; typedef struct buddy * Gaim__BuddyList__Buddy; typedef struct chat * Gaim__BuddyList__Chat; typedef struct group * Gaim__BuddyList__Group; + +typedef GaimDebugLevel Gaim__DebugLevel; diff -r ed11e3f8ba21 -r 7f5f57dd5cac plugins/perl/common/typemap --- a/plugins/perl/common/typemap Sat Aug 23 23:09:14 2003 +0000 +++ b/plugins/perl/common/typemap Sun Aug 24 01:08:32 2003 +0000 @@ -1,11 +1,13 @@ TYPEMAP gboolean T_BOOL Gaim::Account T_GaimObj -Gaim::Connection T_GaimObj -Gaim::Plugin T_GaimObj Gaim::BuddyList::Group T_GaimObj Gaim::BuddyList::Buddy T_GaimObj Gaim::BuddyList::Chat T_GaimObj +Gaim::Connection T_GaimObj +Gaim::Conversation T_GaimObj +Gaim::DebugLevel T_IV +Gaim::Plugin T_GaimObj INPUT