Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 70 lines (50 sloc) 1.109 kB
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
1 #!/usr/bin/env perl
2 #
3
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
4 open XS, "< opengl_words.txt";
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
5 open CPP, "| cpp - > OpenGL.cx";
6
7 print CPP <<HEADER;
8 #include <GL/gl.h>
9 #include <GL/glu.h>
10
11 --cut--
12 HEADER
13
14 while (<XS>) {
4979eb1 @jtpalmer perltidy
jtpalmer authored
15 chomp();
16 print CPP "#$_ $_\n";
17 $words{$_} = 0;
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
18 }
19
20 close XS;
21 close CPP;
22
23 my $text;
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
24 open FP, "< OpenGL.cx"
4979eb1 @jtpalmer perltidy
jtpalmer authored
25 or die "Couldn't open OpenGL.cx\n";
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
26 {
4979eb1 @jtpalmer perltidy
jtpalmer authored
27 local $/ = undef;
28 $text = <FP>;
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
29 }
30
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
31 my ( $junk, $goodstuff ) = split "--cut--", $text;
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
32
33 $goodstuff =~ s/#(GL[U]?_[A-Z0-9_]+)\s+([0-9xa-fA-F]+)/sub main::$1 { $2 }/g;
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
34
35 for ( split "\n", $goodstuff ) {
4979eb1 @jtpalmer perltidy
jtpalmer authored
36 if (/sub main::(GL[U]?_[A-Z0-9_]+)/) {
37 push @words, $1;
38 }
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
39 }
40
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
41 for (@words) {
4979eb1 @jtpalmer perltidy
jtpalmer authored
42 $words{$_} = 1;
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
43 }
44
45 for ( keys %words ) {
4979eb1 @jtpalmer perltidy
jtpalmer authored
46 print STDERR "Failed to find word $_" unless ( $words{$_} );
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
47 }
48
49 open OGL, "> ../lib/SDL/OpenGL/Constants.pm";
50
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
51 $words = join( " ", @words );
ee5feab @kthakore scripts added from old sdlpl to generate constants
kthakore authored
52
53 print OGL <<HERE;
54 # SDL::OpenGL::Constants
55 #
56 # This is an autogenerate file, don't bother editing.
57 # Names are read from a list in opengl_words.txt and written by gl_const.pl.
58 #
59 # Copyright (C) 2003 David J. Goehrig <dave\@sdlperl.org>
60
61 package SDL::OpenGL::Constants;
62
63 $goodstuff
64
65 1;
66
67 HERE
68
69 system("rm OpenGL.cx");
Something went wrong with that request. Please try again.