Like the AUTORADIOBUTTON, the parent of a RADIOBUTTON style button
[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 "$ret WINAPI wine_$name(";
26             @rargs = ();
27             @names = ();
28
29             # Now, get the parameters
30             while (1) {
31                 @args = split /,|\)/, $args;
32
33                 foreach (@args) {
34                     if ($_ =~ /[a-z,A-Z]/) {
35                         ($a) = ($_ =~ /^\s*(.*)\s*$/);
36                         if ($a =~ /\*\*/) {
37                             ($var) = ($a =~ /\*\*(\w*)/);
38                         } elsif ($a =~ /\*/) {
39                             ($var) = ($a =~ /\*(\w*)/);
40                         } else {
41                             ($var) = ($a =~ /\s(\w*)/);
42                         }
43                         @rargs = (@rargs, $a);
44                         if ($var !~ /void/) {
45                             @names = (@names, $var);
46                         }
47                     }
48                 }
49
50                 if ($args !~ /\)/) {
51                     $args = <INC>;
52                 } else {
53                     last;
54                 }
55             }
56
57             print shift @rargs;
58             foreach (@rargs) {
59                 print ", $_";
60             }
61             print ") {\n";
62             if ($ret !~ /void/) {
63                 print "  $ret ret;\n";
64             }
65             print "  ENTER_GL();\n";
66             if ($ret !~ /void/) {
67                 print "  ret = ";
68             } else {
69                 print "  ";
70             }
71             print "$name(";
72
73             $farg = shift @names;
74             if ($farg) {
75                 print "$farg";
76
77                 foreach (@names) {
78                     print ", $_";
79                 }
80             }
81             print ");\n";
82             print "  LEAVE_GL();\n";
83             if ($ret !~ /void/) {
84                 print "  return ret;\n";
85             }
86             print "}\n\n";
87         }
88     }
89 }
90
91 close(INC);