| 1 | package FFI::Platypus::Type; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 57 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 57 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 57 | ▶ | use 5.008004; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 57 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 57 | require FFI::Platypus; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # ABSTRACT: Defining types for FFI::Platypus | ||||||||||||||||||||||||||||
| 10 | 57 | our $VERSION = '2.12'; # 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 | 153 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
alignof: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 153 | my($self) = @_; | |||||||||||||||||||||||||||
| 20 | 153 | 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 | ▶ | && $meta->{ref} == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$meta->{"type"} eq "record" and $meta->{"ref"} == 1
MC/DC0%0/2
$meta->{"type"} eq "record" and $meta->{"ref"} == 1
$meta->{"type"} eq "record"
$meta->{"ref"} == 1
Truth table66%2/3
A and B
A= $meta->{"type"} eq "record"B= $meta->{"ref"} == 1
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 153 | my $ffi_type; | |||||||||||||||||||||||||||
| 30 | 153 | ▶ | if($meta->{type} eq 'pointer') | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||
| 32 | 11 | $ffi_type = 'pointer'; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | elsif($meta->{type} eq 'record') | ||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||
| 36 | 10 | $ffi_type = 'uint8'; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | else | ||||||||||||||||||||||||||||
| 39 | { | ||||||||||||||||||||||||||||
| 40 | 132 | $ffi_type = $meta->{ffi_type}; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 153 | require FFI::Platypus::ShareConfig; | |||||||||||||||||||||||||||
| 44 | 153 | FFI::Platypus::ShareConfig->get('align')->{$ffi_type}; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 57 | 1; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | __END__ | ||||||||||||||||||||||||||||