diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/glapi/glX_XML.py | 40 | ||||
-rw-r--r-- | src/mesa/glapi/glX_doc.py | 2 | ||||
-rw-r--r-- | src/mesa/glapi/glX_proto_send.py | 2 | ||||
-rw-r--r-- | src/mesa/glapi/glX_proto_size.py | 9 | ||||
-rw-r--r-- | src/mesa/glapi/gl_SPARC_asm.py | 2 | ||||
-rw-r--r-- | src/mesa/glapi/gl_XML.py | 131 | ||||
-rw-r--r-- | src/mesa/glapi/gl_apitemp.py | 2 | ||||
-rw-r--r-- | src/mesa/glapi/gl_enums.py | 2 | ||||
-rw-r--r-- | src/mesa/glapi/gl_offsets.py | 2 | ||||
-rw-r--r-- | src/mesa/glapi/gl_procs.py | 2 | ||||
-rw-r--r-- | src/mesa/glapi/gl_table.py | 2 | ||||
-rw-r--r-- | src/mesa/glapi/gl_x86_asm.py | 2 |
12 files changed, 106 insertions, 92 deletions
diff --git a/src/mesa/glapi/glX_XML.py b/src/mesa/glapi/glX_XML.py index e48955e34e..81c94a5223 100644 --- a/src/mesa/glapi/glX_XML.py +++ b/src/mesa/glapi/glX_XML.py @@ -230,8 +230,9 @@ class glXEnum(gl_XML.glEnum): 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": @@ -247,7 +248,7 @@ class glXEnum(gl_XML.glEnum): 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 @@ -311,7 +312,7 @@ class glXFunction(gl_XML.glFunction): 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 @@ -331,19 +332,20 @@ class glXFunction(gl_XML.glFunction): 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 @@ -365,11 +367,12 @@ class glXFunction(gl_XML.glFunction): 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 @@ -387,7 +390,7 @@ class glXFunction(gl_XML.glFunction): self.ignore = 1 - return gl_XML.glFunction.endElement(self, name) + return gl_XML.glFunction.endElementNS(self, name, qname) def append(self, tag_name, p): @@ -664,8 +667,9 @@ class GlxProto(gl_XML.FilterGLAPISpecBase): 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. @@ -680,7 +684,7 @@ class GlxProto(gl_XML.FilterGLAPISpecBase): 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 diff --git a/src/mesa/glapi/glX_doc.py b/src/mesa/glapi/glX_doc.py index dd96a59f55..ea90d53f71 100644 --- a/src/mesa/glapi/glX_doc.py +++ b/src/mesa/glapi/glX_doc.py @@ -268,7 +268,7 @@ if __name__ == '__main__': dh = PrintGlxProtoText() parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py index 7c31b873e2..d78e07ee5e 100644 --- a/src/mesa/glapi/glX_proto_send.py +++ b/src/mesa/glapi/glX_proto_send.py @@ -890,7 +890,7 @@ if __name__ == '__main__': show_usage() parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) diff --git a/src/mesa/glapi/glX_proto_size.py b/src/mesa/glapi/glX_proto_size.py index cc28b8951c..5049545222 100644 --- a/src/mesa/glapi/glX_proto_size.py +++ b/src/mesa/glapi/glX_proto_size.py @@ -246,8 +246,9 @@ class PrintGlxReqSize_common(glX_XML.GlxProto): self.size_functions = [] - def endElement(self, name): - if name == "function": + def endElementNS(self, name, qname): + [uri, true_name] = name + if true_name == "function": f = self.current_object if f.glx_rop and not f.ignore and f.fn_alias == None and f.vectorequiv == None: @@ -259,7 +260,7 @@ class PrintGlxReqSize_common(glX_XML.GlxProto): self.size_functions.append( f ) break - glX_XML.GlxProto.endElement(self, name) + glX_XML.GlxProto.endElementNS(self, name, qname) def functionIterator(self): @@ -533,7 +534,7 @@ if __name__ == '__main__': show_usage() parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) diff --git a/src/mesa/glapi/gl_SPARC_asm.py b/src/mesa/glapi/gl_SPARC_asm.py index c4afc4e52a..2623e1beea 100644 --- a/src/mesa/glapi/gl_SPARC_asm.py +++ b/src/mesa/glapi/gl_SPARC_asm.py @@ -124,7 +124,7 @@ if __name__ == '__main__': show_usage() parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py index bb6ec2b54a..38ccc53465 100644 --- a/src/mesa/glapi/gl_XML.py +++ b/src/mesa/glapi/gl_XML.py @@ -39,7 +39,7 @@ def is_attr_true( attrs, name ): 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": @@ -60,7 +60,7 @@ class glItem: 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 @@ -70,7 +70,7 @@ class glItem: twice.""" return - def endElement(self, name): + def endElementNS(self, name, qname): """Generic endElement handler. Generic endElement handler. Returns 1 if the tag containing @@ -87,7 +87,7 @@ class glItem: 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 @@ -102,12 +102,12 @@ class glEnum( glItem ): 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 @@ -122,9 +122,9 @@ class glEnum( glItem ): 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: @@ -133,7 +133,7 @@ class glEnum( glItem ): 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": @@ -148,10 +148,10 @@ class glType( glItem ): """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) @@ -166,10 +166,10 @@ class glParameter( glItem ): 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: @@ -185,7 +185,7 @@ class glParameter( glItem ): # 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 @@ -193,27 +193,27 @@ class glParameter( glItem ): 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' ) @@ -351,19 +351,19 @@ class glParameterIterator: 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: @@ -380,19 +380,20 @@ class glFunction( glItem ): 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 @@ -400,7 +401,8 @@ class glFunction( glItem ): 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 ] @@ -607,16 +609,21 @@ class FilterGLAPISpecBase(saxutils.XMLFilterBase): # 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 @@ -624,7 +631,7 @@ class FilterGLAPISpecBase(saxutils.XMLFilterBase): 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 @@ -640,24 +647,26 @@ class FilterGLAPISpecBase(saxutils.XMLFilterBase): 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) diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py index d89440acbf..4c4bcd40ff 100644 --- a/src/mesa/glapi/gl_apitemp.py +++ b/src/mesa/glapi/gl_apitemp.py @@ -218,7 +218,7 @@ if __name__ == '__main__': dh = PrintGlOffsets() parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) diff --git a/src/mesa/glapi/gl_enums.py b/src/mesa/glapi/gl_enums.py index 2237b7d148..177c95f6ed 100644 --- a/src/mesa/glapi/gl_enums.py +++ b/src/mesa/glapi/gl_enums.py @@ -237,7 +237,7 @@ if __name__ == '__main__': dh = PrintGlEnums() parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) diff --git a/src/mesa/glapi/gl_offsets.py b/src/mesa/glapi/gl_offsets.py index f5bd7f40ed..95657b80e0 100644 --- a/src/mesa/glapi/gl_offsets.py +++ b/src/mesa/glapi/gl_offsets.py @@ -67,7 +67,7 @@ if __name__ == '__main__': dh = PrintGlOffsets() parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) diff --git a/src/mesa/glapi/gl_procs.py b/src/mesa/glapi/gl_procs.py index a9fdd1812c..b5d51b0b40 100644 --- a/src/mesa/glapi/gl_procs.py +++ b/src/mesa/glapi/gl_procs.py @@ -149,7 +149,7 @@ if __name__ == '__main__': dh = PrintGlProcs( long_string ) parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py index 49a8af7da4..30dcd4149f 100644 --- a/src/mesa/glapi/gl_table.py +++ b/src/mesa/glapi/gl_table.py @@ -84,7 +84,7 @@ if __name__ == '__main__': dh = PrintGlTable() parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) diff --git a/src/mesa/glapi/gl_x86_asm.py b/src/mesa/glapi/gl_x86_asm.py index 442069b362..02dafa5c62 100644 --- a/src/mesa/glapi/gl_x86_asm.py +++ b/src/mesa/glapi/gl_x86_asm.py @@ -248,7 +248,7 @@ if __name__ == '__main__': show_usage() parser = make_parser() - parser.setFeature(feature_namespaces, 0) + parser.setFeature(feature_namespaces, 1) parser.setContentHandler(dh) f = open(file_name) |