| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# SDL.pm |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Copyright (C) 2005 David J. Goehrig |
|
6
|
|
|
|
|
|
|
# Copyright (C) 2010 Kartik Thakore |
|
7
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or |
|
10
|
|
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public |
|
11
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either |
|
12
|
|
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version. |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# This library is distributed in the hope that it will be useful, |
|
15
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
17
|
|
|
|
|
|
|
# Lesser General Public License for more details. |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public |
|
20
|
|
|
|
|
|
|
# License along with this library; if not, write to the Free Software |
|
21
|
|
|
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
22
|
|
|
|
|
|
|
# |
|
23
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
|
24
|
|
|
|
|
|
|
# |
|
25
|
|
|
|
|
|
|
# Please feel free to send questions, suggestions or improvements to: |
|
26
|
|
|
|
|
|
|
# |
|
27
|
|
|
|
|
|
|
# Kartik Thakore |
|
28
|
|
|
|
|
|
|
# kthakore@cpan.org |
|
29
|
|
|
|
|
|
|
# |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
package SDL; |
|
32
|
|
|
|
|
|
|
|
|
33
|
52
|
|
|
52
|
|
1046257
|
use strict; |
|
|
52
|
|
|
|
|
114
|
|
|
|
52
|
|
|
|
|
2322
|
|
|
34
|
52
|
|
|
52
|
|
622
|
use warnings; |
|
|
52
|
|
|
|
|
92
|
|
|
|
52
|
|
|
|
|
1713
|
|
|
35
|
52
|
|
|
52
|
|
276
|
use Carp; |
|
|
52
|
|
|
|
|
94
|
|
|
|
52
|
|
|
|
|
5361
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
52
|
|
|
52
|
|
364
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); |
|
|
52
|
|
|
|
|
138
|
|
|
|
52
|
|
|
|
|
6796
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
require Exporter; |
|
40
|
|
|
|
|
|
|
require DynaLoader; |
|
41
|
|
|
|
|
|
|
|
|
42
|
52
|
|
|
52
|
|
46313
|
use SDL_perl; |
|
|
52
|
|
|
|
|
1565
|
|
|
|
52
|
|
|
|
|
3672
|
|
|
43
|
52
|
|
|
52
|
|
149342
|
use SDL::Constants ':SDL'; |
|
|
52
|
|
|
|
|
220
|
|
|
|
52
|
|
|
|
|
29115
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#use SDL::Internal::Loader; See TODO near END{} |
|
46
|
|
|
|
|
|
|
our @ISA = qw(Exporter DynaLoader); |
|
47
|
|
|
|
|
|
|
|
|
48
|
52
|
|
|
52
|
|
471
|
use base 'Exporter'; |
|
|
52
|
|
|
|
|
108
|
|
|
|
52
|
|
|
|
|
56980
|
|
|
49
|
|
|
|
|
|
|
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{SDL} }; |
|
50
|
|
|
|
|
|
|
push @EXPORT, 'NULL'; |
|
51
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
|
52
|
|
|
|
|
|
|
all => \@EXPORT, |
|
53
|
|
|
|
|
|
|
init => $SDL::Constants::EXPORT_TAGS{'SDL/init'}, |
|
54
|
|
|
|
|
|
|
defaults => $SDL::Constants::EXPORT_TAGS{'SDL/defaults'} |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
our $VERSION = '2.544'; |
|
58
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
print "$VERSION" if ( defined( $ARGV[0] ) && ( $ARGV[0] eq '--SDLperl' ) ); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$SDL::DEBUG = 0; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub NULL { |
|
65
|
0
|
|
|
0
|
0
|
0
|
return 0; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# workaround, doing putenv from perl instead of sdl's: |
|
69
|
|
|
|
|
|
|
#int |
|
70
|
|
|
|
|
|
|
#putenv (variable) |
|
71
|
|
|
|
|
|
|
# char *variable |
|
72
|
|
|
|
|
|
|
# CODE: |
|
73
|
|
|
|
|
|
|
# RETVAL = SDL_putenv(variable); |
|
74
|
|
|
|
|
|
|
# OUTPUT: |
|
75
|
|
|
|
|
|
|
# RETVAL |
|
76
|
|
|
|
|
|
|
sub putenv { |
|
77
|
1
|
|
|
1
|
0
|
21721
|
my $cmd = shift; |
|
78
|
1
|
50
|
|
|
|
9
|
if ( $cmd =~ /^(\w+)=(.*)$/ ) { |
|
79
|
1
|
|
|
|
|
8
|
$ENV{$1} = $2; |
|
80
|
1
|
|
|
|
|
6
|
return 0; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
return -1; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# workaround as: |
|
87
|
|
|
|
|
|
|
# extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); |
|
88
|
|
|
|
|
|
|
sub set_error { |
|
89
|
3
|
|
|
3
|
0
|
4569
|
my ( $format, @arguments ) = @_; |
|
90
|
3
|
|
|
|
|
25
|
SDL::set_error_real( sprintf( $format, @arguments ) ); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# Hints for Inline.pm |
|
95
|
|
|
|
|
|
|
sub Inline |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
0
|
|
|
0
|
0
|
|
my $language = shift; |
|
98
|
0
|
0
|
|
|
|
|
if ($language ne 'C') { |
|
99
|
0
|
|
|
|
|
|
warn "Warning: SDL.pm does not provide Inline hints for the $language language\n"; |
|
100
|
|
|
|
|
|
|
return |
|
101
|
0
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
require Alien::SDL; |
|
104
|
0
|
|
|
|
|
|
require File::Spec; |
|
105
|
0
|
|
|
|
|
|
my $libs = Alien::SDL->config('libs'); |
|
106
|
|
|
|
|
|
|
#This should be added in ldd flags section but it is only doing SDL_main for some reason. |
|
107
|
0
|
0
|
|
|
|
|
$libs .= ' '.File::Spec->catfile(Alien::SDL->config('prefix'),'lib','libSDL.dll.a') if( $^O =~ /Win32/ig ); |
|
108
|
0
|
|
|
|
|
|
my $cflags = Alien::SDL->config('cflags'); |
|
109
|
0
|
|
|
|
|
|
my $path; |
|
110
|
0
|
|
|
|
|
|
my $sdl_typemap = File::Spec->catfile( 'SDL', 'typemap' ); |
|
111
|
0
|
|
|
|
|
|
grep { my $find = File::Spec->catfile( $_, $sdl_typemap ); |
|
|
0
|
|
|
|
|
|
|
|
112
|
0
|
0
|
|
|
|
|
$path = $find if -e $find } @INC; |
|
113
|
|
|
|
|
|
|
return { |
|
114
|
0
|
|
|
|
|
|
LIBS => $libs, |
|
115
|
|
|
|
|
|
|
CCFLAGS => $cflags, |
|
116
|
|
|
|
|
|
|
TYPEMAPS => $path, |
|
117
|
|
|
|
|
|
|
AUTO_INCLUDE => '#include ' |
|
118
|
|
|
|
|
|
|
}; |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |