line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Platypus::Legacy::Raw::Platypus; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
210536
|
use strict; |
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
280
|
|
4
|
8
|
|
|
8
|
|
46
|
use warnings; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
224
|
|
5
|
8
|
|
|
8
|
|
3859
|
use Ref::Util qw( is_ref ); |
|
8
|
|
|
|
|
13112
|
|
|
8
|
|
|
|
|
539
|
|
6
|
8
|
|
|
8
|
|
745
|
use FFI::Platypus; |
|
8
|
|
|
|
|
6610
|
|
|
8
|
|
|
|
|
242
|
|
7
|
8
|
|
|
8
|
|
54
|
use base qw( Exporter ); |
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
4443
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Private class for FFI::Platypus::Legacy::Raw |
10
|
|
|
|
|
|
|
our $VERSION = '0.05'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw( _ffi _ffi_libc _ffi_package ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _add_p_type |
15
|
|
|
|
|
|
|
{ |
16
|
19
|
|
|
19
|
|
53
|
my $ffi = shift; |
17
|
|
|
|
|
|
|
$ffi->custom_type( |
18
|
|
|
|
|
|
|
'p' => { |
19
|
|
|
|
|
|
|
native_type => 'opaque', |
20
|
4
|
|
|
4
|
|
31
|
native_to_perl => sub { $_[0] }, |
21
|
|
|
|
|
|
|
perl_to_native => sub { |
22
|
34
|
100
|
|
34
|
|
115
|
if(is_ref $_[0]) |
23
|
|
|
|
|
|
|
{ |
24
|
29
|
100
|
|
|
|
56
|
if(eval { $_[0]->isa('FFI::Platypus::Legacy::Raw::Ptr') }) |
|
29
|
50
|
|
|
|
137
|
|
25
|
18
|
|
|
|
|
28
|
{ return ${$_[0]} } |
|
18
|
|
|
|
|
165
|
|
26
|
11
|
|
|
|
|
40
|
elsif(eval { $_[0]->isa('FFI::Platypus::Legacy::Raw::Callback') }) |
27
|
11
|
|
|
|
|
62
|
{ return $_[0]->{ptr} } |
28
|
|
|
|
|
|
|
} |
29
|
5
|
|
|
|
|
42
|
$_[0]; |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
}, |
32
|
19
|
|
|
|
|
194
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my %ffi; |
36
|
|
|
|
|
|
|
sub _ffi ($) |
37
|
|
|
|
|
|
|
{ |
38
|
55
|
|
|
55
|
|
103
|
my $lib = shift; |
39
|
55
|
50
|
|
|
|
145
|
die "lib is not defined" unless defined $lib; |
40
|
55
|
|
66
|
|
|
236
|
$ffi{$lib} ||= do { |
41
|
8
|
|
|
|
|
96
|
my $ffi = FFI::Platypus->new; |
42
|
8
|
|
|
|
|
144
|
$ffi->lang('Raw'); |
43
|
8
|
|
|
|
|
349
|
$ffi->lib($lib); |
44
|
8
|
|
|
|
|
153
|
_add_p_type($ffi); |
45
|
8
|
|
|
|
|
641
|
$ffi; |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $libc; |
50
|
|
|
|
|
|
|
sub _ffi_libc () |
51
|
|
|
|
|
|
|
{ |
52
|
4
|
100
|
|
4
|
|
15
|
unless($libc) |
53
|
|
|
|
|
|
|
{ |
54
|
3
|
|
|
|
|
16
|
$libc = FFI::Platypus->new; |
55
|
3
|
|
|
|
|
45
|
$libc->lang('Raw'); |
56
|
3
|
|
|
|
|
92
|
$libc->lib(undef); |
57
|
3
|
|
|
|
|
74
|
_add_p_type($libc); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
4
|
|
|
|
|
185
|
$libc; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $package; |
64
|
|
|
|
|
|
|
sub _ffi_package () |
65
|
|
|
|
|
|
|
{ |
66
|
29
|
100
|
|
29
|
|
176
|
unless($package) |
67
|
|
|
|
|
|
|
{ |
68
|
8
|
|
|
|
|
48
|
$package = FFI::Platypus->new; |
69
|
8
|
|
|
|
|
168
|
$package->lang('Raw'); |
70
|
8
|
|
|
|
|
365
|
my $file = __FILE__; |
71
|
|
|
|
|
|
|
# assumes of course that both this and ../Raw.pm |
72
|
|
|
|
|
|
|
# are installed together and in the same place. |
73
|
8
|
|
|
|
|
47
|
$file =~ s{Raw/Platypus\.pm$}{Raw.pm}; |
74
|
8
|
|
|
|
|
48
|
$package->package('FFI::Platypus::Legacy::Raw', $file); |
75
|
8
|
|
|
|
|
1531
|
_add_p_type($package); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
29
|
|
|
|
|
793
|
$package; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |