line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Platypus::Buffer; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
221962
|
use strict; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
114
|
|
4
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
114
|
|
5
|
4
|
|
|
4
|
|
73
|
use 5.008004; |
|
4
|
|
|
|
|
14
|
|
6
|
4
|
|
|
4
|
|
754
|
use FFI::Platypus; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
138
|
|
7
|
4
|
|
|
4
|
|
23
|
use Exporter qw( import ); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
532
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT = qw( scalar_to_buffer buffer_to_scalar ); |
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw ( scalar_to_pointer grow set_used_length window ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Convert scalars to C buffers |
13
|
|
|
|
|
|
|
our $VERSION = '2.06_01'; # TRIAL VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use constant _incantation => |
17
|
4
|
50
|
33
|
|
|
454
|
$^O eq 'MSWin32' && do { require Config; $Config::Config{archname} =~ /MSWin32-x64/ } |
18
|
|
|
|
|
|
|
? 'Q' |
19
|
4
|
|
|
4
|
|
37
|
: 'L!'; |
|
4
|
|
|
|
|
7
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub scalar_to_buffer ($) |
23
|
|
|
|
|
|
|
{ |
24
|
4
|
|
|
4
|
1
|
37
|
(unpack(_incantation, pack 'P', $_[0]), do { use bytes; length $_[0] }); |
|
4
|
|
|
23
|
|
11
|
|
|
4
|
|
|
|
|
49
|
|
|
23
|
|
|
|
|
66358
|
|
|
23
|
|
|
|
|
93
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub scalar_to_pointer ($) |
29
|
|
|
|
|
|
|
{ |
30
|
46
|
|
|
46
|
1
|
3517
|
unpack(_incantation, pack 'P', $_[0]); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub buffer_to_scalar ($$) |
35
|
|
|
|
|
|
|
{ |
36
|
15
|
50
|
|
15
|
1
|
1543
|
unpack 'P'.$_[1], pack _incantation, defined $_[0] ? $_[0] : 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |