diff options
author | Ian Romanick <[email protected]> | 2006-10-04 20:45:59 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2006-10-04 20:45:59 +0000 |
commit | eaeaaf6205b304be290f2f869b3d224c318be749 (patch) | |
tree | 170e324479f9abc7e6f6aacc81b5203f64fa57b7 /src/mesa/glapi/glX_proto_send.py | |
parent | 553b8334bbe6b0af9496722f05cb8fc2e4d43a01 (diff) |
Divide categories into four groups as they are processed from the XML. Add
an iterator to iterate over the categories in order, starting with "core"
versions, then ARB extensions, then numbered non-ARB extensions, and finally
unnumbered extensions.
Use the new iterator in a couple places to ensure that output that is
grouped by catgory is generated in a consistent order.
More changes to the scripts are coming. The generated files will be
committed one time after all the changes are in. Too bad we're not using
GIT, or this would be easy. :(
Diffstat (limited to 'src/mesa/glapi/glX_proto_send.py')
-rw-r--r-- | src/mesa/glapi/glX_proto_send.py | 87 |
1 files changed, 9 insertions, 78 deletions
diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py index aaee2f605d8..f8153e4c2e2 100644 --- a/src/mesa/glapi/glX_proto_send.py +++ b/src/mesa/glapi/glX_proto_send.py @@ -884,87 +884,18 @@ __GLapi * __glXNewIndirectAPI( void ) return - def printCategory(self, category_group, show_num): - cat_keys = category_group.keys() - cat_keys.sort() - for cat_num in cat_keys: - first = 1 - for offset in category_group[ cat_num ]: - [cat_name, func_name] = category_group[ cat_num ][ offset ] - - if first: - print '' - if show_num: - print ' /* %3u. %s */' % (cat_num, cat_name) - else: - print ' /* %s */' % (cat_name) - print '' - first = 0 - - print ' glAPI->%s = __indirect_gl%s;' % (func_name, func_name) - - def printBody(self, api): - core_categories = {} - arb_categories = {} - other_categories = {} - next_unnum = 1000 - - for func in api.functionIterateGlx(): - [cat, num] = api.get_category_for_name( func.name ) - - # There are three groups of "categories" that we - # care about here. We want to separate the core GL - # version categories from extensions. We also want to - # separate the ARB extensions from the non-ARB - # extensions. - # - # This is done by first trying to convert the category - # name to a floating point number. All core GL - # versions are of the form "N.M" where both N and M - # are integers. If the cast to float fails, an - # exception will be thrown. Once down that path, - # we can look at the start of the extension string. - # If it begins with "GL_ARB_", it's an ARB extension. - # - # Once the categories are separated, the are ordered - # by number. The un-numbered non-ARB extensions - # (e.g., GL_INGR_blend_func_separate) are assigned - # arbitrary numbers starting at 1000. - # - # FIXME In order to maintain repeatability, the - # FIXME unnumbered extensions should be put in their - # FIXME own dictionary and ordered by name (since they - # FIXME have no number). - - try: - num = float(cat) - if not core_categories.has_key( num ): - core_categories[ num ] = {} - - core_categories[ num ][ func.offset ] = [cat, func.name] - - except Exception, e: - if not num: - num = next_unnum - next_unnum += 1 - else: - num = int(num) - - if cat.startswith( "GL_ARB_" ): - if not arb_categories.has_key( num ): - arb_categories[ num ] = {} - - arb_categories[ num ][ func.offset ] = [cat, func.name] - else: - if not other_categories.has_key( num ): - other_categories[ num ] = {} + for [name, number] in api.categoryIterate(): + if number != None: + preamble = '\n /* %3u. %s */\n\n' % (int(number), name) + else: + preamble = '\n /* %s */\n\n' % (name) - other_categories[ num ][ func.offset ] = [cat, func.name] + for func in api.functionIterateByCategory(name): + if func.client_supported_for_indirect(): + print '%s glAPI->%s = __indirect_gl%s;' % (preamble, func.name, func.name) + preamble = '' - self.printCategory( core_categories, 0 ) - self.printCategory( arb_categories, 1 ) - self.printCategory( other_categories, 1 ) return |