Reimplemented Unicode case mapping in a slightly more efficient way.
[wine] / dlls / opengl32 / make_opengl_norm
1 #!/usr/bin/perl -w
2
3 print "
4 /* Auto-generated file... Do not edit ! */
5
6 #include \"config.h\"
7 #include \"wine_gl.h\"
8
9
10 ";
11
12 #
13 # Now, the functions from the include file
14 #
15 open(INC, "/usr/X11R6/include/GL/gl.h") || die "Could not open GL/gl.h";
16 while ($line = <INC>) {
17     if ($line =~ /GLAPI.*GLAPIENTRY/) {
18         # Start of a function declaration
19         ($ret, $name, $args) = ($line =~ /GLAPI (.*) GLAPIENTRY *(.*)\((.*)/);
20         
21         # Remove all extensions except the multitexture one (see OpenGL ABI)
22         if (($name !~ /(MESA|PGI|ARB|EXT)/) ||
23             ($name =~ /MultiTexCoord/) ||
24             ($name =~ /ActiveTextureARB/)) {
25             print "/***********************************************************************\n";
26             print " *\t\t$name\n";
27             print " */\n";
28             print "$ret WINAPI wine_$name(";
29             @rargs = ();
30             @names = ();
31
32             # Now, get the parameters
33             while (1) {
34                 @args = split /,|\)/, $args;
35
36                 foreach (@args) {
37                     if ($_ =~ /[a-z,A-Z]/) {
38                         ($a) = ($_ =~ /^\s*(.*)\s*$/);
39                         if ($a =~ /\*\*/) {
40                             ($var) = ($a =~ /\*\*(\w*)/);
41                         } elsif ($a =~ /\*/) {
42                             ($var) = ($a =~ /\*(\w*)/);
43                         } else {
44                             ($var) = ($a =~ /\s(\w*)/);
45                         }
46                         @rargs = (@rargs, $a);
47                         if ($var !~ /void/) {
48                             @names = (@names, $var);
49                         }
50                     }
51                 }
52
53                 if ($args !~ /\)/) {
54                     $args = <INC>;
55                 } else {
56                     last;
57                 }
58             }
59
60             print shift @rargs;
61             foreach (@rargs) {
62                 print ", $_";
63             }
64             print ") {\n";
65             if ($ret !~ /void/) {
66                 print "  $ret ret;\n";
67             }
68             print "  ENTER_GL();\n";
69             if ($ret !~ /void/) {
70                 print "  ret = ";
71             } else {
72                 print "  ";
73             }
74             print "$name(";
75
76             $farg = shift @names;
77             if ($farg) {
78                 print "$farg";
79
80                 foreach (@names) {
81                     print ", $_";
82                 }
83             }
84             print ");\n";
85             print "  LEAVE_GL();\n";
86             if ($ret !~ /void/) {
87                 print "  return ret;\n";
88             }
89             print "}\n\n";
90         }
91     }
92 }
93
94 close(INC);