- Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathGFX_headers_digest.pl
54 lines (38 loc) · 1.28 KB
/
GFX_headers_digest.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use strict;
use warnings;
use Data::Dumper;
use File::Spec;
my$head_loc = `sdl-config --cflags`;
$head_loc = ( split'', $head_loc )[0];
$head_loc =~ s/-I//;
# This should be a config file that is updated regularly
my%mod_headers = (
SDL_gfxPrimitives=>'SDL::GFX::Primitives',
SDL_rotozoom=>'SDL::GFX::Rotozoom',
SDL_framerate=>'SDL::GFX::Framerate',
SDL_imageFilter=>'SDL::GFX::ImageFilter',
SDL_gfxBlitFunc=>'SDL::GFX::BlitFunc',
);
#check to see we have a different path set for SDL_gfx
#
if ( $ENV{SDL_GFX_LOC} && -d$ENV{SDL_GFX_LOC} ) {
warn'Using user defined location for SDL_GFX and not ' . $head_loc;
$head_loc = $ENV{SDL_GFX_LOC};
}
while ( my ( $header, $module ) = each(%mod_headers) ) {
my$file = File::Spec->catfile( $head_loc, $header . '.h' );
warn" Creating Config for: $file at $module ::Config \n";
my$config = { header=>$header . '.h', file=>$file, module=>$module };
my$FH;
open$FH, '<' . $file
orwarn"Cannot find $file please set \$ENV{SDL_GFX_LOC} to point to a different location : $!";
if ( !$FH ) { $config->{exist} = -1; next }
my@methods = ();
grep {
$_ =~ /^(\s+|)(\S+) (\S+) (\*|)(\S+)(\()/;
push( @methods, $5 ) if$5
} <$FH>;
$config->{methods} = \@methods;
close$FH;
warn Dumper $config;
}