Skip to content
Newer
Older
100644 31 lines (25 sloc) 602 Bytes
409ac58 @kthakore Added my crappy old script for gettin constants from headers
kthakore authored Nov 11, 2009
1 #!perl
2 use strict;
3 use warnings;
4
5 my $head_loc = `sdl-config --cflags`;
f14bf6b regex for #define
Tobias Leich authored Nov 11, 2009
6 $head_loc = (split ' ', $head_loc)[0];
7 $head_loc =~ s/-I//;
8 print "# Getting header constants from $head_loc\n";
409ac58 @kthakore Added my crappy old script for gettin constants from headers
kthakore authored Nov 11, 2009
9
10
f14bf6b regex for #define
Tobias Leich authored Nov 11, 2009
11 my @header = qw/ SDL.h SDL_events.h /;
409ac58 @kthakore Added my crappy old script for gettin constants from headers
kthakore authored Nov 11, 2009
12
13 foreach (@header)
14 {
f14bf6b regex for #define
Tobias Leich authored Nov 11, 2009
15 print "# from $_:\n";
16 open FH, "$head_loc/$_";
17 while(<FH>)
18 {
19 if($_ =~ /#define SDL_/)
20 {
21 my $line = $_;
22 my @cop = (split ' ', $line);
23 print 'sub '.$cop[1].' {return '.$cop[2].'}'."\n" ;
24 }
25
26 # pattern: "#define SDL_RELEASED 0"
27 printf("sub %s{ return %s; }\n", $1, $2) if($_ =~ /^#define\s+(\w+)\s+(\w+)\s*$/);
28 }
29 close FH;
409ac58 @kthakore Added my crappy old script for gettin constants from headers
kthakore authored Nov 11, 2009
30 }
Something went wrong with that request. Please try again.