glapi: use new-style Python classes.

An unfortunate quirk of Python 2 is that there are two types of
classes: "classic" classes (which are backward compatible with some
unfortunate design decisions made early in Python's history), and
"new-style" classes.  Classic classes have a number of limitations
(for example they don't support super()) and are unavailable in Python
3.  There's really no reason to use classic classes, except in
unmaintained legacy code.  For more information see
http://www.python.org/download/releases/2.2.3/descrintro/.

This patch upgrades the Python code in src/mapi/glapi/gen to use
exclusively new-style classes.

Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Paul Berry 2012-10-10 11:01:35 -07:00
parent 41954107c0
commit 7dc052b12b
4 changed files with 10 additions and 10 deletions

View file

@ -543,7 +543,7 @@ class glx_function(gl_XML.gl_function):
return not self.ignore and (self.offset != -1) and (self.glx_rop or self.glx_sop or self.glx_vendorpriv or self.vectorequiv or self.client_handcode)
class glx_function_iterator:
class glx_function_iterator(object):
"""Class to iterate over a list of glXFunctions"""
def __init__(self, context):

View file

@ -30,7 +30,7 @@ import license
import sys, getopt, copy, string
class glx_enum_function:
class glx_enum_function(object):
def __init__(self, func_name, enum_dict):
self.name = func_name
self.mode = 1

View file

@ -72,7 +72,7 @@ def is_attr_true( element, name ):
raise RuntimeError('Invalid value "%s" for boolean "%s".' % (value, name))
class gl_print_base:
class gl_print_base(object):
"""Base class of all API pretty-printers.
In the model-view-controller pattern, this is the view. Any derived
@ -322,7 +322,7 @@ def create_parameter_string(parameters, include_names):
return string.join(list, ", ")
class gl_item:
class gl_item(object):
def __init__(self, element, context):
self.context = context
self.name = element.nsProp( "name", None )
@ -401,7 +401,7 @@ class gl_enum( gl_item ):
class gl_parameter:
class gl_parameter(object):
def __init__(self, element, context):
self.name = element.nsProp( "name", None )
@ -780,7 +780,7 @@ class gl_function( gl_item ):
return "_dispatch_stub_%u" % (self.offset)
class gl_item_factory:
class gl_item_factory(object):
"""Factory to create objects derived from gl_item."""
def create_item(self, item_name, element, context):
@ -798,7 +798,7 @@ class gl_item_factory:
return None
class gl_api:
class gl_api(object):
def __init__(self, factory):
self.functions_by_name = {}
self.enums_by_name = {}

View file

@ -27,7 +27,7 @@
import string, copy
class type_node:
class type_node(object):
def __init__(self):
self.pointer = 0 # bool
self.const = 0 # bool
@ -65,7 +65,7 @@ class type_node:
return s
class type_table:
class type_table(object):
def __init__(self):
self.types_by_name = {}
return
@ -109,7 +109,7 @@ def create_initial_types():
return
class type_expression:
class type_expression(object):
built_in_types = None
def __init__(self, type_string, extra_types = None):