Add a "count" attribute to "enums" elements to set the default count

used for "size" sub-elements.  In the future the "count" attribute may
be removed completely from "size" sub-elements, so gl_API.xml was also
updated.

Support was added for a (currently unused) "mode" attribute for "size"
elements.  Basically, functions are marked as either "get" or "set".  This
will be used in generating size functions for the server-side (where the
"get" functions have to know how much data to return).  It could also be
used to help generate code for src/mesa/main/get.c.
This commit is contained in:
Ian Romanick 2005-01-25 01:20:11 +00:00
parent cb59bd44db
commit 85f0fa3761
3 changed files with 478 additions and 455 deletions

View file

@ -244,7 +244,7 @@ class glXEnum(gl_XML.glEnum):
def startElement(self, name, attrs):
if name == "size":
[n, c] = self.process_attributes(attrs)
[n, c, mode] = self.process_attributes(attrs)
if not self.context.glx_enum_functions.has_key( n ):
f = glXEnumFunction( n )

File diff suppressed because it is too large Load diff

View file

@ -90,17 +90,40 @@ class glEnum( glItem ):
enum_name = "GL_" + attrs.get('name', None)
glItem.__init__(self, name, enum_name, context)
temp = attrs.get('count', None)
if temp == None:
self.default_count = 0
else:
try:
c = int(temp)
except Exception,e:
raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp, self.name, n))
self.default_count = c
return
def process_attributes(self, attrs):
name = attrs.get('name', None)
temp = attrs.get('count', None)
try:
c = int(temp)
except Exception,e:
raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp, self.name, n))
if temp == None:
c = self.default_count
else:
try:
c = int(temp)
except Exception,e:
raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp, self.name, n))
return [name, c]
mode_str = attrs.get('mode', "set")
if mode_str == "set":
mode = 1
elif mode_str == "get":
mode = 0
else:
raise RuntimeError("Invalid mode '%s' for function '%s' in enum '%s'." % (mode_str, self.context.name, self.name))
return [name, c, mode]
class glType( glItem ):