]> git.cworth.org Git - apitrace/blobdiff - specs/scripts/glspec.py
Update khronos headers.
[apitrace] / specs / scripts / glspec.py
index dbd20ce6b65bc78676882eef4ed52f9cf1845fec..2c3c2865329dba6cda1245688af29470a016297a 100755 (executable)
@@ -24,6 +24,8 @@
 #
 ##########################################################################/
 
+"""Parser for OpenGL .spec files in http://www.opengl.org/registry/."""
+
 
 import sys
 import re
@@ -230,11 +232,19 @@ class SpecParser(LineParser):
                 elif length == '1':
                     arg_type = 'Pointer(%s)' % base_type
                 elif length.find("COMPSIZE") == -1:
-                    arg_type = '%s(%s, "%s")' % (constructor, base_type, length)
+                    try:
+                        int(length)
+                    except ValueError:
+                        length = "%s" % length
+                    arg_type = '%s(%s, %s)' % (constructor, base_type, length)
                 else:
-                    length = length.replace("COMPSIZE", "__%s_size" % function_name)
-                    length = length.replace("/", ", ")
-                    arg_type = 'Opaque%s(%s, "%s")' % (constructor, base_type, length)
+                    if length == "COMPSIZE(pname)":
+                        length = "_gl_param_size(pname)"
+                        arg_type = '%s(%s, "%s")' % (constructor, base_type, length)
+                    else:
+                        length = length.replace("COMPSIZE", "_%s_size" % function_name)
+                        length = length.replace("/", ", ")
+                        arg_type = 'Opaque%s(%s, "%s")' % (constructor, base_type, length)
         else:
             assert False