diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-04-28 15:22:17 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-04-28 15:22:17 +0000 |
commit | 7a5d3022d6cd66d96f8407f86f0114927db0708f (patch) | |
tree | 918bf119c68c14193c1deb0fbd4a23c98f78836c | |
parent | e1a1adf65845357f26e396dbc34adc127b2126a6 (diff) | |
download | perl_checker-7a5d3022d6cd66d96f8407f86f0114927db0708f.tar perl_checker-7a5d3022d6cd66d96f8407f86f0114927db0708f.tar.gz perl_checker-7a5d3022d6cd66d96f8407f86f0114927db0708f.tar.bz2 perl_checker-7a5d3022d6cd66d96f8407f86f0114927db0708f.tar.xz perl_checker-7a5d3022d6cd66d96f8407f86f0114927db0708f.zip |
add traditional forms of subroutines declarations in .pm files
-rwxr-xr-x | perl_checker_fake_packages/gen.pl | 12 |
1 files changed, 11 insertions, 1 deletions
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; |