line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Platypus::Legacy::Raw::Platypus; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
217702
|
use strict; |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
242
|
|
4
|
8
|
|
|
8
|
|
38
|
use warnings; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
223
|
|
5
|
8
|
|
|
8
|
|
4007
|
use Ref::Util qw( is_ref ); |
|
8
|
|
|
|
|
12908
|
|
|
8
|
|
|
|
|
554
|
|
6
|
8
|
|
|
8
|
|
754
|
use FFI::Platypus; |
|
8
|
|
|
|
|
6573
|
|
|
8
|
|
|
|
|
232
|
|
7
|
8
|
|
|
8
|
|
44
|
use base qw( Exporter ); |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
4523
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Private class for FFI::Platypus::Legacy::Raw |
10
|
|
|
|
|
|
|
our $VERSION = '0.06'; # 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
|
|
29
|
native_to_perl => sub { $_[0] }, |
21
|
|
|
|
|
|
|
perl_to_native => sub { |
22
|
34
|
100
|
|
34
|
|
117
|
if(is_ref $_[0]) |
23
|
|
|
|
|
|
|
{ |
24
|
29
|
100
|
|
|
|
55
|
if(eval { $_[0]->isa('FFI::Platypus::Legacy::Raw::Ptr') }) |
|
29
|
50
|
|
|
|
145
|
|
25
|
18
|
|
|
|
|
28
|
{ return ${$_[0]} } |
|
18
|
|
|
|
|
138
|
|
26
|
11
|
|
|
|
|
39
|
elsif(eval { $_[0]->isa('FFI::Platypus::Legacy::Raw::Callback') }) |
27
|
11
|
|
|
|
|
63
|
{ return $_[0]->{ptr} } |
28
|
|
|
|
|
|
|
} |
29
|
5
|
|
|
|
|
30
|
$_[0]; |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
}, |
32
|
19
|
|
|
|
|
204
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my %ffi; |
36
|
|
|
|
|
|
|
sub _ffi ($) |
37
|
|
|
|
|
|
|
{ |
38
|
55
|
|
|
55
|
|
106
|
my $lib = shift; |
39
|
55
|
50
|
|
|
|
145
|
die "lib is not defined" unless defined $lib; |
40
|
55
|
|
66
|
|
|
230
|
$ffi{$lib} ||= do { |
41
|
8
|
|
|
|
|
60
|
my $ffi = FFI::Platypus->new; |
42
|
8
|
|
|
|
|
138
|
$ffi->lang('Raw'); |
43
|
8
|
|
|
|
|
331
|
$ffi->lib($lib); |
44
|
8
|
|
|
|
|
143
|
_add_p_type($ffi); |
45
|
8
|
|
|
|
|
647
|
$ffi; |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $libc; |
50
|
|
|
|
|
|
|
sub _ffi_libc () |
51
|
|
|
|
|
|
|
{ |
52
|
4
|
100
|
|
4
|
|
16
|
unless($libc) |
53
|
|
|
|
|
|
|
{ |
54
|
3
|
|
|
|
|
24
|
$libc = FFI::Platypus->new; |
55
|
3
|
|
|
|
|
46
|
$libc->lang('Raw'); |
56
|
3
|
|
|
|
|
91
|
$libc->lib(undef); |
57
|
3
|
|
|
|
|
76
|
_add_p_type($libc); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
4
|
|
|
|
|
188
|
$libc; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $package; |
64
|
|
|
|
|
|
|
sub _ffi_package () |
65
|
|
|
|
|
|
|
{ |
66
|
29
|
100
|
|
29
|
|
185
|
unless($package) |
67
|
|
|
|
|
|
|
{ |
68
|
8
|
|
|
|
|
61
|
$package = FFI::Platypus->new; |
69
|
8
|
|
|
|
|
186
|
$package->lang('Raw'); |
70
|
8
|
|
|
|
|
394
|
my $file = __FILE__; |
71
|
|
|
|
|
|
|
# assumes of course that both this and ../Raw.pm |
72
|
|
|
|
|
|
|
# are installed together and in the same place. |
73
|
8
|
|
|
|
|
51
|
$file =~ s{Raw/Platypus\.pm$}{Raw.pm}; |
74
|
8
|
|
|
|
|
50
|
$package->package('FFI::Platypus::Legacy::Raw', $file); |
75
|
8
|
|
|
|
|
1582
|
_add_p_type($package); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
29
|
|
|
|
|
689
|
$package; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |