line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Platypus::Type; |
2
|
|
|
|
|
|
|
|
3
|
56
|
|
|
56
|
|
1094
|
use strict; |
|
56
|
|
|
|
|
114
|
|
|
56
|
|
|
|
|
1920
|
|
4
|
56
|
|
|
56
|
|
309
|
use warnings; |
|
56
|
|
|
|
|
112
|
|
|
56
|
|
|
|
|
1332
|
|
5
|
56
|
|
|
56
|
|
888
|
use 5.008004; |
|
56
|
|
|
|
|
229
|
|
6
|
56
|
|
|
56
|
|
346
|
use Carp qw( croak ); |
|
56
|
|
|
|
|
192
|
|
|
56
|
|
|
|
|
12434
|
|
7
|
|
|
|
|
|
|
require FFI::Platypus; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Defining types for FFI::Platypus |
10
|
|
|
|
|
|
|
our $VERSION = '2.08'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# The TypeParser and Type classes are used internally ONLY and |
13
|
|
|
|
|
|
|
# are not to be exposed to the user. External users should |
14
|
|
|
|
|
|
|
# not under any circumstances rely on the implementation of |
15
|
|
|
|
|
|
|
# these classes. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub alignof |
18
|
|
|
|
|
|
|
{ |
19
|
153
|
|
|
153
|
0
|
336
|
my($self) = @_; |
20
|
153
|
|
|
|
|
1046
|
my $meta = $self->meta; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# TODO: it is possible, though complicated |
23
|
|
|
|
|
|
|
# to compute the alignment of a struct |
24
|
|
|
|
|
|
|
# type record. |
25
|
|
|
|
|
|
|
croak "cannot determine alignment of record" |
26
|
|
|
|
|
|
|
if $meta->{type} eq 'record' |
27
|
153
|
50
|
66
|
|
|
519
|
&& $meta->{ref} == 1; |
28
|
|
|
|
|
|
|
|
29
|
153
|
|
|
|
|
232
|
my $ffi_type; |
30
|
153
|
100
|
|
|
|
433
|
if($meta->{type} eq 'pointer') |
|
|
100
|
|
|
|
|
|
31
|
|
|
|
|
|
|
{ |
32
|
11
|
|
|
|
|
20
|
$ffi_type = 'pointer'; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
elsif($meta->{type} eq 'record') |
35
|
|
|
|
|
|
|
{ |
36
|
10
|
|
|
|
|
25
|
$ffi_type = 'uint8'; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else |
39
|
|
|
|
|
|
|
{ |
40
|
132
|
|
|
|
|
256
|
$ffi_type = $meta->{ffi_type}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
153
|
|
|
|
|
869
|
require FFI::Platypus::ShareConfig; |
44
|
153
|
|
|
|
|
475
|
FFI::Platypus::ShareConfig->get('align')->{$ffi_type}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |