gl_XML.glEnum.__init__(self, context, name, attrs)
- def startElement(self, name, attrs):
- if name == "size":
+ def startElementNS(self, name, qname, attrs):
+ [uri, true_name] = name
+ if true_name == "size":
[temp_n, c, mode] = self.process_attributes(attrs)
if temp_n == "Get":
self.context.glx_enum_functions[ n ].append( c, self.value, self.name )
else:
- gl_XML.glEnum.startElement(self, context, name, attrs)
+ gl_XML.glEnum.startElementNS(self, name, qname, attrs)
return
can_be_large = 0
def __init__(self, context, name, attrs):
- self.vectorequiv = attrs.get('vectorequiv', None)
+ self.vectorequiv = attrs.get((None, 'vectorequiv'), None)
self.counter = None
self.output = None
self.can_be_large = 0
return glXParameterIterator(self.fn_parameters, skip_output, max_order)
- def startElement(self, name, attrs):
+ def startElementNS(self, name, qname, attrs):
"""Process elements within a function that are specific to GLX."""
- if name == "glx":
- self.glx_rop = int(attrs.get('rop', "0"))
- self.glx_sop = int(attrs.get('sop', "0"))
- self.glx_vendorpriv = int(attrs.get('vendorpriv', "0"))
- self.img_reset = attrs.get('img_reset', None)
+ [uri, true_name] = name
+ if true_name == "glx":
+ self.glx_rop = int(attrs.get((None, 'rop'), "0"))
+ self.glx_sop = int(attrs.get((None, 'sop'), "0"))
+ self.glx_vendorpriv = int(attrs.get((None, 'vendorpriv'), "0"))
+ self.img_reset = attrs.get((None, 'img_reset'), None)
# The 'handcode' attribute can be one of 'true',
# 'false', 'client', or 'server'.
- handcode = attrs.get('handcode', "false")
+ handcode = attrs.get((None, 'handcode'), "false")
if handcode == "false":
self.server_handcode = 0
self.client_handcode = 0
self.reply_always_array = gl_XML.is_attr_true( attrs, 'always_array' )
self.dimensions_in_reply = gl_XML.is_attr_true( attrs, 'dimensions_in_reply' )
else:
- gl_XML.glFunction.startElement(self, name, attrs)
+ gl_XML.glFunction.startElementNS(self, name, qname, attrs)
- def endElement(self, name):
- if name == "function":
+ def endElementNS(self, name, qname):
+ [uri, true_name] = name
+ if true_name == "function":
# Mark any function that does not have GLX protocol
# defined as "ignore". This prevents bad things from
# happening when people add new functions to the GL
self.ignore = 1
- return gl_XML.glFunction.endElement(self, name)
+ return gl_XML.glFunction.endElementNS(self, name, qname)
def append(self, tag_name, p):
self.glx_enum_functions = {}
- def endElement(self, name):
- if name == 'OpenGLAPI':
+ def endElementNS(self, name, qname):
+ [uri, true_name] = name
+ if true_name == 'OpenGLAPI':
# Once all the parsing is done, we have to go back and
# fix-up some cross references between different
# functions.
else:
raise RuntimeError("Could not find the vector equiv. function %s for %s!" % (f.name, f.vectorequiv))
else:
- gl_XML.FilterGLAPISpecBase.endElement(self, name)
+ gl_XML.FilterGLAPISpecBase.endElementNS(self, name, qname)
return
value is 'true', non-zero will be returned. An exception will be
raised for any other value."""
- value = attrs.get(name, "false")
+ value = attrs.get((None, name), "false")
if value == "true":
return 1
elif value == "false":
context.append(tag_name, self)
return
- def startElement(self, name, attrs):
+ def startElementNS(self, name, qname, attrs):
"""Generic startElement handler.
The startElement handler is called for all elements except
twice."""
return
- def endElement(self, name):
+ def endElementNS(self, name, qname):
"""Generic endElement handler.
Generic endElement handler. Returns 1 if the tag containing
associated with an object, even the element that started the
object. See the description of startElement an example."""
- if name == self.tag_name:
+ if name == (None, self.tag_name):
return 1
else:
return 0
This class is not complete, and is not really used yet."""
def __init__(self, context, name, attrs):
- self.value = int(attrs.get('value', "0x0000"), 0)
+ self.value = int(attrs.get((None, 'value'), "0x0000"), 0)
- enum_name = "GL_" + attrs.get('name', None)
+ enum_name = "GL_" + attrs.get((None, 'name'), None)
glItem.__init__(self, name, enum_name, context)
- temp = attrs.get('count', None)
+ temp = attrs.get((None, 'count'), None)
self.default_count = 0
if temp == "?":
self.default_count = -1
def process_attributes(self, attrs):
- name = attrs.get('name', None)
+ name = attrs.get((None, 'name'), None)
- temp = attrs.get('count', None)
+ temp = attrs.get((None, 'count'), None)
if temp == None:
c = self.default_count
else:
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")
+ mode_str = attrs.get((None, 'mode'), "set")
if mode_str == "set":
mode = 1
elif mode_str == "get":
"""Subclass of glItem for representing GL types."""
def __init__(self, context, name, attrs):
- self.size = int(attrs.get('size', "0"))
- self.glx_name = attrs.get('glx_name', "")
+ self.size = int(attrs.get((None, 'size'), "0"))
+ self.glx_name = attrs.get((None, 'glx_name'), "")
- type_name = "GL" + attrs.get('name', None)
+ type_name = "GL" + attrs.get((None, 'name'), None)
glItem.__init__(self, name, type_name, context)
is_pointer = 0
def __init__(self, context, name, attrs):
- p_name = attrs.get('name', None)
- self.p_type_string = attrs.get('type', None)
+ p_name = attrs.get((None, 'name'), None)
+ self.p_type_string = attrs.get((None, 'type'), None)
- temp = attrs.get('variable_param', None)
+ temp = attrs.get((None, 'variable_param'), None)
if temp:
self.count_parameter_list = temp.split( ' ' )
else:
# statement will throw an exception, and the except block will
# take over.
- c = attrs.get('count', "0")
+ c = attrs.get((None, 'count'), "0")
try:
self.p_count = int(c)
self.counter = None
self.p_count = 0
self.counter = c
- self.count_scale = int(attrs.get('count_scale', "1"))
-
+ self.count_scale = int(attrs.get((None, 'count_scale'), "1"))
+
self.is_counter = is_attr_true( attrs, 'counter' )
self.is_output = is_attr_true( attrs, 'output' )
# Pixel data has special parameters.
- self.width = attrs.get('img_width', None)
- self.height = attrs.get('img_height', None)
- self.depth = attrs.get('img_depth', None)
- self.extent = attrs.get('img_extent', None)
+ self.width = attrs.get((None, 'img_width'), None)
+ self.height = attrs.get((None, 'img_height'), None)
+ self.depth = attrs.get((None, 'img_depth'), None)
+ self.extent = attrs.get((None, 'img_extent'), None)
- self.img_xoff = attrs.get('img_xoff', None)
- self.img_yoff = attrs.get('img_yoff', None)
- self.img_zoff = attrs.get('img_zoff', None)
- self.img_woff = attrs.get('img_woff', None)
+ self.img_xoff = attrs.get((None, 'img_xoff'), None)
+ self.img_yoff = attrs.get((None, 'img_yoff'), None)
+ self.img_zoff = attrs.get((None, 'img_zoff'), None)
+ self.img_woff = attrs.get((None, 'img_woff'), None)
- self.img_format = attrs.get('img_format', None)
- self.img_type = attrs.get('img_type', None)
- self.img_target = attrs.get('img_target', None)
+ self.img_format = attrs.get((None, 'img_format'), None)
+ self.img_type = attrs.get((None, 'img_type'), None)
+ self.img_target = attrs.get((None, 'img_target'), None)
self.img_pad_dimensions = is_attr_true( attrs, 'img_pad_dimensions' )
self.img_null_flag = is_attr_true( attrs, 'img_null_flag' )
class glFunction( glItem ):
def __init__(self, context, name, attrs):
- self.fn_alias = attrs.get('alias', None)
+ self.fn_alias = attrs.get((None, 'alias'), None)
self.fn_parameters = []
self.image = None
self.count_parameter_list = []
self.fn_return_type = "void"
- temp = attrs.get('offset', None)
+ temp = attrs.get((None, 'offset'), None)
if temp == None or temp == "?":
self.fn_offset = -1
else:
self.fn_offset = int(temp)
- fn_name = attrs.get('name', None)
+ fn_name = attrs.get((None, 'name'), None)
if self.fn_alias != None:
self.real_name = self.fn_alias
else:
return glParameterIterator(self.fn_parameters)
- def startElement(self, name, attrs):
- if name == "param":
+ def startElementNS(self, name, qname, attrs):
+ [uri, true_name] = name
+ if true_name == "param":
try:
- self.context.factory.create(self, name, attrs)
+ self.context.factory.create(self, true_name, attrs)
except RuntimeError:
print "Error with parameter '%s' in function '%s'." \
- % (attrs.get('name','(unknown)'), self.name)
+ % (attrs.get((None, 'name'),'(unknown)'), self.name)
raise
- elif name == "return":
- self.set_return_type(attrs.get('type', None))
+ elif true_name == "return":
+ self.set_return_type(attrs.get((None, 'type'), None))
- def endElement(self, name):
+ def endElementNS(self, name, qname):
"""Handle the end of a <function> element.
At the end of a <function> element, there is some semantic
exceptions from being thrown elsewhere in the code.
"""
- if name == "function":
+ [uri, true_name] = name
+ if true_name == "function":
for p in self.variable_length_parameters:
if p.counter:
counter = self.parameters_by_name[ p.counter ]
# offset, then we do not need to track it. These are
# functions that don't have an assigned offset
- if obj.fn_offset >= 0 or obj.fn_alias != None:
- if obj.fn_offset >= 0:
- index = obj.fn_offset
- else:
- index = self.next_alias
- self.next_alias -= 1
+ if not self.functions_by_name.has_key(obj.name):
+ self.functions_by_name[obj.name] = obj
- self.functions[index] = obj
+ if obj.fn_offset >= 0 or obj.fn_alias != None:
+ if obj.fn_offset >= 0:
+ index = obj.fn_offset
+ else:
+ index = self.next_alias
+ self.next_alias -= 1
- self.functions_by_name[obj.name] = obj
+ self.functions[index] = obj
+ else:
+ # We should do some checking here to make
+ # sure the functions are an identical match.
+ pass
elif object_type == "type":
self.types[obj.name] = obj
return
- def startElement(self, name, attrs):
+ def startElementNS(self, name, qname, attrs):
"""Start a new element in the XML stream.
Starts a new element. There are three types of elements that
additional XML data, GLX protocol information, that the base
classes do not know about."""
- if self.current_object != None:
- self.current_object.startElement(name, attrs)
- elif name == "category":
- self.current_category = attrs.get('name', "")
- elif name == "include":
- self.next_include = attrs.get('name', "")
- else:
- self.current_object = self.factory.create(self, name, attrs)
+ [uri, true_name] = name
+ if uri is None:
+ if self.current_object != None:
+ self.current_object.startElementNS(name, qname, attrs)
+ elif true_name == "category":
+ self.current_category = attrs.get((None, 'name'), "")
+ elif true_name == "include":
+ self.next_include = attrs.get((None, 'name'), "")
+ else:
+ self.current_object = self.factory.create(self, true_name, attrs)
return
- def endElement(self, name):
+ def endElementNS(self, name, qname):
if self.current_object != None:
- if self.current_object.endElement(name):
+ if self.current_object.endElementNS(name, qname):
self.current_object = None
elif name == "include":
parser = make_parser()
- parser.setFeature(feature_namespaces, 0)
+ parser.setFeature(feature_namespaces, 1)
parser.setContentHandler(self)
f = open(self.next_include)