Sweden-Number/dlls/opengl32/make_opengl_norm

92 lines
1.7 KiB
Perl
Executable File

#!/usr/bin/perl -w
print "
/* Auto-generated file... Do not edit ! */
#include \"config.h\"
#include \"wine_gl.h\"
";
#
# Now, the functions from the include file
#
open(INC, "/usr/X11R6/include/GL/gl.h") || die "Could not open GL/gl.h";
while ($line = <INC>) {
if ($line =~ /GLAPI.*GLAPIENTRY/) {
# Start of a function declaration
($ret, $name, $args) = ($line =~ /GLAPI (.*) GLAPIENTRY *(.*)\((.*)/);
# Remove all extensions except the multitexture one (see OpenGL ABI)
if (($name !~ /(MESA|PGI|ARB|EXT)/) ||
($name =~ /MultiTexCoord/) ||
($name =~ /ActiveTextureARB/)) {
print "$ret WINAPI wine_$name(";
@rargs = ();
@names = ();
# Now, get the parameters
while (1) {
@args = split /,|\)/, $args;
foreach (@args) {
if ($_ =~ /[a-z,A-Z]/) {
($a) = ($_ =~ /^\s*(.*)\s*$/);
if ($a =~ /\*\*/) {
($var) = ($a =~ /\*\*(\w*)/);
} elsif ($a =~ /\*/) {
($var) = ($a =~ /\*(\w*)/);
} else {
($var) = ($a =~ /\s(\w*)/);
}
@rargs = (@rargs, $a);
if ($var !~ /void/) {
@names = (@names, $var);
}
}
}
if ($args !~ /\)/) {
$args = <INC>;
} else {
last;
}
}
print shift @rargs;
foreach (@rargs) {
print ", $_";
}
print ") {\n";
if ($ret !~ /void/) {
print " $ret ret;\n";
}
print " ENTER_GL();\n";
if ($ret !~ /void/) {
print " ret = ";
} else {
print " ";
}
print "$name(";
$farg = shift @names;
if ($farg) {
print "$farg";
foreach (@names) {
print ", $_";
}
}
print ");\n";
print " LEAVE_GL();\n";
if ($ret !~ /void/) {
print " return ret;\n";
}
print "}\n\n";
}
}
}
close(INC);