From: Kartik Thakore Date: Wed, 11 Nov 2009 18:58:56 +0000 (-0500) Subject: Added my crappy old script for gettin constants from headers X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=409ac589b299e2760bd3353b784bef13c7b2b8cc;p=sdlgit%2FSDL_perl.git Added my crappy old script for gettin constants from headers --- diff --git a/scripts/auto_constants.pl b/scripts/auto_constants.pl new file mode 100644 index 0000000..a8f958b --- /dev/null +++ b/scripts/auto_constants.pl @@ -0,0 +1,26 @@ +#!perl +use strict; +use warnings; + +my $head_loc = `sdl-config --cflags`; + $head_loc = (split ' ', $head_loc)[0]; + $head_loc =~ s/-I//; +print 'Getting header constants from '.$head_loc."\n"; + + +my @header = qw/ SDL.h /; + +foreach (@header) +{ + open FH, $head_loc.'/'.$_; + while() + { + if ($_ =~ /#define SDL_/) + { + my $line = $_; + my @cop = (split ' ', $line); + print 'sub '.$cop[1].' {return '.$cop[2].'}'."\n" ; + } + } + close FH; +}