]> git.cworth.org Git - apitrace/blobdiff - specs/scripts/glspec.py
Specify constant array lengths as integers.
[apitrace] / specs / scripts / glspec.py
index dbd20ce6b65bc78676882eef4ed52f9cf1845fec..ab5957a7d19d4dba78d849cfd366743503cf295d 100755 (executable)
@@ -24,6 +24,8 @@
 #
 ##########################################################################/
 
+"""Parser for OpenGL .spec files in http://www.opengl.org/registry/."""
+
 
 import sys
 import re
@@ -230,11 +232,15 @@ 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)
+                    arg_type = 'Opaque%s(%s, %s)' % (constructor, base_type, length)
         else:
             assert False