Mercurial > pidgin
changeset 6588:7f5f57dd5cac
[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 <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 24 Aug 2003 01:08:32 +0000 |
parents | ed11e3f8ba21 |
children | e17831ad6a9a |
files | plugins/perl/common/Gaim.pm plugins/perl/common/Gaim.xs plugins/perl/common/Makefile.PL.in plugins/perl/common/module.h plugins/perl/common/typemap |
diffstat | 5 files changed, 48 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- 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, E<lt>chipx86@localdomainE<gt> +Christian Hammond, E<lt>chipx86@gnupdate.orgE<gt> =head1 COPYRIGHT AND LICENSE
--- 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)
--- 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 + ); +}
--- 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;
--- 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