line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FFI::Platypus::Type; |
2
|
|
|
|
|
|
|
|
3
|
56
|
|
|
56
|
|
1063
|
use strict; |
|
56
|
|
|
|
|
124
|
|
|
56
|
|
|
|
|
1618
|
|
4
|
56
|
|
|
56
|
|
293
|
use warnings; |
|
56
|
|
|
|
|
117
|
|
|
56
|
|
|
|
|
1294
|
|
5
|
56
|
|
|
56
|
|
916
|
use 5.008004; |
|
56
|
|
|
|
|
209
|
|
6
|
56
|
|
|
56
|
|
423
|
use Carp qw( croak ); |
|
56
|
|
|
|
|
190
|
|
|
56
|
|
|
|
|
12301
|
|
7
|
|
|
|
|
|
|
require FFI::Platypus; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Defining types for FFI::Platypus |
10
|
|
|
|
|
|
|
our $VERSION = '2.06_01'; # TRIAL 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
|
316
|
my($self) = @_; |
20
|
153
|
|
|
|
|
1070
|
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
|
|
|
529
|
&& $meta->{ref} == 1; |
28
|
|
|
|
|
|
|
|
29
|
153
|
|
|
|
|
263
|
my $ffi_type; |
30
|
153
|
100
|
|
|
|
485
|
if($meta->{type} eq 'pointer') |
|
|
100
|
|
|
|
|
|
31
|
|
|
|
|
|
|
{ |
32
|
11
|
|
|
|
|
21
|
$ffi_type = 'pointer'; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
elsif($meta->{type} eq 'record') |
35
|
|
|
|
|
|
|
{ |
36
|
10
|
|
|
|
|
26
|
$ffi_type = 'uint8'; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else |
39
|
|
|
|
|
|
|
{ |
40
|
132
|
|
|
|
|
250
|
$ffi_type = $meta->{ffi_type}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
153
|
|
|
|
|
809
|
require FFI::Platypus::ShareConfig; |
44
|
153
|
|
|
|
|
456
|
FFI::Platypus::ShareConfig->get('align')->{$ffi_type}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |