lib/SDL2/Utils.pm

filter: Statementstmt 50.2% 102 / 203 Branchbran 8.4% 11 / 130 Conditioncond 10.7% 3 / 28 MC/DCmcdc 0.0% 0 / 18 Subroutinesub 63.1% 24 / 38 Podpod n/a totaltotal 33.5% 140 / 417 CC 86 SCAR 63.1
CC
86
Cov
32%
_conversion
1640.0
enumX
110.0
ffi
34.3
CRAP 551.4
« lib/SDL2/Utils/Type/Enum.pm ↑ Summary blib/lib/SDL2/Utils/Type/Enum.pm »
1 package SDL2::Utils {
2  
3 # FFI utilities
4 3 ▶ use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶ use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶ use base 'Exporter::Tiny';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 our @EXPORT = qw[attach define deprecate has enum ffi is threads_wrapped];
8 3 ▶ use Alien::libsdl2;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶ use FFI::CheckLib;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶ use FFI::Platypus 1.46;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶ use FFI::Platypus::Memory qw[malloc strcpy free];
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶ use FFI::C;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶ use FFI::C::Def;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶ use FFI::C::ArrayDef;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶ use FFI::C::StructDef;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 ▶ use FFI::C::UnionDef;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶ use FFI::Platypus::Closure;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶ use File::Spec::Functions qw[catdir canonpath rel2abs];
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 ▶ use Path::Tiny qw[path];
Subroutine BEGIN: called CC=1 SCAR=0.0
20 3 ▶ use File::Share qw[dist_dir];
Subroutine BEGIN: called CC=1 SCAR=0.0
21 3 ▶ use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 3 ▶ use SDL2::Utils::Type::Enum;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 3 ▶ use Ref::Util qw( is_ref is_plain_arrayref is_plain_hashref );
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 ▶ sub deprecate ($str) {
Subroutine deprecate: not called CC=2 SCAR=17.9
26 0 ▶ warnings::warn( 'deprecated', $str ) if warnings::enabled('deprecated');
Branch: 1 branch
BranchTrueFalseTotal
if warnings::enabled("deprecated") 0 0 0
27 }
28  
29 #sub ver() { # TODO: Remove in favor of SDL2::version
30 # CORE::state $ver;
31 # $ver // ffi()->function( SDL_GetVersion => ['SDL_Version'] )
32 # ->call( $ver = SDL2::Version->new() );
33 # $ver;
34 #}
35 #ddx( Alien::libsdl2->dynamic_libs );
36 my $thread_safe = 0;
37 0 ▶ sub threads_wrapped () {$thread_safe} # Fake thread safe
Subroutine threads_wrapped: not called CC=1 SCAR=6.9
38  
39 ▶ sub ffi () {
Subroutine ffi: called CC=18 SCAR=35.3
40 3 CORE::state $ffi;
41 3 ▶ if ( !defined $ffi ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $ffi) 3 0 3
42 3 ▶ use FFI::Build;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 3 ▶ use FFI::Build::File::C;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 3 ▶ if ( defined(&Test2::V0::diag) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &Test2::V0::diag) 3 0 3
45 3 my $Win32 = $^O eq 'MSWin32';
46 #
47 #skip_all 'requires a shared object or DLL'
48 # unless Alien::libsdl2->dynamic_libs;
49 #
50 # nasty hack
51 #$ENV{LD_LIBRARY_PATH} = Alien::libsdl2->dist_dir . '/lib';
52 #$ENV{DYLD_LIBRARY_PATH} = Alien::libsdl2->dist_dir . '/lib';
53 #
54 3 eval { Test2::V0::diag( 'dist_dir: ' . Alien::libsdl2->dist_dir . '/lib' ) };
55 3 ▶ warn $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 3 3
56 3 eval { Test2::V0::diag( 'libs: ' . Alien::libsdl2->libs ) };
57 3 ▶ warn $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 3 0 3
58 3 eval { Test2::V0::diag( 'cflags: ' . Alien::libsdl2->cflags ) };
59 3 ▶ warn $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 3 0 3
60 3 eval { Test2::V0::diag( 'cflags static: ' . Alien::libsdl2->cflags_static ) };
61 3 ▶ warn $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 3 0 3
62 3 eval {
63 3 Test2::V0::diag( 'Dynamic libs: ' . join ':', Alien::libsdl2->dynamic_libs );
64 };
65 3 ▶ warn $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 3 3
66 3 eval { Test2::V0::diag( 'bin dir: ' . join( ' ', Alien::libsdl2->bin_dir ) ) };
67 3 ▶ warn $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 3 3
68 }
69 3 my $lib = undef;
70 3 if (1) {
71 3 my $root = path(__FILE__)->absolute->parent(3)->realpath;
72 3 my $dir; # eval { dist_dir('SDL2-FFI') };
73 3 ▶ $dir //= $root->child('share')->realpath;
Condition33%1/3
$dir //= $root->child("share")->realpath
l!l&&r!l&&!r
030
MC/DC0%0/2
$dir //= $root->child("share")->realpath
$dir $root->child("share")->realpath
Truth table33%1/3
A //= B
A= $dirB= $root->child("share")->realpath
ABresult
1X1
011
000
74 3 my $c = $root->child('ffi/bundle.c');
75 3 ▶ if ( defined(&Test2::V0::diag) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &Test2::V0::diag) 3 0 3
76 3 ▶ eval { Test2::V0::diag( 'c file: ' . $c . ' | ' . ( -f $c ? '1' : '0' ) ) };
Branch: 1 branch
BranchTrueFalseTotal
-f $c ? : 3 0 3
77 }
78 3 ▶ my $build = FFI::Build->new(
Condition33%1/3
"Alien::libsdl2"->libs_static // "Alien::libsdl2"->dynamic_libs
l!l&&r!l&&!r
030
MC/DC0%0/2
"Alien::libsdl2"->libs_static // "Alien::libsdl2"->dynamic_libs
"Alien::libsdl2"->libs_static "Alien::libsdl2"->dynamic_libs
Truth table33%1/3
A // B
A= "Alien::libsdl2"->libs_staticB= "Alien::libsdl2"->dynamic_libs
ABresult
1X1
011
000
79 'bundle',
80 dir => $dir,
81 alien => ['Alien::libsdl2'],
82 source => [$c],
83 libs => [ Alien::libsdl2->libs_static() // Alien::libsdl2->dynamic_libs() ],
84 verbose => 2
85 );
86 3 ▶ $lib
Branch: 1 branch
BranchTrueFalseTotal
!(-f $build->file->path) || [stat $build->file->path]->[9] < [stat $c]->[9] ? : 3 0 3
Condition33%1/3
not -f $build->file->path or [stat $build->file->path]->[9] < [stat $c]->[9]
l!l&&r!l&&!r
300
MC/DC0%0/2
not -f $build->file->path or [stat $build->file->path]->[9] < [stat $c]->[9]
not -f $build->file->path [stat $build->file->path]->[9] < [stat $c]->[9]
Truth table33%1/3
not(A) or B
A= not -f $build->file->pathB= [stat $build->file->path]->[9] < [stat $c]->[9]
ABresult
1X1
011
000
87 = ( ( !-f $build->file->path ) ||
88 ( ( [ stat $build->file->path ]->[9] < [ stat $c ]->[9] ) ) ) ?
89 $build->build :
90 $build->file->path;
91  
92 #$lib
93 # = -f $build->file->path && -f $root->child('ffi/sdl2.c') &&
94 # [ stat $build->file->path ]->[9]
95 # >= [ stat( $root->child('ffi/sdl2.c') ) ]->[9] ? $build->file : $build->build;
96 # warn $lib;
97 0 ▶ $thread_safe = defined $lib ? $lib : ();
Branch: 1 branch
BranchTrueFalseTotal
defined $lib ? : 0 0 0
98 0 ▶ if ( defined(&Test2::V0::diag) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &Test2::V0::diag) 0 0 0
99 0 ▶ eval { Test2::V0::diag( 'lib: ' . $lib . ' | ' . ( -f $lib ? '1' : '0' ) ); };
Branch: 1 branch
BranchTrueFalseTotal
-f $lib ? : 0 0 0
100 }
101 }
102 {
103 0 $ffi = FFI::Platypus->new(
104 api => 2,
105 experimental => 2,
106 lib => [ Alien::libsdl2->dynamic_libs, $lib, ]
107 );
108 0 FFI::C->ffi($ffi);
109 }
110  
111 #$thread_safe = $ffi->bundle();
112 #$lib //= $ffi->bundle;
113 #if ( defined(&Test2::V0::diag) ) {
114 # eval {
115 # Test2::V0::diag( 'bundle: ' . $lib->path . ' | ' . ( -f $lib ? '1' : '0' ) );
116 # };
117 #}
118 }
119 0 $ffi;
120 }
121 ffi(); # auto-init
122  
123 sub enumX {
124 0 ▶ (undef) = shift;
Subroutine enumX: not called CC=10 SCAR=47.0
125 0 ▶ my $name = defined $_[0] && !is_ref $_[0] ? shift : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] && !is_ref($_[0]) ? : 0 0 0
Condition0%0/3
defined $_[0] and not is_ref($_[0])
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0] and not is_ref($_[0])
defined $_[0] not is_ref($_[0])
Truth table0%0/3
A and not(B)
A= defined $_[0]B= not is_ref($_[0])
ABresult
0X0
100
111
126 0 ▶ my @values = defined $_[0] && is_plain_arrayref $_[0] ? @{ shift() } : ();
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] && is_plain_arrayref($_[0]) ? : 0 0 0
Condition0%0/3
defined $_[0] and is_plain_arrayref($_[0])
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0] and is_plain_arrayref($_[0])
defined $_[0] is_plain_arrayref($_[0])
Truth table0%0/3
A and B
A= defined $_[0]B= is_plain_arrayref($_[0])
ABresult
0X0
100
111
127 0 ▶ my %config = defined $_[0] && is_plain_hashref $_[0] ? %{ shift() } : ();
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] && is_plain_hashref($_[0]) ? : 0 0 0
Condition0%0/3
defined $_[0] and is_plain_hashref($_[0])
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0] and is_plain_hashref($_[0])
defined $_[0] is_plain_hashref($_[0])
Truth table0%0/3
A and B
A= defined $_[0]B= is_plain_hashref($_[0])
ABresult
0X0
100
111
128 0 my ( $class, $filename ) = caller;
129 0 ▶ unless ( defined $name ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $name) 0 0 0
130 0 $name = lcfirst [ split /::/, $class ]->[-1];
131 0 $name =~ s/([A-Z]+)/'_' . lc($1)/ge;
132 0 $name .= "_t";
133 }
134 0 ▶ my $ffi = FFI::C::_ffi_get($filename), $config{package} ||= $class;
Condition0%0/3
$config{"package"} ||= $class
l!l&&r!l&&!r
000
MC/DC0%0/2
$config{"package"} ||= $class
$config{"package"} $class
Truth table0%0/3
A ||= B
A= $config{"package"}B= $class
ABresult
1X1
011
000
135 0 my @maps;
136 0 $config{maps} = \@maps;
137 0 ▶ my $rev = $config{rev} ||= 'str';
Condition0%0/2
$config{"rev"} ||= "str"
l!l
00
MC/DC0%0/1
$config{"rev"} ||= "str"
$config{"rev"}
Truth table0%0/2
A
A= $config{"rev"}
Aresult
11
00
138  
139 #use Data::Dump;
140 #ddx [$name, $rev, \%config, \@values];
141 0 ffi->load_custom_type( 'SDL2::Utils::Type::Enum', $name, \%config, @values );
142 0 my ( $str_lookup, $int_lookup, $type ) = @maps;
143  
144 #ddx [$name, $rev, $str_lookup, $int_lookup, $type];
145 0 require FFI::C::Def;
146 0 ffi->def(
147 'FFI::C::EnumDef',
148 $name,
149 FFI::C::EnumDef->new(
150 str_lookup => $str_lookup,
151 int_lookup => $int_lookup,
152 type => $type,
153 rev => $rev,
154 )
155 );
156 }
157  
158 ▶ sub enum (%args) {
Subroutine enum: not called CC=5 SCAR=34.0
159 0 my ($package) = caller();
160 0 $package = 'SDL2::FFI';
161 0 for my $tag ( keys %args ) {
162  
163 #use Data::Dump;
164 #ddx $args{$tag} if $tag eq 'WindowShapeMode';
165 #use Data::Dump;
166 #ddx $args{$tag};
167 #ddx @{$args{$tag}};
168 #my $enum =
169 #FFI::C->enum( $tag => $args{$tag}, { package => $package } );
170 #ffi->load_custom_type('SDL2::Utils::Type::Enum', $tag => { rev=>'int', package => $package, maps => \@maps } => $args{$tag} );
171 enumX(
172 ffi,
173 0 $tag => $args{$tag},
174 { rev => 'dualvar', package => $package, type => 'int', casing => 'keep' }
175 );
176  
177 #ffi->load_custom_type(
178 # '::Enum',
179 # $tag,
180 # {ref => 'int', package => $package },
181 # @{$args{$tag}}
182 # #{ rev => 'int', package => 'Foo', prefix => 'FOO_' },
183 #);
184 0 my $_tag = $tag; # Simple rules:
185 0 $_tag =~ s[^SDL_][]; # No SDL_XXXXX
186 0 ▶ $_tag = lcfirst $_tag unless $_tag =~ m[^.[A-Z]]; # Save GLattr
Branch: 1 branch
BranchTrueFalseTotal
unless $_tag =~ /^.[A-Z]/ 0 0 0
187  
188 #ddx $enum if $tag eq 'WindowShapeMode';
189 # warn $_tag if $tag eq 'WindowShapeMode';
190 0 push @{ $SDL2::FFI::EXPORT_TAGS{$_tag} },
191 0 ▶ sort map { ref $_ ? ref $_ eq 'CODE' ? $_->() : $_->[0] : $_ } @{ $args{$tag} };
Branch: 2 branches
BranchTrueFalseTotal
ref $_ ? : 0 0 0
ref $_ eq 'CODE' ? : 0 0 0
192 }
193 }
194  
195 ▶ sub enumD (%args) {
Subroutine enumD: not called CC=5 SCAR=30.5
196 0 my ($package) = caller();
197 0 $package = 'SDL2::FFI';
198 0 for my $tag ( keys %args ) {
199 3 ▶ use Data::Dump;
Subroutine BEGIN: called CC=1 SCAR=0.0
200  
201 #ddx $args{$tag}; # if $tag eq 'WindowShapeMode';
202 #use Data::Dump;
203 #warn $tag;
204 #ddx $args{$tag};
205 #ddx @{$args{$tag}};
206 #my $enum =
207 #FFI::C->enum( $tag => $args{$tag}, { package => $package } );
208 #ffi->load_custom_type('::Enum', $tag => { package => $package } => [$args{$tag}] );
209 #ffi->load_custom_type('SDL2::Utils::Type::Enum' => $tag => { ref => 'int', package => $package, casing => 'keep' }
210 # , $args{$tag}
211 #);
212 0 warn $tag;
213 ffi->load_custom_type(
214 'SDL2::Utils::Type::Enum', $tag, { rev => 'dualvar', package => $package },
215 0 @{ $args{$tag} }
216  
217 #{ rev => 'int', package => 'Foo', prefix => 'FOO_' },
218 );
219 0 my $_tag = $tag; # Simple rules:
220 0 $_tag =~ s[^SDL_][]; # No SDL_XXXXX
221 0 ▶ $_tag = lcfirst $_tag unless $_tag =~ m[^.[A-Z]]; # Save GLattr
Branch: 1 branch
BranchTrueFalseTotal
unless $_tag =~ /^.[A-Z]/ 0 0 0
222  
223 #ddx $enum if $tag eq 'WindowShapeMode';
224 # warn $_tag if $tag eq 'WindowShapeMode';
225 0 push @{ $SDL2::FFI::EXPORT_TAGS{$_tag} },
226 0 ▶ sort map { ref $_ ? ref $_ eq 'CODE' ? $_->() : $_->[0] : $_ } @{ $args{$tag} };
Branch: 2 branches
BranchTrueFalseTotal
ref $_ ? : 0 0 0
ref $_ eq 'CODE' ? : 0 0 0
227 }
228 }
229  
230 ▶ sub attach (%args) {
Subroutine attach: not called CC=3 SCAR=24.8
231 0 my ($package) = caller();
232 0 $package = 'SDL2::FFI';
233 0 for my $tag ( sort keys %args ) {
234 0 for my $func ( sort keys %{ $args{$tag} } ) {
235  
236 #warn sprintf 'ffi->attach( %s => %s);', $func,
237 # Data::Dump::dump( @{ $args{$tag}{$func} } )
238 # if ref $args{$tag}{$func}[1] && ref $args{$tag}{$func}[1] eq 'ARRAY';
239 0 my $perl = $func;
240 0 $perl =~ s[^Bundle_][];
241 0 ffi->attach( [ $func => $package . '::' . $perl ] => @{ $args{$tag}{$func} } );
242 0 push @{ $SDL2::FFI::EXPORT_TAGS{$tag} }, $perl;
243 }
244 }
245 }
246 my %is;
247  
248 ▶ sub is ($is) {
Subroutine is: not called CC=1 SCAR=6.9
249 0 my ($package) = caller;
250 0 $is{$package} = $is;
251 }
252 0 ▶ sub get_is ($package) { $is{$package} // '' }
Subroutine get_is: not called CC=2 SCAR=17.9
Condition0%0/2
$is{$package} // ""
l!l
00
MC/DC0%0/1
$is{$package} // ""
$is{$package}
Truth table0%0/2
A
A= $is{$package}
Aresult
11
00
253  
254 ▶ sub has (%args) { # Should be hash-like
Subroutine has: not called CC=2 SCAR=17.9
255 0 my ($package) = caller;
256 0 my $type = $package;
257 0 $type =~ s[^SDL2::][SDL_];
258 0 $type =~ s[::][_]g;
259  
260 #$class =~ s[^SDL_(.+)$]['SDL2::' . ucfirst $1]e;
261 #warn sprintf '%-20s => %-20s%s', $name, $class, (
262 # -f sub ($package) { $package =~ m[::(.+)]; './lib/SDL2/' . $1 . '.pod' }
263 # ->($class) ? '' : ' (undocumented)'
264 #);
265 0 my @args = (
266 ffi,
267 name => $type, # C type
268 class => $package, # package
269 nullable => 1,
270 trim_string => 1,
271 members => \@_ # Keep order rather than use %args
272 );
273 0 ▶ get_is($package) eq 'Union' ? FFI::C::UnionDef->new(@args) : FFI::C::StructDef->new(@args);
Branch: 1 branch
BranchTrueFalseTotal
get_is($package) eq 'Union' ? : 0 0 0
274 }
275  
276 ▶ sub define (%args) {
Subroutine define: not called CC=5 SCAR=29.7
277 0 my ($package) = caller();
278 0 $package = 'SDL2::FFI';
279 0 for my $tag ( keys %args ) {
280  
281 #print $_->[0] . ' ' for sort { $a->[0] cmp $b->[0] } @{ $Defines{$tag} };
282 #no strict 'refs';
283 ref $_->[1] eq 'CODE' ?
284  
285 #constant->import( $package . '::' .$_->[0] => $_->[1]->() ) : #
286 3 ▶ sub { no strict 'refs'; *{ $package . '::' . $_->[0] } = $_->[1] }
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine __ANON__: not called CC=1 SCAR=0.6
287 ->() :
288 constant->import( $package . '::' . $_->[0] => $_->[1] )
289 0 ▶ for @{ $args{$tag} };
Branch: 1 branch
BranchTrueFalseTotal
ref $_->[1] eq 'CODE' ? : 0 0 0
290 0 push @{ $SDL2::FFI::EXPORT_TAGS{$tag} },
291 0 ▶ sort map { ref $_ ? $_->[0] : $_ } @{ $args{$tag} };
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 0 0 0
292 }
293 }
294 #
295 0 ▶ sub _tokenize_in ( $str, $pointers = 1 ) { # TODO: reconciliation between this and _out
Subroutine _tokenize_in: not called CC=2 SCAR=17.9
296 0 my @ret;
297 0 $str =~ s{
298 \%
299 \d*?
300 (?<type> (?:[\+-]?[di]|0|x|X|u|f|F|e|E|a|A|g|G|n|p|s|c|lc|\d\[.+?\]))
301 }{
302 0 push @ret, _conversion($+{type}, $pointers )}gexsm;
303 0 @ret;
304 }
305  
306 0 ▶ sub _tokenize_out ( $str, $pointers = 1 ) {
Subroutine _tokenize_out: not called CC=3 SCAR=24.8
307 0 my @ret;
308 0 $str =~ s[
309 %[\^\-\+\d\.#]*?(?<len>(?:\*.)?\*)?(?<type>[csdioxXufFeEaAgGnp])
310 ][
311 0 ▶ push @ret, _conversion($+{type}, $pointers, $+{len} // ())]gexsm;
Condition0%0/3
$+{"len"} // ()
l!l&&r!l&&!r
000
MC/DC0%0/2
$+{"len"} // ()
$+{"len"} ()
Truth table0%0/3
A // B
A= $+{"len"}B= ()
ABresult
1X1
011
000
312 0 @ret;
313 }
314  
315 0 ▶ sub _conversion ( $conv, $pointers = 1, $len = '' ) {
Subroutine _conversion: not called CC=40 SCAR=74.0
316 0 my $count = () = $len =~ m[(\*)]msg;
317 0 ▶ my $retval
Branch: 36 branches
BranchTrueFalseTotal
$conv eq 'c' ? : 0 0 0
$conv eq 's' ? : 0 0 0
$conv eq '[' ? : 0 0 0
$conv eq 'd' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'i' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'u' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'o' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'x' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'X' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'n' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'a' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'A' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'e' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'E' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'f' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'F' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'g' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'G' ? : 0 0 0
$pointers ? : 0 0 0
$conv eq 'p' ? : 0 0 0
$conv eq 'lc' ? : 0 0 0
$conv =~ /^\d/ ? : 0 0 0
318 = $conv eq 'c' ? 'char' : $conv eq 's' ? 'string' : $conv eq '[' ? 'string' : # set
319 $conv eq 'd' ? ( $pointers ? 'int*' : 'int' ) :
320 $conv eq 'i' ? ( $pointers ? 'int*' : 'int' ) :
321 $conv eq 'u' ? ( $pointers ? 'uint*' : 'uint' ) :
322 $conv eq 'o' ? ( $pointers ? 'int*' : 'int' ) : # octal
323 $conv eq 'x' ? ( $pointers ? 'string' : 'int' ) : # hex
324 $conv eq 'X' ? ( $pointers ? 'string' : 'int' ) : # hex
325 $conv eq 'n' ? ( $pointers ? 'int*' : 'int' ) : # num of chars read so far
326 $conv eq 'a' ? ( $pointers ? 'float*' : 'float' ) :
327 $conv eq 'A' ? ( $pointers ? 'float*' : 'float' ) :
328 $conv eq 'e' ? ( $pointers ? 'float*' : 'float' ) :
329 $conv eq 'E' ? ( $pointers ? 'float*' : 'float' ) :
330 $conv eq 'f' ? ( $pointers ? 'float*' : 'float' ) :
331 $conv eq 'F' ? ( $pointers ? 'float*' : 'float' ) :
332 $conv eq 'g' ? ( $pointers ? 'float*' : 'float' ) :
333 $conv eq 'G' ? ( $pointers ? 'float*' : 'float' ) :
334 $conv eq 'p' ? 'opaque' :
335 $conv eq 'lc' ? 'wide_string' :
336 $conv =~ /^\d/ ? 'string' :
337 'broken: ' . $conv;
338 0 ▶ $len ? ( ( map {'int'} 1 .. $count ), $retval ) : $retval;
Branch: 1 branch
BranchTrueFalseTotal
$len ? : 0 0 0
339 }
340 };
341 1;
« lib/SDL2/Utils/Type/Enum.pm ↑ Summary blib/lib/SDL2/Utils/Type/Enum.pm »