use gl.h to generate the *.in files. we are now supporting the full gl.h and glext.h apis.
diff --git a/opengl/libs/tools/glapigen b/opengl/libs/tools/glapigen
index 86506a8..a2c3a7b 100755
--- a/opengl/libs/tools/glapigen
+++ b/opengl/libs/tools/glapigen
@@ -16,50 +16,57 @@
use strict;
-my $lineNum = 0;
while (my $line = <>) {
- $lineNum += 1;
next if $line =~ /^\//;
next if $line =~ /^#/;
next if $line =~ /^\s*$/;
- if ($line !~ /^GL_ENTRY\(([^,]+),\s*([^,]+),\s*([^)]+)\)/) {
- printf STDERR "Cannot parse line number $lineNum:\n$line";
+ if ($line !~ /^GL_API\s+(.+)\s+GL_APIENTRY\s+([\w]+)\s*\(([^\)]+)\);/) {
next;
}
my $type = $1;
my $name = $2;
my $args = $3;
- printf("%s API_ENTRY(%s)(", $type, $name);
- my @args = split ',', $args;
-
- my $len = scalar(@args);
- for (my $num = 0; $num < $len; $num++) {
- print ", " if $num > 0;
- my $arg = $args[$num];
- if ($arg =~ /([^]]+)(\[[^]]\])/) {
- my $argtype = $1;
- my $array = $2;
- printf("%s arg%d%s", $argtype, $num, $array);
- } else {
- if ($arg eq "void") {
- printf("void");
- } else {
- printf("%s arg%d", $arg, $num);
- }
- }
+ #printf("%s", $line);
+
+ my $prefix = "";
+ if ($name eq "glEGLImageTargetTexture2DOES") {
+ $prefix = "__";
}
- printf(") {\n");
+ if ($name eq "glEGLImageTargetRenderbufferStorageOES") {
+ $prefix = "__";
+ }
+
+ printf("%s API_ENTRY(%s%s)(%s)", $type, $prefix, $name, $args);
+
+ printf(" {\n");
if ($type eq "void") {
printf(" CALL_GL_API(%s", $name);
} else {
printf(" CALL_GL_API_RETURN(%s", $name);
}
+ my @args = split ',', $args;
+ my $len = scalar(@args);
for (my $num = 0; $num < $len; $num++) {
if ($args[$num] ne "void") {
print ", ";
- printf("arg%d", $num);
+ #
+ # extract the name from the parameter
+ # type name
+ # const type *name
+ # type *name
+ # type name[4]
+ #
+ if ($args[$num] =~ /(\S+\s)+\**\s*([\w]+)/) {
+ printf("%s", $2);
+ }
}
}
- printf(");\n}\n\n");
+ printf(");\n");
+ printf("}\n");
}
+
+
+
+
+