| 1 | 30 | ▶ | use strict; use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package Inline::C; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 30 | our $VERSION = '0.78'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 30 | ▶ | use Inline 0.56; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 30 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 30 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 30 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 30 | ▶ | use Cwd qw(cwd abs_path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 30 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 30 | ▶ | use constant IS_WIN32 => $^O eq 'MSWin32'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 30 | ▶ | use if !IS_WIN32, Fcntl => ':flock'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 30 | ▶ | use if IS_WIN32, 'Win32::Mutex'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 30 | our @ISA = qw(Inline); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # Register this module as an Inline language support module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | sub register { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | language => 'C', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # XXX Breaking this on purpose; let's see who screams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # aliases => ['c'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | type => 'compiled', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | suffix => $Config{dlext}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # Validate the C config options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | sub usage_validate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my $key = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
usage_validate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | return <<END; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | The value of config option '$key' must be a string or an array ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | sub validate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 54 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: called CC=66 SCAR=57.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 54 | ▶ | print STDERR "validate Stage\n" if $o->{CONFIG}{BUILD_NOISY}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 54 | ▶ | $o->{ILSM} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$o->{"ILSM"} ||= {}
MC/DC100%1/1
$o->{"ILSM"} ||= {}
$o->{"ILSM"}
Truth table100%2/2
A
A= $o->{"ILSM"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 54 | ▶ | $o->{ILSM}{XS} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$o->{"ILSM"}{"XS"} ||= {}
MC/DC100%1/1
$o->{"ILSM"}{"XS"} ||= {}
$o->{"ILSM"}{"XS"}
Truth table100%2/2
A
A= $o->{"ILSM"}{"XS"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 54 | ▶ | $o->{ILSM}{MAKEFILE} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$o->{"ILSM"}{"MAKEFILE"} ||= {}
MC/DC100%1/1
$o->{"ILSM"}{"MAKEFILE"} ||= {}
$o->{"ILSM"}{"MAKEFILE"}
Truth table100%2/2
A
A= $o->{"ILSM"}{"MAKEFILE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 54 | ▶ | if (not $o->UNTAINT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 50 | require FindBin; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | $o->{ILSM}{MAKEFILE}{INC} = "-I\"$FindBin::Bin\"" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 50 | ▶ | if not defined $o->{ILSM}{MAKEFILE}{INC}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 54 | ▶ | $o->{ILSM}{AUTOWRAP} = 0 if not defined $o->{ILSM}{AUTOWRAP}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 54 | ▶ | $o->{ILSM}{XSMODE} = 0 if not defined $o->{ILSM}{XSMODE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 54 | ▶ | $o->{ILSM}{AUTO_INCLUDE} ||= <<END; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$o->{"ILSM"}{"AUTO_INCLUDE"} ||= qq[#include "EXTERN.h"\n#include "perl.h"\n#include "XSUB.h"\n#include "INLINE.h"\n]
MC/DC100%1/1
$o->{"ILSM"}{"AUTO_INCLUDE"} ||= qq[#include "EXTERN.h"\n#include "perl.h"\n#include "XSUB.h"\n#include "INLINE.h"\n]
$o->{"ILSM"}{"AUTO_INCLUDE"}
Truth table100%2/2
A
A= $o->{"ILSM"}{"AUTO_INCLUDE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | #include "EXTERN.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | #include "perl.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | #include "XSUB.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | #include "INLINE.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 54 | ▶ | $o->{ILSM}{FILTERS} ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$o->{"ILSM"}{"FILTERS"} ||= []
MC/DC100%1/1
$o->{"ILSM"}{"FILTERS"} ||= []
$o->{"ILSM"}{"FILTERS"}
Truth table100%2/2
A
A= $o->{"ILSM"}{"FILTERS"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | $o->{STRUCT} ||= { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 54 | ▶ | '.macros' => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$o->{"STRUCT"} ||= {".macros", "", ".xs", "", ".any", 0, ".all", 0}
MC/DC100%1/1
$o->{"STRUCT"} ||= {".macros", "", ".xs", "", ".any", 0, ".all", 0}
$o->{"STRUCT"}
Truth table100%2/2
A
A= $o->{"STRUCT"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | '.xs' => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | '.any' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | '.all' => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 54 | ▶ | while (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 22 | my ($key, $value) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 22 | ▶ | if ($key eq 'PRE_HEAD') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | ▶ | unless( -f $value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | $o->{ILSM}{AUTO_INCLUDE} = $value . "\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $o->{ILSM}{AUTO_INCLUDE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | my $insert; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | ▶ | open RD, '<', $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | or die "Couldn't open $value for reading: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | ▶ | while (<RD>) {$insert .= $_} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | ▶ | close RD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | or die "Couldn't close $value after reading: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | $o->{ILSM}{AUTO_INCLUDE} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | $insert . "\n" . $o->{ILSM}{AUTO_INCLUDE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 21 | ▶ | if ($key eq 'MAKE' or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$key eq "MAKE" or $key eq "AUTOWRAP" or $key eq "XSMODE"
$key eq "MAKE" or $key eq "AUTOWRAP"
MC/DC66%2/3
$key eq "MAKE" or $key eq "AUTOWRAP" or $key eq "XSMODE"
$key eq "MAKE"
$key eq "AUTOWRAP"
$key eq "XSMODE"
Truth table75%3/4
A or B or C
A= $key eq "MAKE"B= $key eq "AUTOWRAP"C= $key eq "XSMODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | $key eq 'AUTOWRAP' or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | $key eq 'XSMODE' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | $o->{ILSM}{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 19 | ▶ | if ($key eq 'CC' or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$key eq "CC" or $key eq "LD"
MC/DC50%1/2
$key eq "CC" or $key eq "LD"
$key eq "CC"
$key eq "LD"
Truth table66%2/3
A or B
A= $key eq "CC"B= $key eq "LD"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | $key eq 'LD' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | $o->{ILSM}{MAKEFILE}{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 18 | ▶ | if ($key eq 'LIBS') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $o->add_list($o->{ILSM}{MAKEFILE}, $key, $value, []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 18 | ▶ | if ($key eq 'INC') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | $o->add_string( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | $o->{ILSM}{MAKEFILE}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 3 | $key, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | quote_space($value), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 15 | ▶ | if ($key eq 'MYEXTLIB' or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
$key eq "MYEXTLIB" or $key eq "OPTIMIZE" or $key eq "CCFLAGS" or $key eq "LDDLFLAGS"
$key eq "MYEXTLIB" or $key eq "OPTIMIZE" or $key eq "CCFLAGS"
$key eq "MYEXTLIB" or $key eq "OPTIMIZE"
MC/DC25%1/4
$key eq "MYEXTLIB" or $key eq "OPTIMIZE" or $key eq "CCFLAGS" or $key eq "LDDLFLAGS"
$key eq "MYEXTLIB"
$key eq "OPTIMIZE"
$key eq "CCFLAGS"
$key eq "LDDLFLAGS"
Truth table40%2/5
A or B or C or D
A= $key eq "MYEXTLIB"B= $key eq "OPTIMIZE"C= $key eq "CCFLAGS"D= $key eq "LDDLFLAGS"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | $key eq 'OPTIMIZE' or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | $key eq 'CCFLAGS' or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | $key eq 'LDDLFLAGS' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | $o->add_string($o->{ILSM}{MAKEFILE}, $key, $value, ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 13 | ▶ | if ($key eq 'CCFLAGSEX') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | $o->add_string( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | $o->{ILSM}{MAKEFILE}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 'CCFLAGS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | $Config{ccflags} . ' ' . $value, '', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 12 | ▶ | if ($key eq 'TYPEMAPS') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 2 | ▶ | unless(ref($value) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 1 | ▶ | croak "TYPEMAPS file '$value' not found" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | unless -f $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | $value = File::Spec->rel2abs($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 1 | ▶ | for (my $i = 0; $i < scalar(@$value); $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | croak "TYPEMAPS file '${$value}[$i]' not found" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 2 | ▶ | unless -f ${$value}[$i]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 2 | ${$value}[$i] = File::Spec->rel2abs(${$value}[$i]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 2 | $o->add_list($o->{ILSM}{MAKEFILE}, $key, $value, []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 10 | ▶ | if ($key eq 'AUTO_INCLUDE') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $o->add_text($o->{ILSM}, $key, $value, ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 10 | ▶ | if ($key eq 'BOOT') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $o->add_text($o->{ILSM}{XS}, $key, $value, ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 10 | ▶ | if ($key eq 'PREFIX') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 2 | ▶ | croak "Invalid value for 'PREFIX' option" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$value =~ /^\w*$/ and not $value =~ /\n/
MC/DC0%0/2
$value =~ /^\w*$/ and not $value =~ /\n/
$value =~ /^\w*$/
not $value =~ /\n/
Truth table33%1/3
A and not(B)
A= $value =~ /^\w*$/B= not $value =~ /\n/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | unless ($value =~ /^\w*$/ and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | $value !~ /\n/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | $o->{ILSM}{XS}{PREFIX} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 8 | ▶ | if ($key eq 'FILTERS') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | next if $value eq '1' or $value eq '0'; # ignore ENABLE, DISABLE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$value eq 1 or $value eq 0
MC/DC0%0/2
$value eq 1 or $value eq 0
$value eq 1
$value eq 0
Truth table0%0/3
A or B
A= $value eq 1B= $value eq 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | $value = [$value] unless ref($value) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my %filters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | for my $val (@$value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if (ref($val) eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $o->add_list($o->{ILSM}, $key, $val, []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | elsif (ref($val) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my ($filter_plugin, @args) = @$val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | croak "Bad format for filter plugin name: '$filter_plugin'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | unless $filter_plugin =~ m/^[\w:]+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | eval "require Inline::Filters::${filter_plugin}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | croak "Filter plugin Inline::Filters::$filter_plugin not installed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | croak "No Inline::Filters::${filter_plugin}::filter sub found" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | unless defined &{"Inline::Filters::${filter_plugin}::filter"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $filter_factory = \&{"Inline::Filters::${filter_plugin}::filter"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $o->add_list($o->{ILSM}, $key, $filter_factory->(@args), []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | eval { require Inline::Filters }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | croak "'FILTERS' option requires Inline::Filters to be installed." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | %filters = Inline::Filters::get_filters($o->{API}{language}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | unless keys %filters; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if (defined $filters{$val}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | my $filter = Inline::Filters->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | $val, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $filters{$val}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $o->add_list($o->{ILSM}, $key, $filter, []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | croak "Invalid filter $val specified."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 8 | ▶ | if ($key eq 'STRUCTS') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # A list of struct names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | if (ref($value) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | for my $val (@$value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | croak "Invalid value for 'STRUCTS' option" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | unless ($val =~ /^[_a-z][_0-9a-z]*$/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $o->{STRUCT}{$val}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # Enable or disable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | elsif ($value =~ /^\d+$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $o->{STRUCT}{'.any'} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # A single struct name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | croak "Invalid value for 'STRUCTS' option" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | unless ($value =~ /^[_a-z][_0-9a-z]*$/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $o->{STRUCT}{$value}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | eval { require Inline::Struct }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | croak "'STRUCTS' option requires Inline::Struct to be installed." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $o->{STRUCT}{'.any'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 8 | ▶ | if ($key eq 'PROTOTYPES') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 3 | $o->{CONFIG}{PROTOTYPES} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 3 | ▶ | next if $value eq 'ENABLE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | ▶ | next if $value eq 'DISABLE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | die "PROTOTYPES can be only either 'ENABLE' or 'DISABLE' - not $value"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 5 | ▶ | if ($key eq 'PROTOTYPE') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 3 | ▶ | die "PROTOTYPE configure arg must specify a hash reference" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | unless ref($value) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 2 | $o->{CONFIG}{PROTOTYPE} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 2 | ▶ | if ($key eq 'CPPFLAGS') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | # C preprocessor flags, used by Inline::Filters::Preprocess() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | my $class = ref $o; # handles subclasses correctly. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 1 | croak "'$key' is not a valid config option for $class\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | sub add_list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 2 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_list: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | my ($ref, $key, $value, $default) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 2 | ▶ | $value = [$value] unless ref $value eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 2 | for (@$value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 3 | ▶ | if (defined $_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 3 | push @{$ref->{$key}}, $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $ref->{$key} = $default; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | sub add_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 6 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_string: called CC=5 SCAR=17.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 6 | my ($ref, $key, $value, $default) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 6 | ▶ | $value = [$value] unless ref $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 6 | ▶ | croak usage_validate($key) unless ref($value) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 6 | for (@$value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 6 | ▶ | if (defined $_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 6 | $ref->{$key} .= ' ' . $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $ref->{$key} = $default; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | sub add_text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_text: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my ($ref, $key, $value, $default) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | $value = [$value] unless ref $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | croak usage_validate($key) unless ref($value) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | for (@$value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | if (defined $_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | $ref->{$key} .= $_ . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $ref->{$key} = $default; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # Return a small report about the C code.. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | sub info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
info: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | return <<END if $o->{ILSM}{XSMODE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | No information is currently generated when using XSMODE. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $text = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $o->preprocess; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | $o->parse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | if (defined $o->{ILSM}{parser}{data}{functions}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $text .= "The following Inline $o->{API}{language} function(s) have been successfully bound to Perl:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $parser = $o->{ILSM}{parser}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | my $data = $parser->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | for my $function (sort @{$data->{functions}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my $return_type = $data->{function}{$function}{return_type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | my @arg_names = @{$data->{function}{$function}{arg_names}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | my @arg_types = @{$data->{function}{$function}{arg_types}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my @args = map {$_ . ' ' . shift @arg_names} @arg_types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $text .= "\t$return_type $function(" . join(', ', @args) . ")\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $text .= "No $o->{API}{language} functions have been successfully bound to Perl.\n\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | $text .= Inline::Struct::info($o) if $o->{STRUCT}{'.any'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | return $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | sub config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
config: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | # Parse and compile C code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 30 | my $total_build_time; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | sub build { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 47 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: called CC=8 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 47 | ▶ | if ($o->{CONFIG}{BUILD_TIMERS}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | eval {require Time::HiRes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | croak "You need Time::HiRes for BUILD_TIMERS option:\n$@" if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $total_build_time = Time::HiRes::time(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 47 | my ($file, $lockfh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 47 | if (IS_WIN32) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | #this can not look like a file path, or new() fails | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | $file = 'Inline__C_' . $o->{API}{directory} . '.lock'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | $file =~ s/\\/_/g; #per CreateMutex on MSDN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | $lockfh = Win32::Mutex->new(0, $file) or die "lockmutex $file: $^E"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | $lockfh->wait(); #acquire, can't use 1 to new(), since if new() opens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | #existing instead of create new Muxtex, it is not acquired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 47 | $file = File::Spec->catfile($o->{API}{directory}, '.lock'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 47 | ▶ | open $lockfh, '>', $file or die "lockfile $file: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 47 | ▶ | flock($lockfh, LOCK_EX) or die "flock: $!\n" if $^O !~ /^VMS|riscos|VOS$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
$^O =~ /^VMS|riscos|VOS$/ || (flock($lockfh, 2) || die("flock: $!\n"))
flock $lockfh, 2 or die "flock: $!\n"
MC/DC0%0/2
$^O =~ /^VMS|riscos|VOS$/ || (flock($lockfh, 2) || die("flock: $!\n"))
$^O =~ /^VMS|riscos|VOS$/
flock $lockfh, 2
Truth table33%1/3
A || B
A= $^O =~ /^VMS|riscos|VOS$/B= flock $lockfh, 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 47 | $o->mkpath($o->{API}{build_dir}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 47 | $o->call('preprocess', 'Build Preprocess'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 47 | $o->call('parse', 'Build Parse'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 47 | $o->call('write_XS', 'Build Glue 1'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 47 | $o->call('write_Inline_headers', 'Build Glue 2'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 47 | $o->call('write_Makefile_PL', 'Build Glue 3'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 47 | $o->call('compile', 'Build Compile'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 46 | if (IS_WIN32) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | $lockfh->release or die "releasemutex $file: $^E"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 46 | ▶ | flock($lockfh, LOCK_UN) if $^O !~ /^VMS|riscos|VOS$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 46 | ▶ | if ($o->{CONFIG}{BUILD_TIMERS}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $total_build_time = Time::HiRes::time() - $total_build_time; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | printf STDERR "Total Build Time: %5.4f secs\n", $total_build_time; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | sub call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 468 | ▶ | my ($o, $method, $header, $indent) = (@_, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: called CC=7 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 468 | my $time; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 468 | my $i = ' ' x $indent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 468 | ▶ | print STDERR "${i}Starting $header Stage\n" if $o->{CONFIG}{BUILD_NOISY}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | $time = Time::HiRes::time() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 468 | ▶ | if $o->{CONFIG}{BUILD_TIMERS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 468 | $o->$method(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | $time = Time::HiRes::time() - $time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 466 | ▶ | if $o->{CONFIG}{BUILD_TIMERS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 466 | ▶ | print STDERR "${i}Finished $header Stage\n" if $o->{CONFIG}{BUILD_NOISY}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | printf STDERR "${i}Time for $header Stage: %5.4f secs\n", $time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 466 | ▶ | if $o->{CONFIG}{BUILD_TIMERS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 466 | ▶ | print STDERR "\n" if $o->{CONFIG}{BUILD_NOISY}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # Apply any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | sub preprocess { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 47 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preprocess: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 47 | ▶ | return if $o->{ILSM}{parser}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 47 | $o->get_maps; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 47 | $o->get_types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 47 | $o->{ILSM}{code} = $o->filter(@{$o->{ILSM}{FILTERS}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # Parse the function definition information out of the C code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | sub parse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 47 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 47 | ▶ | return if $o->{ILSM}{parser}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 47 | ▶ | return if $o->{ILSM}{XSMODE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 46 | my $parser = $o->{ILSM}{parser} = $o->get_parser; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 46 | $parser->{data}{typeconv} = $o->{ILSM}{typeconv}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 46 | $parser->{data}{AUTOWRAP} = $o->{ILSM}{AUTOWRAP}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 46 | ▶ | Inline::Struct::parse($o) if $o->{STRUCT}{'.any'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | $parser->code($o->{ILSM}{code}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 46 | ▶ | or croak <<END; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | Bad $o->{API}{language} code passed to Inline at @{[caller(2)]} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # Create and initialize a parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | sub get_parser { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 28 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_parser: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | Inline::C::_parser_test($o->{CONFIG}{DIRECTORY}, "Inline::C::get_parser called\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 28 | ▶ | if $o->{CONFIG}{_TESTING}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 28 | require Inline::C::Parser::RecDescent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 28 | Inline::C::Parser::RecDescent::get_parser($o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # Gather the path names of all applicable typemap files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | sub get_maps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 47 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_maps: called CC=10 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 47 | ▶ | print STDERR "get_maps Stage\n" if $o->{CONFIG}{BUILD_NOISY}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 47 | my $typemap = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 47 | my $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | $file = File::Spec->catfile( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | $Config::Config{installprivlib}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 47 | "ExtUtils", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | "typemap", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 47 | ▶ | $typemap = $file if -f $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | $file = File::Spec->catfile( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | $Config::Config{privlibexp} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 47 | ,"ExtUtils","typemap" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 47 | ▶ | $typemap = $file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $typemap and -f $file
MC/DC0%0/2
not $typemap and -f $file
not $typemap
-f $file
Truth table33%1/3
not(A) and B
A= not $typemapB= -f $file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | if (not $typemap and -f $file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 47 | ▶ | warn "Can't find the default system typemap file" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $typemap and $^W
MC/DC0%0/2
not $typemap and $^W
not $typemap
$^W
Truth table33%1/3
not(A) and B
A= not $typemapB= $^W
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | if (not $typemap and $^W); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 47 | ▶ | unshift(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $typemap) if $typemap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 47 | ▶ | if (not $o->UNTAINT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 43 | require FindBin; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 43 | $file = File::Spec->catfile($FindBin::Bin,"typemap"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 43 | ▶ | if ( -f $file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 43 | push(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # This routine parses XS typemap files to get a list of valid types to create | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # bindings to. This code is mostly hacked out of Larry Wall's xsubpp program. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | sub get_types { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 47 | ▶ | my (%type_kind, %proto_letter, %input_expr, %output_expr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_types: called CC=19 SCAR=29.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 47 | my $o = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 47 | local $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | croak "No typemaps specified for Inline C code" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 47 | ▶ | unless @{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 47 | my $proto_re = "[" . quotemeta('\$%&*@;') . "]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 47 | foreach my $typemap (@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 93 | ▶ | next unless -e $typemap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # skip directories, binary files etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 93 | ▶ | warn("Warning: ignoring non-text typemap file '$typemap'\n"), next | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | unless -T $typemap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 93 | ▶ | open(TYPEMAP, $typemap) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | or warn ("Warning: could not open typemap file '$typemap': $!\n"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 93 | my $mode = 'Typemap'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 93 | my $junk = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 93 | my $current = \$junk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 93 | ▶ | while (<TYPEMAP>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 22928 | ▶ | next if /^\s*\#/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 22270 | my $line_no = $. + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 22270 | ▶ | if (/^INPUT\s*$/) {$mode = 'Input'; $current = \$junk; next} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 22177 | ▶ | if (/^OUTPUT\s*$/) {$mode = 'Output'; $current = \$junk; next} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 22084 | ▶ | if (/^TYPEMAP\s*$/) {$mode = 'Typemap'; $current = \$junk; next} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 22084 | ▶ | if ($mode eq 'Typemap') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 2677 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 2677 | my $line = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 2677 | TrimWhitespace($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | # skip blank lines and comment lines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 2677 | ▶ | next if /^$/ or /^\#/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/^$/ or /^\#/
MC/DC50%1/2
/^$/ or /^\#/
/^$/
/^\#/
Truth table66%2/3
A or B
A= /^$/B= /^\#/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 2443 | ▶ | my ($type,$kind, $proto) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | /^\s*(.*?\S)\s+(\S+)\s*($proto_re*)\s*$/ or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | warn("Warning: File '$typemap' Line $. '$line' TYPEMAP entry needs 2 or 3 columns\n"), next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 2443 | $type = TidyType($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 2443 | $type_kind{$type} = $kind; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | # prototype defaults to '$' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 2443 | ▶ | $proto = "\$" unless $proto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 2443 | ▶ | warn("Warning: File '$typemap' Line $. '$line' Invalid prototype '$proto'\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | unless ValidProtoString($proto); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 2443 | $proto_letter{$type} = C_string($proto); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | elsif (/^\s/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 15273 | $$current .= $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | elsif ($mode eq 'Input') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 2067 | s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 2067 | $input_expr{$_} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 2067 | $current = \$input_expr{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 2067 | s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 2067 | $output_expr{$_} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 2067 | $current = \$output_expr{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 93 | close(TYPEMAP); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 2398 | my %valid_types = map {($_, 1)} grep { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 47 | defined $input_expr{$type_kind{$_}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } keys %type_kind; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 2445 | my %valid_rtypes = map {($_, 1)} ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 47 | defined $output_expr{$type_kind{$_}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | } keys %type_kind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | ), 'void'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 47 | $o->{ILSM}{typeconv}{type_kind} = \%type_kind; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 47 | $o->{ILSM}{typeconv}{input_expr} = \%input_expr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 47 | $o->{ILSM}{typeconv}{output_expr} = \%output_expr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 47 | $o->{ILSM}{typeconv}{valid_types} = \%valid_types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 47 | $o->{ILSM}{typeconv}{valid_rtypes} = \%valid_rtypes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | sub ValidProtoString ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 2443 | ▶ | my $string = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ValidProtoString: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 2443 | my $proto_re = "[" . quotemeta('\$%&*@;') . "]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 2443 | ▶ | return ($string =~ /^$proto_re+$/) ? $string : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | sub TrimWhitespace { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 5120 | ▶ | $_[0] =~ s/^\s+|\s+$//go; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TrimWhitespace: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | sub TidyType { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 2443 | ▶ | local $_ = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TidyType: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 2443 | s|\s*(\*+)\s*|$1|g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 2443 | s|(\*+)| $1 |g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 2443 | s|\s+| |g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 2443 | TrimWhitespace($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 2443 | $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | sub C_string ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 2443 | ▶ | (my $string = shift) =~ s|\\|\\\\|g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
C_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 2443 | $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | # Write the XS code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | sub write_XS { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 47 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_XS: called CC=5 SCAR=16.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 47 | my $modfname = $o->{API}{modfname}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 47 | my $module = $o->{API}{module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 47 | my $file = File::Spec->catfile($o->{API}{build_dir},"$modfname.xs"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 47 | ▶ | open XS, ">", $file or croak "$file: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 47 | ▶ | if ($o->{ILSM}{XSMODE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 1 | ▶ | warn <<END if $^W and $o->{ILSM}{code} !~ /MODULE\s*=\s*$module\b/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$^W and not $o->{"ILSM"}{"code"} =~ /MODULE\s*=\s*$module\b/
MC/DC0%0/2
$^W and not $o->{"ILSM"}{"code"} =~ /MODULE\s*=\s*$module\b/
$^W
not $o->{"ILSM"}{"code"} =~ /MODULE\s*=\s*$module\b/
Truth table33%1/3
A and not(B)
A= $^WB= not $o->{"ILSM"}{"code"} =~ /MODULE\s*=\s*$module\b/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | While using Inline XSMODE, your XS code does not have a line with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | MODULE = $module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | You should use the Inline NAME config option, and it should match the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | XS MODULE name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | print XS $o->xs_code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 46 | print XS $o->xs_generate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 47 | close XS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | # Generate the XS glue code (piece together lots of snippets) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | sub xs_generate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 46 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xs_generate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 46 | return join '', ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | $o->xs_includes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | $o->xs_struct_macros, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | $o->xs_code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | $o->xs_struct_code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | $o->xs_bindings, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | $o->xs_boot, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | sub xs_includes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 46 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xs_includes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 46 | return $o->{ILSM}{AUTO_INCLUDE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | sub xs_struct_macros { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 46 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xs_struct_macros: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 46 | return $o->{STRUCT}{'.macros'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | sub xs_code { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 47 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xs_code: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 47 | return $o->{ILSM}{code}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | sub xs_struct_code { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 46 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xs_struct_code: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 46 | return $o->{STRUCT}{'.xs'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | sub xs_boot { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 46 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xs_boot: called CC=3 SCAR=13.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 46 | ▶ | if (defined $o->{ILSM}{XS}{BOOT} and $o->{ILSM}{XS}{BOOT}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $o->{"ILSM"}{"XS"}{"BOOT"} and $o->{"ILSM"}{"XS"}{"BOOT"}
MC/DC0%0/2
defined $o->{"ILSM"}{"XS"}{"BOOT"} and $o->{"ILSM"}{"XS"}{"BOOT"}
defined $o->{"ILSM"}{"XS"}{"BOOT"}
$o->{"ILSM"}{"XS"}{"BOOT"}
Truth table33%1/3
A and B
A= defined $o->{"ILSM"}{"XS"}{"BOOT"}B= $o->{"ILSM"}{"XS"}{"BOOT"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | return <<END; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | BOOT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | $o->{ILSM}{XS}{BOOT} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 46 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | sub xs_bindings { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 46 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xs_bindings: called CC=19 SCAR=29.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 46 | my $dir = $o->{API}{directory}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 46 | ▶ | if ($o->{CONFIG}{_TESTING}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 13 | my $file = "$dir/void_test"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 13 | ▶ | if (! -f $file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 2 | ▶ | warn "$file: $!" if !open(TEST_FH, '>', $file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 2 | ▶ | warn "$file: $!" if !close(TEST_FH); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 46 | my ($pkg, $module) = @{$o->{API}}{qw(pkg module)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | my $prefix = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | ($o->{ILSM}{XS}{PREFIX}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 46 | ▶ | ? "PREFIX = $o->{ILSM}{XS}{PREFIX}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | : '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | my $prototypes = defined($o->{CONFIG}{PROTOTYPES}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | ? $o->{CONFIG}{PROTOTYPES} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 46 | ▶ | : 'DISABLE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 46 | my $XS = <<END; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | MODULE = $module PACKAGE = $pkg $prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | PROTOTYPES: $prototypes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 46 | my $parser = $o->{ILSM}{parser}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 46 | my $data = $parser->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | warn( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | "Warning. No Inline C functions bound to Perl in ", $o->{API}{script}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | "\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | "Check your C function definition(s) for Inline compatibility\n\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 46 | ▶ | ) if ((not defined$data->{functions}) and ($^W)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $data->{"functions"} and $^W
MC/DC0%0/2
not defined $data->{"functions"} and $^W
not defined $data->{"functions"}
$^W
Truth table33%1/3
not(A) and B
A= not defined $data->{"functions"}B= $^W
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 46 | for my $function (@{$data->{functions}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 77 | my $return_type = $data->{function}->{$function}->{return_type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 77 | my @arg_names = @{$data->{function}->{$function}->{arg_names}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 77 | my @arg_types = @{$data->{function}->{$function}->{arg_types}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 77 | $XS .= join '', ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | "\n$return_type\n$function (", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | join(', ', @arg_names), ")\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 77 | for my $arg_name (@arg_names) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 60 | my $arg_type = shift @arg_types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 60 | ▶ | last if $arg_type eq '...'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 60 | $XS .= "\t$arg_type\t$arg_name\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 77 | my %h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 77 | ▶ | if (defined($o->{CONFIG}{PROTOTYPE})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 2 | %h = %{$o->{CONFIG}{PROTOTYPE}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 77 | ▶ | if (defined($h{$function})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 2 | $XS .= " PROTOTYPE: $h{$function}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 77 | my $listargs = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 77 | ▶ | $listargs = pop @arg_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@arg_names and $arg_names[-1] eq "..."
MC/DC0%0/2
@arg_names and $arg_names[-1] eq "..."
@arg_names
$arg_names[-1] eq "..."
Truth table66%2/3
A and B
A= @arg_namesB= $arg_names[-1] eq "..."
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | if (@arg_names and $arg_names[-1] eq '...'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 77 | my $arg_name_list = join(', ', @arg_names); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 77 | ▶ | if ($return_type eq 'void') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 18 | ▶ | if ($o->{CONFIG}{_TESTING}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 10 | $XS .= <<END; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | PREINIT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | PerlIO* stream; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | I32* temp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | PPCODE: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | temp = PL_markstack_ptr++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | $function($arg_name_list); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | stream = PerlIO_open(\"$dir/void_test\", \"a\"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | if (stream == NULL) warn(\"%s\\n\", \"Unable to open $dir/void_test for appending\"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | if (PL_markstack_ptr != temp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | PerlIO_printf(stream, \"%s\\n\", \"TRULY_VOID\"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | PerlIO_close(stream); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | PL_markstack_ptr = temp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | XSRETURN_EMPTY; /* return empty stack */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | PerlIO_printf(stream, \"%s\\n\", \"LIST_CONTEXT\"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | PerlIO_close(stream); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | return; /* assume stack size is correct */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 8 | $XS .= <<END; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | PREINIT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | I32* temp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | PPCODE: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | temp = PL_markstack_ptr++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | $function($arg_name_list); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | if (PL_markstack_ptr != temp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | /* truly void, because dXSARGS not invoked */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | PL_markstack_ptr = temp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | XSRETURN_EMPTY; /* return empty stack */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | /* must have used dXSARGS; list context implied */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | return; /* assume stack size is correct */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | elsif ($listargs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | $XS .= <<END; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | PREINIT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | I32* temp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | CODE: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | temp = PL_markstack_ptr++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | RETVAL = $function($arg_name_list); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | PL_markstack_ptr = temp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | OUTPUT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | RETVAL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 46 | $XS .= "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 46 | return $XS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | # Generate the INLINE.h file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | sub write_Inline_headers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 47 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_Inline_headers: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 47 | ▶ | open HEADER, "> ".File::Spec->catfile($o->{API}{build_dir},"INLINE.h") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | or croak; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 47 | print HEADER <<'END'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | #define Inline_Stack_Vars dXSARGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | #define Inline_Stack_Items items | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | #define Inline_Stack_Item(x) ST(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | #define Inline_Stack_Reset sp = mark | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | #define Inline_Stack_Push(x) XPUSHs(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | #define Inline_Stack_Done PUTBACK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | #define Inline_Stack_Return(x) XSRETURN(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | #define Inline_Stack_Void XSRETURN(0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | #define INLINE_STACK_VARS Inline_Stack_Vars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | #define INLINE_STACK_ITEMS Inline_Stack_Items | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | #define INLINE_STACK_ITEM(x) Inline_Stack_Item(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | #define INLINE_STACK_RESET Inline_Stack_Reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | #define INLINE_STACK_PUSH(x) Inline_Stack_Push(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | #define INLINE_STACK_DONE Inline_Stack_Done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | #define INLINE_STACK_RETURN(x) Inline_Stack_Return(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | #define INLINE_STACK_VOID Inline_Stack_Void | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | #define inline_stack_vars Inline_Stack_Vars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | #define inline_stack_items Inline_Stack_Items | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | #define inline_stack_item(x) Inline_Stack_Item(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | #define inline_stack_reset Inline_Stack_Reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | #define inline_stack_push(x) Inline_Stack_Push(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | #define inline_stack_done Inline_Stack_Done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | #define inline_stack_return(x) Inline_Stack_Return(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | #define inline_stack_void Inline_Stack_Void | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 47 | close HEADER; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | # Generate the Makefile.PL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | sub write_Makefile_PL { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 47 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_Makefile_PL: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 47 | $o->{ILSM}{xsubppargs} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 47 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 47 | for (@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 93 | $o->{ILSM}{xsubppargs} .= "-typemap \"$_\" "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | my %options = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | VERSION => $o->{API}{version} || '0.00', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 47 | %{$o->{ILSM}{MAKEFILE}}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | NAME => $o->{API}{module}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 47 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$o->{'API'}{'version'} || '0.00'
MC/DC0%0/1
$o->{'API'}{'version'} || '0.00'
$o->{'API'}{'version'}
Truth table50%1/2
A
A= $o->{'API'}{'version'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 47 | ▶ | open MF, "> ".File::Spec->catfile($o->{API}{build_dir},"Makefile.PL") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | or croak; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 47 | print MF <<END; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | use ExtUtils::MakeMaker; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | my %options = %\{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 47 | local $Data::Dumper::Terse = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 47 | local $Data::Dumper::Indent = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 47 | print MF Data::Dumper::Dumper(\ %options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 47 | print MF <<END; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | \}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | WriteMakefile(\%options); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | # Remove the Makefile dependency. Causes problems on a few systems. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | sub MY::makefile { '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 47 | close MF; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | # Run the build process. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | sub compile { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 47 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 47 | my $build_dir = $o->{API}{build_dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 47 | my $cwd = &cwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 47 | ▶ | ($cwd) = $cwd =~ /(.*)/ if $o->UNTAINT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 47 | chdir $build_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | # Run these in an eval block, so that we get to chdir back to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | # $cwd if there's a failure. (Ticket #81375.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 47 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 47 | $o->call('makefile_pl', '"perl Makefile.PL"', 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 47 | $o->call('make', '"make"', 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 46 | $o->call('make_install', '"make install"', 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 47 | chdir $cwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 47 | ▶ | die if $@; #Die now that we've done the chdir back to $cwd. (#81375) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 46 | $o->call('cleanup', 'Cleaning Up', 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | sub makefile_pl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 47 | ▶ | my ($o) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makefile_pl: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 47 | my $perl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | -f ($perl = $Config::Config{perlpath}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 47 | ▶ | or ($perl = $^X) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-f ($perl = $Config::Config{"perlpath"}) or $perl = $^X
MC/DC0%0/2
-f ($perl = $Config::Config{"perlpath"}) or $perl = $^X
-f ($perl = $Config::Config{"perlpath"})
$perl = $^X
Truth table33%1/3
A or B
A= -f ($perl = $Config::Config{"perlpath"})B= $perl = $^X
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | or croak "Can't locate your perl binary"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 47 | ▶ | $perl = qq{"$perl"} if $perl =~ m/\s/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 47 | $o->system_call("$perl Makefile.PL", 'out.Makefile_PL'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 47 | $o->fix_make; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | sub make { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 47 | ▶ | my ($o) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make: called CC=4 SCAR=15.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | my $make = $o->{ILSM}{MAKE} || $Config::Config{make} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 47 | ▶ | or croak "Can't locate your make binary"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$o->{'ILSM'}{'MAKE'} || $Config::Config{'make'}
MC/DC0%0/2
$o->{'ILSM'}{'MAKE'} || $Config::Config{'make'}
$o->{'ILSM'}{'MAKE'}
$Config::Config{'make'}
Truth table33%1/3
A || B
A= $o->{'ILSM'}{'MAKE'}B= $Config::Config{'make'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | local $ENV{MAKEFLAGS} = $ENV{MAKEFLAGS} =~ s/(--jobserver-fds=[\d,]+)// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 47 | ▶ | if $ENV{MAKEFLAGS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 47 | $o->system_call("$make", 'out.make'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | sub make_install { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 46 | ▶ | my ($o) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_install: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | my $make = $o->{ILSM}{MAKE} || $Config::Config{make} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 46 | ▶ | or croak "Can't locate your make binary"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$o->{'ILSM'}{'MAKE'} || $Config::Config{'make'}
MC/DC0%0/2
$o->{'ILSM'}{'MAKE'} || $Config::Config{'make'}
$o->{'ILSM'}{'MAKE'}
$Config::Config{'make'}
Truth table33%1/3
A || B
A= $o->{'ILSM'}{'MAKE'}B= $Config::Config{'make'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 46 | ▶ | if ($ENV{MAKEFLAGS}) { # Avoid uninitialized warnings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | local $ENV{MAKEFLAGS} = $ENV{MAKEFLAGS} =~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 46 | s/(--jobserver-fds=[\d,]+)//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 46 | $o->system_call("$make pure_install", 'out.make_install'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | sub cleanup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 46 | ▶ | my ($o) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanup: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | my ($modpname, $modfname, $install_lib) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 46 | @{$o->{API}}{qw(modpname modfname install_lib)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 46 | ▶ | if ($o->{API}{cleanup}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | $o->rmpath( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 46 | File::Spec->catdir($o->{API}{directory},'build'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | $modpname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 46 | my $autodir = File::Spec->catdir($install_lib,'auto',$modpname); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 46 | my @files = ( ".packlist", map "$modfname.$_", qw( bs exp lib ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 46 | my @paths = grep { -e } map { File::Spec->catfile($autodir,$_) } @files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 46 | ▶ | unlink($_) || die "Can't delete file $_: $!" for @paths; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | sub system_call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 140 | ▶ | my ($o, $cmd, $output_file) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
system_call: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | my $build_noisy = defined $ENV{PERL_INLINE_BUILD_NOISY} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | ? $ENV{PERL_INLINE_BUILD_NOISY} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 140 | ▶ | : $o->{CONFIG}{BUILD_NOISY}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | # test this functionality with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | #perl -MInline=C,Config,BUILD_NOISY,1,FORCE_BUILD,1 -e "use Inline C => q[void inline_warner() { int *x = 2; }]" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 140 | ▶ | if (not $build_noisy) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 140 | $cmd = "$cmd > $output_file 2>&1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 140 | ▶ | ($cmd) = $cmd =~ /(.*)/ if $o->UNTAINT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 140 | ▶ | system($cmd) == 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | or croak($o->build_error_message($cmd, $output_file, $build_noisy)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | sub build_error_message { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 1 | ▶ | my ($o, $cmd, $output_file, $build_noisy) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_error_message: called CC=6 SCAR=18.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 1 | my $build_dir = $o->{API}{build_dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 1 | my $output = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 1 | ▶ | if (not $build_noisy and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $build_noisy and open OUTPUT, $output_file
MC/DC0%0/2
not $build_noisy and open OUTPUT, $output_file
not $build_noisy
open OUTPUT, $output_file
Truth table33%1/3
not(A) and B
A= not $build_noisyB= open OUTPUT, $output_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | open(OUTPUT, $output_file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 1 | local $/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 1 | $output = <OUTPUT>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 1 | close OUTPUT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 1 | my $errcode = $? >> 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 1 | $output .= <<END; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | A problem was encountered while attempting to compile and install your Inline | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | $o->{API}{language} code. The command that failed was: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | \"$cmd\" with error code $errcode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | The build directory was: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | $build_dir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | To debug the problem, cd to the build directory, and inspect the output files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | END | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 1 | ▶ | if ($cmd =~ /^make >/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 1 | for (sort keys %ENV) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 29 | ▶ | $output .= "Environment $_ = '$ENV{$_}'\n" if /^(?:MAKE|PATH)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 1 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | # This routine fixes problems with the MakeMaker Makefile. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 30 | my %fixes = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | INSTALLSITEARCH => 'install_lib', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | INSTALLDIRS => 'installdirs', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | XSUBPPARGS => 'xsubppargs', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | INSTALLSITELIB => 'install_lib', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | sub fix_make { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 30 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 47 | ▶ | my (@lines, $fix); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fix_make: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 47 | my $o = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 47 | $o->{ILSM}{install_lib} = $o->{API}{install_lib}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 47 | $o->{ILSM}{installdirs} = 'site'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 47 | ▶ | open(MAKEFILE, '< Makefile') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | or croak "Can't open Makefile for input: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 47 | @lines = <MAKEFILE>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 47 | close MAKEFILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 47 | ▶ | open(MAKEFILE, '> Makefile') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | or croak "Can't open Makefile for output: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 47 | for (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 49675 | ▶ | if (/^(\w+)\s*=\s*\S+.*$/ and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
/^(\w+)\s*=\s*\S+.*$/ and $fix = $fixes{$1}
MC/DC100%2/2
/^(\w+)\s*=\s*\S+.*$/ and $fix = $fixes{$1}
/^(\w+)\s*=\s*\S+.*$/
$fix = $fixes{$1}
Truth table100%3/3
A and B
A= /^(\w+)\s*=\s*\S+.*$/B= $fix = $fixes{$1}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | $fix = $fixes{$1} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 188 | my $fixed = $o->{ILSM}{$fix}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 188 | print MAKEFILE "$1 = $fixed\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 49487 | print MAKEFILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 47 | close MAKEFILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | sub quote_space { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | # Do nothing if $ENV{NO_INSANE_DIRNAMES} is set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 18 | ▶ | return $_[0] if $ENV{NO_INSANE_DIRNAMES}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quote_space: called CC=15 SCAR=27.1
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | # If $_[0] contains one or more doublequote characters, assume | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | # that whitespace has already been quoted as required. Hence, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | # do nothing other than immediately return $_[0] as is. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | # We currently don't properly handle tabs either, so we'll | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | # do the same if $_[0] =~ /\t/. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 17 | ▶ | return $_[0] if ($_[0] =~ /"/ || $_[0] =~ /\t/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_[0] =~ /"/ or $_[0] =~ /\t/
MC/DC50%1/2
$_[0] =~ /"/ or $_[0] =~ /\t/
$_[0] =~ /"/
$_[0] =~ /\t/
Truth table66%2/3
A or B
A= $_[0] =~ /"/B= $_[0] =~ /\t/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | # We want to split on /\s\-I/ not /\-I/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 15 | my @in = split /\s\-I/, $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 15 | my $s = @in - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 15 | my %s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | my %q; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | # First up, let's reinstate the ' ' characters that split | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | # removed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 15 | ▶ | for (my $i = 0; $i < $s; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 41 | $in[$i] .= ' '; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | # This for{} block dies if it finds that any of the ' -I' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | # occurrences in $_[0] are part of a directory name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 15 | ▶ | for (my $i = 1; $i < $s; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 26 | my $t = $in[$i + 1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 26 | ▶ | while ($t =~ /\s$/) {chop $t} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 26 | ▶ | die "Found a '", $in[$i], "-I", $t, "' directory.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | " INC Config argument is ambiguous.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | " Please use doublequotes to signify your intentions" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | if -d ($in[$i] . "-I" . $t); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 14 | $s++; # Now the same as scalar(@in) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | # Remove (but also Keep track of the amount of) whitespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | # at the end of each element of @in. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 14 | ▶ | for (my $i = 0; $i < $s; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 50 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 50 | ▶ | while ($in[$i] =~ /\s$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 83 | chop $in[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 83 | $count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 50 | $s{$i} = $count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | # Note which elements of @in still contain whitespace. These | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | # (and only these) elements will be quoted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 14 | ▶ | for (my $i = 0; $i < $s; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 50 | ▶ | $q{$i} = 1 if $in[$i] =~ /\s/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | # Reinstate the occurrences of '-I' that were removed by split(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | # insert any quotes that are needed, reinstate the whitespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | # that was removed earlier, then join() the array back together | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | # again. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 14 | ▶ | for (my $i = 0; $i < $s; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 50 | ▶ | $in[$i] = '-I' . $in[$i] if $i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 50 | ▶ | $in[$i] = '"' . $in[$i] . '"' if $q{$i}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 50 | $in[$i] .= ' ' x $s{$i}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | # Note: If there was no whitespace that needed quoting, the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | # original argument should not have changed in any way. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 14 | my $out = join '', @in; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 14 | $out =~ s/"\-I\s+\//"\-I\//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 14 | $_[0] = $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | # This routine used by C/t/09parser to test that the expected parser is in use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | #============================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | sub _parser_test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 14 | ▶ | my $dir = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parser_test: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 14 | my $file = "$dir/parser_id"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 14 | ▶ | warn "$file: $!" if !open(TEST_FH, '>>', $file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 14 | print TEST_FH $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 14 | ▶ | warn "$file: $!" if !close(TEST_FH); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 30 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||