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
|
|
987433
|
use strict; |
|
52
|
|
|
|
|
432
|
|
|
52
|
|
|
|
|
1498
|
|
34
|
52
|
|
|
52
|
|
296
|
use warnings; |
|
52
|
|
|
|
|
99
|
|
|
52
|
|
|
|
|
1705
|
|
35
|
52
|
|
|
52
|
|
344
|
use Carp; |
|
52
|
|
|
|
|
97
|
|
|
52
|
|
|
|
|
4366
|
|
36
|
|
|
|
|
|
|
|
37
|
52
|
|
|
52
|
|
348
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); |
|
52
|
|
|
|
|
107
|
|
|
52
|
|
|
|
|
4916
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
require Exporter; |
40
|
|
|
|
|
|
|
require DynaLoader; |
41
|
|
|
|
|
|
|
|
42
|
52
|
|
|
52
|
|
20355
|
use SDL_perl; |
|
52
|
|
|
|
|
166
|
|
|
52
|
|
|
|
|
1971
|
|
43
|
52
|
|
|
52
|
|
51354
|
use SDL::Constants ':SDL'; |
|
52
|
|
|
|
|
231
|
|
|
52
|
|
|
|
|
18712
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#use SDL::Internal::Loader; See TODO near END{} |
46
|
|
|
|
|
|
|
our @ISA = qw(Exporter DynaLoader); |
47
|
|
|
|
|
|
|
|
48
|
52
|
|
|
52
|
|
413
|
use base 'Exporter'; |
|
52
|
|
|
|
|
139
|
|
|
52
|
|
|
|
|
31860
|
|
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.548; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
print "$VERSION" if ( defined( $ARGV[0] ) && ( $ARGV[0] eq '--SDLperl' ) ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$SDL::DEBUG = 0; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub NULL { |
64
|
0
|
|
|
0
|
0
|
0
|
return 0; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# workaround, doing putenv from perl instead of sdl's: |
68
|
|
|
|
|
|
|
#int |
69
|
|
|
|
|
|
|
#putenv (variable) |
70
|
|
|
|
|
|
|
# char *variable |
71
|
|
|
|
|
|
|
# CODE: |
72
|
|
|
|
|
|
|
# RETVAL = SDL_putenv(variable); |
73
|
|
|
|
|
|
|
# OUTPUT: |
74
|
|
|
|
|
|
|
# RETVAL |
75
|
|
|
|
|
|
|
sub putenv { |
76
|
1
|
|
|
1
|
0
|
17290
|
my $cmd = shift; |
77
|
1
|
50
|
|
|
|
7
|
if ( $cmd =~ /^(\w+)=(.*)$/ ) { |
78
|
1
|
|
|
|
|
7
|
$ENV{$1} = $2; |
79
|
1
|
|
|
|
|
5
|
return 0; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
0
|
return -1; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# workaround as: |
86
|
|
|
|
|
|
|
# extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); |
87
|
|
|
|
|
|
|
sub set_error { |
88
|
3
|
|
|
3
|
0
|
5094
|
my ( $format, @arguments ) = @_; |
89
|
3
|
|
|
|
|
24
|
SDL::set_error_real( sprintf( $format, @arguments ) ); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# Hints for Inline.pm |
94
|
|
|
|
|
|
|
sub Inline |
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
0
|
0
|
|
my $language = shift; |
97
|
0
|
0
|
|
|
|
|
if ($language ne 'C') { |
98
|
0
|
|
|
|
|
|
warn "Warning: SDL.pm does not provide Inline hints for the $language language\n"; |
99
|
|
|
|
|
|
|
return |
100
|
0
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
require Alien::SDL; |
103
|
0
|
|
|
|
|
|
require File::Spec; |
104
|
0
|
|
|
|
|
|
my $libs = Alien::SDL->config('libs'); |
105
|
|
|
|
|
|
|
#This should be added in ldd flags section but it is only doing SDL_main for some reason. |
106
|
0
|
0
|
|
|
|
|
$libs .= ' '.File::Spec->catfile(Alien::SDL->config('prefix'),'lib','libSDL.dll.a') if( $^O =~ /Win32/ig ); |
107
|
0
|
|
|
|
|
|
my $cflags = Alien::SDL->config('cflags'); |
108
|
0
|
|
|
|
|
|
my $path; |
109
|
0
|
|
|
|
|
|
my $sdl_typemap = File::Spec->catfile( 'SDL', 'typemap' ); |
110
|
0
|
|
|
|
|
|
grep { my $find = File::Spec->catfile( $_, $sdl_typemap ); |
|
0
|
|
|
|
|
|
|
111
|
0
|
0
|
|
|
|
|
$path = $find if -e $find } @INC; |
112
|
|
|
|
|
|
|
return { |
113
|
0
|
|
|
|
|
|
LIBS => $libs, |
114
|
|
|
|
|
|
|
CCFLAGS => $cflags, |
115
|
|
|
|
|
|
|
TYPEMAPS => $path, |
116
|
|
|
|
|
|
|
AUTO_INCLUDE => '#include ' |
117
|
|
|
|
|
|
|
}; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
1; |