line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Platypus::Legacy::Raw::Platypus; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
208651
|
use strict; |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
226
|
|
4
|
8
|
|
|
8
|
|
39
|
use warnings; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
216
|
|
5
|
8
|
|
|
8
|
|
3862
|
use Ref::Util qw( is_ref ); |
|
8
|
|
|
|
|
13133
|
|
|
8
|
|
|
|
|
551
|
|
6
|
8
|
|
|
8
|
|
669
|
use FFI::Platypus; |
|
8
|
|
|
|
|
6511
|
|
|
8
|
|
|
|
|
226
|
|
7
|
8
|
|
|
8
|
|
46
|
use base qw( Exporter ); |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
4689
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Private class for FFI::Platypus::Legacy::Raw |
10
|
|
|
|
|
|
|
our $VERSION = '0.04'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw( _ffi _ffi_libc _ffi_package ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _add_p_type |
15
|
|
|
|
|
|
|
{ |
16
|
19
|
|
|
19
|
|
47
|
my $ffi = shift; |
17
|
|
|
|
|
|
|
$ffi->custom_type( |
18
|
|
|
|
|
|
|
'p' => { |
19
|
|
|
|
|
|
|
native_type => 'opaque', |
20
|
4
|
|
|
4
|
|
29
|
native_to_perl => sub { $_[0] }, |
21
|
|
|
|
|
|
|
perl_to_native => sub { |
22
|
34
|
100
|
|
34
|
|
117
|
if(is_ref $_[0]) |
23
|
|
|
|
|
|
|
{ |
24
|
29
|
100
|
|
|
|
51
|
if(eval { $_[0]->isa('FFI::Platypus::Legacy::Raw::Ptr') }) |
|
29
|
50
|
|
|
|
141
|
|
25
|
18
|
|
|
|
|
30
|
{ return ${$_[0]} } |
|
18
|
|
|
|
|
152
|
|
26
|
11
|
|
|
|
|
36
|
elsif(eval { $_[0]->isa('FFI::Platypus::Legacy::Raw::Callback') }) |
27
|
11
|
|
|
|
|
57
|
{ return $_[0]->{ptr} } |
28
|
|
|
|
|
|
|
} |
29
|
5
|
|
|
|
|
34
|
$_[0]; |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
}, |
32
|
19
|
|
|
|
|
208
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my %ffi; |
36
|
|
|
|
|
|
|
sub _ffi ($) |
37
|
|
|
|
|
|
|
{ |
38
|
55
|
|
|
55
|
|
109
|
my $lib = shift; |
39
|
55
|
50
|
|
|
|
139
|
die "lib is not defined" unless defined $lib; |
40
|
55
|
|
66
|
|
|
258
|
$ffi{$lib} ||= do { |
41
|
8
|
|
|
|
|
61
|
my $ffi = FFI::Platypus->new; |
42
|
8
|
|
|
|
|
135
|
$ffi->lang('Raw'); |
43
|
8
|
|
|
|
|
324
|
$ffi->lib($lib); |
44
|
8
|
|
|
|
|
149
|
_add_p_type($ffi); |
45
|
8
|
|
|
|
|
603
|
$ffi; |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $libc; |
50
|
|
|
|
|
|
|
sub _ffi_libc () |
51
|
|
|
|
|
|
|
{ |
52
|
4
|
100
|
|
4
|
|
17
|
unless($libc) |
53
|
|
|
|
|
|
|
{ |
54
|
3
|
|
|
|
|
16
|
$libc = FFI::Platypus->new; |
55
|
3
|
|
|
|
|
47
|
$libc->lang('Raw'); |
56
|
3
|
|
|
|
|
90
|
$libc->lib(undef); |
57
|
3
|
|
|
|
|
73
|
_add_p_type($libc); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
4
|
|
|
|
|
202
|
$libc; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $package; |
64
|
|
|
|
|
|
|
sub _ffi_package () |
65
|
|
|
|
|
|
|
{ |
66
|
29
|
100
|
|
29
|
|
172
|
unless($package) |
67
|
|
|
|
|
|
|
{ |
68
|
8
|
|
|
|
|
62
|
$package = FFI::Platypus->new; |
69
|
8
|
|
|
|
|
183
|
$package->lang('Raw'); |
70
|
8
|
|
|
|
|
363
|
my $file = __FILE__; |
71
|
|
|
|
|
|
|
# assumes of course that both this and ../Raw.pm |
72
|
|
|
|
|
|
|
# are installed together and in the same place. |
73
|
8
|
|
|
|
|
48
|
$file =~ s{Raw/Platypus\.pm$}{Raw.pm}; |
74
|
8
|
|
|
|
|
50
|
$package->package('FFI::Platypus::Legacy::Raw', $file); |
75
|
8
|
|
|
|
|
1535
|
_add_p_type($package); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
29
|
|
|
|
|
673
|
$package; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |