diff options
author | Ian Romanick <[email protected]> | 2005-01-25 01:20:11 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2005-01-25 01:20:11 +0000 |
commit | 85f0fa3761f8673ef48e46e0670ac816a34f000a (patch) | |
tree | 4d52a0ca758fa4ef9b0663d0a04f03282f5c66ee /src/mesa/glapi/gl_XML.py | |
parent | cb59bd44dbf0e56058dbb4595ca7fbbbacbd3670 (diff) |
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.
Diffstat (limited to 'src/mesa/glapi/gl_XML.py')
-rw-r--r-- | src/mesa/glapi/gl_XML.py | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py index bc7d27befe3..61c9b355cf2 100644 --- a/src/mesa/glapi/gl_XML.py +++ b/src/mesa/glapi/gl_XML.py @@ -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)) + + 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] + return [name, c, mode] class glType( glItem ): |