From 98512d7845937c3a600e24ef4cc3cb65dd52cb59 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Mon, 28 Apr 2003 15:22:17 +0000 Subject: add traditional forms of subroutines declarations in .pm files --- perl_checker_fake_packages/gen.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'perl_checker_fake_packages') diff --git a/perl_checker_fake_packages/gen.pl b/perl_checker_fake_packages/gen.pl index c209be0..4d18665 100755 --- a/perl_checker_fake_packages/gen.pl +++ b/perl_checker_fake_packages/gen.pl @@ -24,11 +24,22 @@ sub gtk2 { #- explore first line of subroutine definition local $_ = $contents[$::i+1]; + /^\s*{\s*$/ and $_ = $contents[$::i+2]; + + #- traditional form + #- my ($class, $interval, $func, $data) = @_; + if (/^\s*my\s*\(([^\)]+)\)\s*=\s*\@_\s*;\s*$/) { + my @args = map { /^\s*\$(.*)/ or goto skip_trad; '$_'.$1 } split /,/, $1; + $add->($fun, ' { my ('.join(', ', @args).') = @_ }'); + skip_trad: + } + #- methods with no argument #- my $values = shift->_get_size_request; if (/shift->\w+\s*;/) { $add->($fun, ' { my ($_self) = @_ }'); } + #- methods with variable list of arguments (which branch to different XS functions) #- Gtk2::_Helpers::check_usage(\@_, [ 'Gtk2::GSList group' ], [ 'Gtk2::GSList group', 'string label' ]); if (/Gtk2::_Helpers::check_usage\(\\\@_, (.*)\);/) { @@ -102,7 +113,6 @@ sub gtk2 { /\.c$/ and $c_file->($_); } - print "package Gtk2; -- cgit v1.2.1