line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package |
2
|
|
|
|
|
|
|
Archive::Libarchive::FFI::SweetLite; |
3
|
|
|
|
|
|
|
|
4
|
27
|
|
|
27
|
|
375
|
use strict; |
|
27
|
|
|
|
|
52
|
|
|
27
|
|
|
|
|
796
|
|
5
|
27
|
|
|
27
|
|
140
|
use warnings; |
|
27
|
|
|
|
|
47
|
|
|
27
|
|
|
|
|
701
|
|
6
|
27
|
|
|
27
|
|
132
|
use FFI::Raw; |
|
27
|
|
|
|
|
45
|
|
|
27
|
|
|
|
|
811
|
|
7
|
27
|
|
|
27
|
|
21496
|
use Text::ParseWords qw( shellwords ); |
|
27
|
|
|
|
|
37197
|
|
|
27
|
|
|
|
|
2174
|
|
8
|
|
|
|
|
|
|
use Exporter::Tidy |
9
|
27
|
|
|
|
|
256
|
default => [qw( |
10
|
|
|
|
|
|
|
ffi_lib attach_function |
11
|
|
|
|
|
|
|
_void _int _uint _long _ulong _int64 _uint64 |
12
|
|
|
|
|
|
|
_short _ushort _char _uchar _float _double _str _ptr |
13
|
27
|
|
|
27
|
|
162
|
)]; |
|
27
|
|
|
|
|
43
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# This is intended for use with Archive::Libarchive::FFI ONLY until |
16
|
|
|
|
|
|
|
# FFI::Sweet makes it to CPAN |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my @libs; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub ffi_lib ($) |
21
|
|
|
|
|
|
|
{ |
22
|
27
|
|
|
27
|
0
|
368984
|
my $lib = shift; |
23
|
27
|
|
|
|
|
154
|
push @libs, $$lib; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub attach_function ($$$;$) |
27
|
|
|
|
|
|
|
{ |
28
|
7452
|
|
|
7452
|
0
|
15070
|
my($name, $arg_types, $rv_type, $wrapper ) = @_; |
29
|
7452
|
|
|
|
|
12059
|
my $pkg = caller; |
30
|
7452
|
|
50
|
|
|
15902
|
$arg_types //= []; |
31
|
7452
|
|
|
|
|
9526
|
my $install_name = $name; |
32
|
7452
|
100
|
|
|
|
15576
|
( $name, $install_name ) = @{ $name } if ref $name; |
|
1242
|
|
|
|
|
3068
|
|
33
|
|
|
|
|
|
|
|
34
|
7452
|
|
|
|
|
12865
|
foreach my $lib (@libs) |
35
|
|
|
|
|
|
|
{ |
36
|
7452
|
|
|
|
|
9536
|
my $ffi = eval { FFI::Raw->new($lib, $name, $rv_type, @$arg_types) }; |
|
7452
|
|
|
|
|
108759
|
|
37
|
7452
|
50
|
|
|
|
17329
|
next if $@; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $base_sub = sub { |
40
|
1355
|
|
|
1355
|
|
198496
|
my @args = @_; |
41
|
1355
|
|
|
|
|
2009
|
my $ret = eval { |
42
|
1355
|
|
|
|
|
107125
|
$ffi->call(@args); |
43
|
|
|
|
|
|
|
}; |
44
|
1355
|
50
|
|
|
|
3682
|
die "$name: $@" if $@; |
45
|
1355
|
|
|
|
|
7974
|
return $ret; |
46
|
7452
|
|
|
|
|
34141
|
}; |
47
|
|
|
|
|
|
|
|
48
|
27
|
|
|
27
|
|
7449
|
no strict 'refs'; |
|
27
|
|
|
|
|
58
|
|
|
27
|
|
|
|
|
4119
|
|
49
|
7452
|
100
|
|
515
|
|
19401
|
*{join '::', $pkg, $install_name} = $wrapper ? sub { $wrapper->($base_sub, @_) } : $base_sub; |
|
7452
|
|
|
|
|
44781
|
|
|
515
|
|
|
|
|
173272
|
|
50
|
7452
|
|
|
|
|
25207
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
die "unable to find $name\n"; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
foreach my $type (qw( void int uint long ulong int64 uint64 short ushort char uchar float double str ptr )) |
57
|
|
|
|
|
|
|
{ |
58
|
27
|
|
|
27
|
|
147
|
no strict 'refs'; |
|
27
|
|
|
|
|
43
|
|
|
27
|
|
|
|
|
1827
|
|
59
|
0
|
|
|
0
|
|
0
|
eval qq{ sub _$type { FFI::Raw::$type\() } }; |
|
0
|
|
|
0
|
|
0
|
|
|
0
|
|
|
0
|
|
0
|
|
|
5886
|
|
|
5886
|
|
38350
|
|
|
1107
|
|
|
1107
|
|
18713
|
|
|
243
|
|
|
243
|
|
4818
|
|
|
9855
|
|
|
9855
|
|
242268
|
|
|
0
|
|
|
0
|
|
0
|
|
|
2025
|
|
|
2025
|
|
40871
|
|
|
0
|
|
|
0
|
|
0
|
|
|
27
|
|
|
27
|
|
133
|
|
|
135
|
|
|
135
|
|
3450
|
|
|
54
|
|
|
54
|
|
946
|
|
|
0
|
|
|
0
|
|
0
|
|
|
6804
|
|
|
6804
|
|
24603
|
|
60
|
|
|
|
|
|
|
die $@ if $@; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |