#
##########################################################################/
+"""Parser for OpenGL .spec files in http://www.opengl.org/registry/."""
+
import sys
import re
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