lib/SDL2/Utils.pm

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