[Mesa-dev] [PATCH 06/41] glapi: normalize python newlines
Dylan Baker
baker.dylan.c at gmail.com
Fri Apr 1 00:04:23 UTC 2016
The python code has no standardization on how many newlines to put
anywere. Sometimes top level items have one space between them, sometimes
two, and sometimes three. Sometiems methods and other sub items had two,
sometimes one, sometimes 3.
This patches uses PEP8 styling (2 lines between top level functions and
classes, 1 between methods and nested functions), This doesn't result in
huge changes in any one file, but when considering all of the python
files it's quite a few changes.
This is only whitespace changes.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
src/mapi/glapi/gen/glX_XML.py | 33 ---------------------
src/mapi/glapi/gen/glX_proto_common.py | 1 -
src/mapi/glapi/gen/glX_proto_recv.py | 29 ------------------
src/mapi/glapi/gen/glX_proto_send.py | 36 +----------------------
src/mapi/glapi/gen/glX_proto_size.py | 30 -------------------
src/mapi/glapi/gen/glX_server_table.py | 14 ---------
src/mapi/glapi/gen/gl_SPARC_asm.py | 2 +-
src/mapi/glapi/gen/gl_XML.py | 54 ----------------------------------
src/mapi/glapi/gen/gl_apitemp.py | 7 +----
src/mapi/glapi/gen/gl_enums.py | 5 +---
src/mapi/glapi/gen/gl_genexec.py | 3 --
src/mapi/glapi/gen/gl_gentable.py | 5 ----
src/mapi/glapi/gen/gl_procs.py | 2 --
src/mapi/glapi/gen/gl_table.py | 2 --
src/mapi/glapi/gen/gl_x86-64_asm.py | 9 +-----
src/mapi/glapi/gen/gl_x86_asm.py | 8 ++---
src/mapi/glapi/gen/remap_helper.py | 2 --
src/mapi/glapi/gen/typeexpr.py | 16 ----------
18 files changed, 7 insertions(+), 251 deletions(-)
diff --git a/src/mapi/glapi/gen/glX_XML.py b/src/mapi/glapi/gen/glX_XML.py
index a49f310..f1f7087 100644
--- a/src/mapi/glapi/gen/glX_XML.py
+++ b/src/mapi/glapi/gen/glX_XML.py
@@ -32,7 +32,6 @@ import license
class glx_item_factory(gl_XML.gl_item_factory):
"""Factory to create GLX protocol oriented objects derived from gl_item."""
-
def create_function(self, element, context):
return glx_function(element, context)
@@ -107,7 +106,6 @@ class glx_function(gl_XML.gl_function):
gl_XML.gl_function.__init__(self, element, context)
return
-
def process_element(self, element):
gl_XML.gl_function.process_element(self, element)
@@ -118,7 +116,6 @@ class glx_function(gl_XML.gl_function):
if not self.vectorequiv:
self.vectorequiv = element.get("vectorequiv")
-
name = element.get("name")
if name == self.name:
for param in self.parameters:
@@ -130,7 +127,6 @@ class glx_function(gl_XML.gl_function):
if param.counter and param.counter not in self.counter_list:
self.counter_list.append(param.counter)
-
for child in element.getchildren():
if child.tag == "glx":
rop = child.get( 'rop' )
@@ -174,7 +170,6 @@ class glx_function(gl_XML.gl_function):
self.reply_always_array = gl_XML.is_attr_true( child, 'always_array' )
self.dimensions_in_reply = gl_XML.is_attr_true( child, 'dimensions_in_reply' )
-
# Do some validation of the GLX protocol information. As
# new tests are discovered, they should be added here.
@@ -184,7 +179,6 @@ class glx_function(gl_XML.gl_function):
return
-
def has_variable_size_request(self):
"""Determine if the GLX request packet is variable sized.
@@ -218,7 +212,6 @@ class glx_function(gl_XML.gl_function):
return 0
-
def variable_length_parameter(self):
for param in self.parameters:
if not param.is_output:
@@ -227,7 +220,6 @@ class glx_function(gl_XML.gl_function):
return None
-
def calculate_offsets(self):
if not self.offsets_calculated:
# Calculate the offset of the first function parameter
@@ -265,16 +257,13 @@ class glx_function(gl_XML.gl_function):
if self.pad_after( param ):
offset += 4
-
self.offsets_calculated = 1
return
-
def offset_of(self, param_name):
self.calculate_offsets()
return self.parameters_by_name[ param_name ].offset
-
def parameterIterateGlxSend(self, include_variable_parameters = 1):
"""Create an iterator for parameters in GLX request order."""
@@ -299,7 +288,6 @@ class glx_function(gl_XML.gl_function):
parameters.extend( temp[2] )
return parameters.__iter__()
-
def parameterIterateCounters(self):
temp = []
for name in self.counter_list:
@@ -307,7 +295,6 @@ class glx_function(gl_XML.gl_function):
return temp.__iter__()
-
def parameterIterateOutputs(self):
temp = []
for p in self.parameters:
@@ -316,7 +303,6 @@ class glx_function(gl_XML.gl_function):
return temp
-
def command_fixed_length(self):
"""Return the length, in bytes as an integer, of the
fixed-size portion of the command."""
@@ -343,7 +329,6 @@ class glx_function(gl_XML.gl_function):
return size
-
def command_variable_length(self):
"""Return the length, as a string, of the variable-sized
portion of the command."""
@@ -361,7 +346,6 @@ class glx_function(gl_XML.gl_function):
return size_string
-
def command_length(self):
size = self.command_fixed_length()
@@ -371,7 +355,6 @@ class glx_function(gl_XML.gl_function):
size = ((size + 3) & ~3)
return "%u%s" % (size, self.command_variable_length())
-
def opcode_real_value(self):
"""Get the true numeric value of the GLX opcode
@@ -391,7 +374,6 @@ class glx_function(gl_XML.gl_function):
else:
return self.opcode_value()
-
def opcode_value(self):
"""Get the unique protocol opcode for the glXFunction"""
@@ -399,7 +381,6 @@ class glx_function(gl_XML.gl_function):
equiv = self.context.functions_by_name[ self.vectorequiv ]
self.glx_rop = equiv.glx_rop
-
if self.glx_rop != 0:
return self.glx_rop
elif self.glx_sop != 0:
@@ -409,7 +390,6 @@ class glx_function(gl_XML.gl_function):
else:
return -1
-
def opcode_rop_basename(self):
"""Return either the name to be used for GLX protocol enum.
@@ -422,7 +402,6 @@ class glx_function(gl_XML.gl_function):
else:
return self.vectorequiv
-
def opcode_name(self):
"""Get the unique protocol enum name for the glXFunction"""
@@ -431,7 +410,6 @@ class glx_function(gl_XML.gl_function):
self.glx_rop = equiv.glx_rop
self.glx_doubles_in_order = equiv.glx_doubles_in_order
-
if self.glx_rop != 0:
return "X_GLrop_%s" % (self.opcode_rop_basename())
elif self.glx_sop != 0:
@@ -441,14 +419,12 @@ class glx_function(gl_XML.gl_function):
else:
raise RuntimeError('Function "%s" has no opcode.' % (self.name))
-
def opcode_vendor_name(self, name):
if name in self.glx_vendorpriv_names:
return "X_GLvop_%s" % (name)
else:
raise RuntimeError('Function "%s" has no VendorPrivate opcode.' % (name))
-
def opcode_real_name(self):
"""Get the true protocol enum name for the GLX opcode
@@ -467,7 +443,6 @@ class glx_function(gl_XML.gl_function):
else:
return self.opcode_name()
-
def needs_reply(self):
try:
x = self._needs_reply
@@ -485,7 +460,6 @@ class glx_function(gl_XML.gl_function):
return x
-
def pad_after(self, p):
"""Returns the name of the field inserted after the
specified field to pad out the command header."""
@@ -506,7 +480,6 @@ class glx_function(gl_XML.gl_function):
return None
-
def has_different_protocol(self, name):
"""Returns true if the named version of the function uses different protocol from the other versions.
@@ -519,7 +492,6 @@ class glx_function(gl_XML.gl_function):
return (name in self.glx_vendorpriv_names) and self.glx_sop
-
def static_glx_name(self, name):
if self.has_different_protocol(name):
for n in self.glx_vendorpriv_names:
@@ -528,7 +500,6 @@ class glx_function(gl_XML.gl_function):
return self.static_name(name)
-
def client_supported_for_indirect(self):
"""Returns true if the function is supported on the client
side for indirect rendering."""
@@ -538,16 +509,13 @@ class glx_function(gl_XML.gl_function):
class glx_function_iterator(object):
"""Class to iterate over a list of glXFunctions"""
-
def __init__(self, context):
self.iterator = context.functionIterateByOffset()
return
-
def __iter__(self):
return self
-
def next(self):
f = self.iterator.next()
@@ -560,4 +528,3 @@ class glx_function_iterator(object):
class glx_api(gl_XML.gl_api):
def functionIterateGlx(self):
return glx_function_iterator(self)
-
diff --git a/src/mapi/glapi/gen/glX_proto_common.py b/src/mapi/glapi/gen/glX_proto_common.py
index 3d07188..0510249 100644
--- a/src/mapi/glapi/gen/glX_proto_common.py
+++ b/src/mapi/glapi/gen/glX_proto_common.py
@@ -34,7 +34,6 @@ import glX_XML
class glx_proto_item_factory(glX_XML.glx_item_factory):
"""Factory to create GLX protocol oriented objects derived from gl_item."""
-
def create_type(self, element, context, category):
return glx_proto_type(element, context, category)
diff --git a/src/mapi/glapi/gen/glX_proto_recv.py b/src/mapi/glapi/gen/glX_proto_recv.py
index dc26d37..344eb09 100644
--- a/src/mapi/glapi/gen/glX_proto_recv.py
+++ b/src/mapi/glapi/gen/glX_proto_recv.py
@@ -44,7 +44,6 @@ class PrintGlxDispatch_h(gl_XML.gl_print_base):
self.header_tag = "_INDIRECT_DISPATCH_H_"
return
-
def printRealHeader(self):
print '# include <X11/Xfuncproto.h>'
print ''
@@ -52,7 +51,6 @@ class PrintGlxDispatch_h(gl_XML.gl_print_base):
print ''
return
-
def printBody(self, api):
for func in api.functionIterateAll():
if not func.ignore and not func.vectorequiv:
@@ -81,7 +79,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
self.do_swap = do_swap
return
-
def printRealHeader(self):
print '#include <inttypes.h>'
print '#include "glxserver.h"'
@@ -105,19 +102,16 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print ''
return
-
def printBody(self, api):
if self.do_swap:
self.emit_swap_wrappers(api)
-
for func in api.functionIterateByOffset():
if not func.ignore and not func.server_handcode and not func.vectorequiv and (func.glx_rop or func.glx_sop or func.glx_vendorpriv):
self.printFunction(func, func.name)
if func.glx_sop and func.glx_vendorpriv:
self.printFunction(func, func.glx_vendorpriv_names[0])
-
return
def fptrType(self, name):
@@ -155,11 +149,9 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print ''
return
-
def swap_name(self, bytes):
return 'bswap_%u_array' % (8 * bytes)
-
def emit_swap_wrappers(self, api):
self.type_map = {}
already_done = [ ]
@@ -201,7 +193,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print '}'
print ''
-
def fetch_param(self, param):
t = param.type_string()
o = param.offset
@@ -224,7 +215,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
return None
-
def emit_function_call(self, f, retval_assign, indent):
list = []
prefix = "gl" if f.is_abi() else ""
@@ -242,12 +232,10 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print '%s %s%s%s(%s);' % (indent, retval_assign, prefix, f.name, string.join(list, ',\n'))
-
def common_func_print_just_start(self, f, indent):
align64 = 0
need_blank = 0
-
f.calculate_offsets()
for param in f.parameterIterateGlxSend():
# If any parameter has a 64-bit base type, then we
@@ -256,7 +244,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
if param.is_64_bit():
align64 = 1
-
# FIXME img_null_flag is over-loaded. In addition to
# FIXME being used for images, it is used to signify
# FIXME NULL data pointers for vertex buffer object
@@ -269,7 +256,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
else:
cond = ""
-
type_string = param.type_string()
if param.is_image():
@@ -295,8 +281,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print '%s %s %s;' % (indent, type_string, param.name)
need_blank = 1
-
-
if need_blank:
print ''
@@ -316,7 +300,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print '#endif'
print ''
-
need_blank = 0
if self.do_swap:
for param in f.parameterIterateGlxSend():
@@ -365,14 +348,11 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print '%s %s = (%s) (pc + %s);' % (indent, param.name, param.type_string(), param.offset)
need_blank = 1
-
if need_blank:
print ''
-
return
-
def printSingleFunction(self, f, name):
if name not in f.glx_vendorpriv_names:
print ' xGLXSingleReq * const req = (xGLXSingleReq *) pc;'
@@ -395,7 +375,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print ' if ( cx != NULL ) {'
self.common_func_print_just_start(f, " ")
-
if f.return_type != 'void':
print ' %s retval;' % (f.return_type)
retval_string = "retval"
@@ -404,7 +383,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
retval_string = "0"
retval_assign = ""
-
type_size = 0
answer_string = "dummy_answer"
answer_count = "0"
@@ -415,7 +393,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
if answer_type == "GLvoid":
answer_type = "GLubyte"
-
c = param.get_element_count()
type_size = (param.size() / c)
if type_size == 1:
@@ -423,7 +400,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
else:
size_scale = " * %u" % (type_size)
-
if param.count_parameter_list:
print ' const GLuint compsize = %s;' % (self.size_call(f, 1))
print ' %s answerBuffer[200];' % (answer_type)
@@ -452,10 +428,8 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
if f.reply_always_array:
is_array_string = "GL_TRUE"
-
self.emit_function_call(f, retval_assign, " ")
-
if f.needs_reply():
if self.do_swap:
for param in f.parameterIterateOutputs():
@@ -466,7 +440,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
swap_name = self.swap_name( type_size )
print ' (void) %s( (uint%u_t *) %s, %s );' % (swap_name, 8 * type_size, param.name, answer_count)
-
reply_func = '__glXSendReplySwap'
else:
reply_func = '__glXSendReply'
@@ -481,7 +454,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print ' return error;'
return
-
def printRenderFunction(self, f):
# There are 4 distinct phases in a rendering dispatch function.
# In the first phase we compute the sizes and offsets of each
@@ -521,7 +493,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
print ' glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) %shdr->alignment%s);' % (pre, post)
print ''
-
self.emit_function_call(f, "", "")
return
diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
index 9142166..d83d519 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -54,13 +54,13 @@ def convertStringForXCB(str):
i += 1
return tmp
+
def hash_pixel_function(func):
"""Generate a 'unique' key for a pixel function. The key is based on
the parameters written in the command packet. This includes any
padding that might be added for the original function and the 'NULL
image' flag."""
-
h = ""
hash_pre = ""
hash_suf = ""
@@ -79,7 +79,6 @@ def hash_pixel_function(func):
if func.pad_after(param):
h += "4"
-
n = func.name.replace("%uD" % (dim), "")
n = "__glx_%s_%uD%uD" % (n, d - 1, d)
@@ -108,7 +107,6 @@ class glx_pixel_function_stub(glX_XML.glx_function):
self.parameters.append(p)
self.parameters_by_name[ p.name ] = p
-
if p.is_image():
self.images.append(p)
p.height = "height"
@@ -123,7 +121,6 @@ class glx_pixel_function_stub(glX_XML.glx_function):
if p.img_woff == None:
p.img_woff = "woffset"
-
pad_name = func.pad_after(p)
if pad_name:
pad = copy.copy(p)
@@ -131,7 +128,6 @@ class glx_pixel_function_stub(glX_XML.glx_function):
self.parameters.append(pad)
self.parameters_by_name[ pad.name ] = pad
-
self.return_type = func.return_type
self.glx_rop = ~0
@@ -163,7 +159,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
self.name = "glX_proto_send.py (from Mesa)"
self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004, 2005", "IBM")
-
self.last_category = ""
self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32]
self.pixel_stubs = {}
@@ -319,7 +314,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
self.print_generic_function(size)
return
-
def printBody(self, api):
self.pixel_stubs = {}
@@ -341,11 +335,9 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
do_it = 1
break
-
if do_it:
[h, n] = hash_pixel_function(func)
-
self.pixel_stubs[ func.name ] = n
if h not in generated_stubs:
generated_stubs.append(h)
@@ -353,7 +345,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
fake_func = glx_pixel_function_stub( func, n )
self.printFunction(fake_func, fake_func.name)
-
self.printFunction(func, func.name)
if func.glx_sop and func.glx_vendorpriv:
self.printFunction(func, func.glx_vendorpriv_names[0])
@@ -411,7 +402,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
""")
return
-
def printFunction(self, func, name):
footer = '}\n'
if func.glx_rop == ~0:
@@ -448,7 +438,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
print '%s __indirect_gl%s(%s)' % (func.return_type, name, func.get_parameter_string())
print '{'
-
if func.glx_rop != 0 or func.vectorequiv != None:
if len(func.images):
self.printPixelFunction(func)
@@ -463,7 +452,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
print footer
return
-
def print_generic_function(self, n):
size = (n + 3) & ~3
print textwrap.dedent("""\
@@ -481,7 +469,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
""" % (n, size + 4, size))
return
-
def common_emit_one_arg(self, p, pc, adjust, extra_offset):
if p.is_array():
src_ptr = p.name
@@ -514,7 +501,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
return
-
def pixel_emit_args(self, f, pc, large):
"""Emit the arguments for a pixel function. This differs from
common_emit_args in that pixel functions may require padding
@@ -551,7 +537,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
else:
print '(void) memcpy((void *)(%s + %u), (void *)((%s == NULL) ? one : zero), 4);' % (pc, (param.offset - 4) + adjust, param.name)
-
pixHeaderPtr = "%s + %u" % (pc, adjust)
pcPtr = "%s + %u" % (pc, param.offset + adjust)
@@ -571,7 +556,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
return
-
def large_emit_begin(self, f, op_name = None):
if not op_name:
op_name = f.opcode_real_name()
@@ -583,7 +567,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
print '(void) memcpy((void *)(pc + 4), (void *)(&op), 4);'
return
-
def common_func_print_just_start(self, f, name):
print ' struct glx_context * const gc = __glXGetCurrentContext();'
@@ -613,11 +596,9 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
else:
skip_condition = None
-
if f.return_type != 'void':
print ' %s retval = (%s) 0;' % (f.return_type, f.return_type)
-
if name != None and name not in f.glx_vendorpriv_names:
print '#ifndef USE_XCB'
self.emit_packet_size_calculation(f, 0)
@@ -650,7 +631,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
else:
return 0
-
def printSingleFunction(self, f, name):
self.common_func_print_just_start(f, name)
@@ -687,7 +667,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
else:
iparams.append(p.name)
-
xcb_request = '%s(%s)' % (xcb_name, ", ".join(["c", "gc->currentContextTag"] + iparams + extra_iparams))
if f.needs_reply():
@@ -728,7 +707,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
print '#else'
# End of XCB specific.
-
if f.parameters != []:
pc_decl = "GLubyte const * pc ="
else:
@@ -753,7 +731,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
if f.img_reset:
print ' * (int8_t *)(pc + %u) = %s;' % (o + 1, f.img_reset)
-
return_name = ''
if f.needs_reply():
if f.return_type != 'void':
@@ -793,14 +770,12 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
print " %s __glXReadReply(dpy, %s, %s, %s);" % (return_str, s, p.name, aa)
got_reply = 1
-
# If a reply wasn't read to fill an output parameter,
# read a NULL reply to get the return value.
if not got_reply:
print " %s __glXReadReply(dpy, 0, NULL, GL_FALSE);" % (return_str)
-
elif self.debug:
# Only emit the extra glFinish call for functions
# that don't already require a reply from the server.
@@ -809,7 +784,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
if self.debug:
print ' printf( "Exit %%s.\\n", "gl%s" );' % (name)
-
print ' UnlockDisplay(dpy); SyncHandle();'
if name not in f.glx_vendorpriv_names:
@@ -819,7 +793,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
print ' return%s;' % (return_name)
return
-
def printPixelFunction(self, f):
if self.pixel_stubs.has_key( f.name ):
# Normally gl_function::get_parameter_string could be
@@ -843,13 +816,11 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
print ' %s(%s, %u%s );' % (self.pixel_stubs[f.name] , f.opcode_name(), dim, p_string)
return
-
if self.common_func_print_just_start(f, None):
trailer = " }"
else:
trailer = None
-
if f.can_be_large:
print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {'
print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {'
@@ -879,7 +850,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
if trailer: print trailer
return
-
def printRenderFunction(self, f):
# There is a class of GL functions that take a single pointer
# as a parameter. This pointer points to a fixed-size chunk
@@ -947,7 +917,6 @@ class PrintGlxProtoInit_c(gl_XML.gl_print_base):
"PRECISION INSIGHT, IBM")
return
-
def printRealHeader(self):
print textwrap.dedent("""\
/**
@@ -1008,7 +977,6 @@ class PrintGlxProtoInit_c(gl_XML.gl_print_base):
""")
return
-
def printBody(self, api):
for [name, number] in api.categoryIterate():
if number != None:
@@ -1047,7 +1015,6 @@ class PrintGlxProtoInit_h(gl_XML.gl_print_base):
self.last_category = ""
return
-
def printRealHeader(self):
print textwrap.dedent("""\
/**
@@ -1080,7 +1047,6 @@ class PrintGlxProtoInit_h(gl_XML.gl_print_base):
struct glx_context * gc, GLint code, GLint vop, GLint cmdlen );
""")
-
def printBody(self, api):
for func in api.functionIterateGlx():
params = func.get_parameter_string()
diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py
index 9bf1b20..7403b8b 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -58,7 +58,6 @@ class glx_enum_function(object):
self.count = {}
-
# Fill self.count and self.enums using the dictionary of enums
# that was passed in. The generic Get functions (e.g.,
# GetBooleanv and friends) are handled specially here. In
@@ -91,10 +90,8 @@ class glx_enum_function(object):
self.enums[ e.value ] = [ e ]
self.count[ count ].append( e.value )
-
return
-
def signature( self ):
if self.sig == None:
self.sig = ""
@@ -108,11 +105,9 @@ class glx_enum_function(object):
return self.sig
-
def is_set( self ):
return self.mode
-
def PrintUsingTable(self):
"""Emit the body of the __gl*_size function using a pair
of look-up tables and a mask. The mask is calculated such
@@ -170,7 +165,6 @@ class glx_enum_function(object):
masked_enums[i] = '0x%04x /* %s */' % (e, enum_obj.name )
masked_count[i] = c
-
print ' static const GLushort a[%u] = {' % (mask + 1)
for e in masked_enums:
print ' %s, ' % (masked_enums[e])
@@ -188,7 +182,6 @@ class glx_enum_function(object):
else:
return 0
-
def PrintUsingSwitch(self, name):
"""Emit the body of the __gl*_size function using a
switch-statement."""
@@ -228,7 +221,6 @@ class glx_enum_function(object):
print ' default: return 0;'
print ' }'
-
def Print(self, name):
print '_X_INTERNAL PURE FASTCALL GLint'
print '__gl%s_size( GLenum e )' % (name)
@@ -248,7 +240,6 @@ class glx_server_enum_function(glx_enum_function):
self.function = func
return
-
def signature( self ):
if self.sig == None:
sig = glx_enum_function.signature(self)
@@ -261,7 +252,6 @@ class glx_server_enum_function(glx_enum_function):
return self.sig
-
def Print(self, name, printer):
f = self.function
printer.common_func_print_just_header( f )
@@ -285,7 +275,6 @@ class glx_server_enum_function(glx_enum_function):
printer.common_emit_one_arg(p, "pc", 0)
fixup.append( p.name )
-
print ' GLsizei compsize;'
print ''
@@ -349,7 +338,6 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
print ''
print ''
-
def printBody(self, api):
enum_sigs = {}
aliases = []
@@ -367,12 +355,10 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
enum_sigs[ sig ] = func.name
ef.Print( func.name )
-
for [alias_name, real_name] in aliases:
print 'ALIAS( %s, %s )' % (alias_name, real_name)
-
class PrintGlxSizeStubs_h(PrintGlxSizeStubs_common):
def printRealHeader(self):
print textwrap.dedent("""\
@@ -391,7 +377,6 @@ class PrintGlxSizeStubs_h(PrintGlxSizeStubs_common):
self.printFastcall()
print ''
-
def printBody(self, api):
for func in api.functionIterateGlx():
ef = glx_enum_function( func.name, api.enums_by_name )
@@ -408,7 +393,6 @@ class PrintGlxReqSize_common(gl_XML.gl_print_base):
The main purpose of this common base class is to provide the infrastructure
for the derrived classes to iterate over the same set of functions.
"""
-
def __init__(self):
gl_XML.gl_print_base.__init__(self)
@@ -421,14 +405,12 @@ class PrintGlxReqSize_h(PrintGlxReqSize_common):
PrintGlxReqSize_common.__init__(self)
self.header_tag = "_INDIRECT_REQSIZE_H_"
-
def printRealHeader(self):
print '#include <X11/Xfuncproto.h>'
print ''
self.printPure()
print ''
-
def printBody(self, api):
for func in api.functionIterateGlx():
if not func.ignore and func.has_variable_size_request():
@@ -447,7 +429,6 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
PrintGlxReqSize_common.__init__(self)
self.counter_sigs = {}
-
def printRealHeader(self):
print ''
print '#include <GL/gl.h>'
@@ -474,7 +455,6 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
print ''
print ''
-
def printBody(self, api):
aliases = []
enum_functions = {}
@@ -494,8 +474,6 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
if not enum_sigs.has_key( sig ):
enum_sigs[ sig ] = ef
-
-
for func in api.functionIterateGlx():
# Even though server-handcode fuctions are on "the
# list", and prototypes are generated for them, there
@@ -522,13 +500,11 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
a = self.printCountedFunction(func)
if a: aliases.append(a)
-
for [alias_name, real_name] in aliases:
print 'ALIAS( %s, %s )' % (alias_name, real_name)
return
-
def common_emit_fixups(self, fixup):
"""Utility function to emit conditional byte-swaps."""
@@ -540,7 +516,6 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
return
-
def common_emit_one_arg(self, p, pc, adjust):
offset = p.offset
dst = p.string()
@@ -548,13 +523,11 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
print '%-18s = *%11s(%s + %u);' % (dst, src, pc, offset + adjust)
return
-
def common_func_print_just_header(self, f):
print 'int'
print '__glX%sReqSize( const GLbyte * pc, Bool swap )' % (f.name)
print '{'
-
def printPixelFunction(self, f):
self.common_func_print_just_header(f)
@@ -599,7 +572,6 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
print ''
return
-
def printCountedFunction(self, f):
sig = ""
@@ -627,7 +599,6 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
size += '%s%s' % (plus, p.size_string())
plus = ' + '
-
# If the calculated signature matches a function that has
# already be emitted, don't emit this function. Instead, add
# it to the list of function aliases.
@@ -644,7 +615,6 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
for p in params:
self.common_emit_one_arg(p, "pc", 0)
-
print ''
self.common_emit_fixups(fixup)
print ''
diff --git a/src/mapi/glapi/gen/glX_server_table.py b/src/mapi/glapi/gen/glX_server_table.py
index a9db87f..37ed971 100644
--- a/src/mapi/glapi/gen/glX_server_table.py
+++ b/src/mapi/glapi/gen/glX_server_table.py
@@ -59,7 +59,6 @@ class function_table:
self.name_base = name
self.do_size_check = do_size_check
-
self.max_bits = 1
self.next_opcode_threshold = (1 << self.max_bits)
self.max_opcode = 0
@@ -72,7 +71,6 @@ class function_table:
self.min_op_count = (1 << self.min_op_bits)
return
-
def append(self, opcode, func):
self.functions[opcode] = func
@@ -88,7 +86,6 @@ class function_table:
self.next_opcode_threshold = 1 << bits
return
-
def divide_group(self, min_opcode, total):
"""Divide the group starting min_opcode into subgroups.
Returns a tuple containing the number of bits consumed by
@@ -116,7 +113,6 @@ class function_table:
else:
empty += 1
-
if empty == op_count:
empty_children += 1
@@ -126,7 +122,6 @@ class function_table:
if (empty_children > 0) or (full_children == child_count) or (op_count <= self.min_op_count):
break
-
# If all the remaining bits are used by this node, as is the
# case when M is 0 or remaining_bits, the node is a leaf.
@@ -157,7 +152,6 @@ class function_table:
else:
return [M, children, count, depth]
-
def is_empty_leaf(self, base_opcode, M):
for op in range(base_opcode, base_opcode + (1 << M)):
if self.functions.has_key(op):
@@ -166,13 +160,11 @@ class function_table:
return 1
-
def dump_tree(self, node, base_opcode, remaining_bits, base_entry, depth):
M = node[0]
children = node[1]
child_M = remaining_bits - M
-
# This actually an error condition.
if children == []:
return
@@ -238,7 +230,6 @@ class function_table:
base_opcode += 1 << (remaining_bits - M)
-
def Print(self):
# Each dispatch table consists of two data structures.
#
@@ -324,17 +315,14 @@ class function_table:
print ' /* [%3u] = %5u */ {%3u, %s},' % (index, opcode, fixed, var_offset)
index += 1
-
print '};\n'
-
print 'static const gl_proto_size_func %s_size_func_table[%u] = {' % (self.name_base, len(var_table))
for func in var_table:
print ' %s,' % (func)
print '};\n'
-
print 'const struct __glXDispatchInfo %s_dispatch_info = {' % (self.name_base)
print ' %u,' % (self.max_bits)
print ' %s_dispatch_tree,' % (self.name_base)
@@ -360,7 +348,6 @@ class PrintGlxDispatchTables(glX_proto_common.glx_print_proto):
self.vop_functions = function_table("VendorPriv", 0)
return
-
def printRealHeader(self):
print '#include <inttypes.h>'
print '#include "glxserver.h"'
@@ -371,7 +358,6 @@ class PrintGlxDispatchTables(glX_proto_common.glx_print_proto):
print ''
return
-
def printBody(self, api):
for f in api.functionIterateAll():
if not f.ignore and f.vectorequiv == None:
diff --git a/src/mapi/glapi/gen/gl_SPARC_asm.py b/src/mapi/glapi/gen/gl_SPARC_asm.py
index 52aa98b..954b637 100644
--- a/src/mapi/glapi/gen/gl_SPARC_asm.py
+++ b/src/mapi/glapi/gen/gl_SPARC_asm.py
@@ -33,6 +33,7 @@ import glX_XML
import gl_XML
import license
+
class PrintGenericStubs(gl_XML.gl_print_base):
def __init__(self):
gl_XML.gl_print_base.__init__(self)
@@ -43,7 +44,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
(C) Copyright IBM Corporation 2004"""),
"BRIAN PAUL, IBM")
-
def printRealHeader(self):
print '#ifdef __arch64__'
print '#define GL_OFF(N)\t((N) * 8)'
diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
index dbac478..c28ab61 100644
--- a/src/mapi/glapi/gen/gl_XML.py
+++ b/src/mapi/glapi/gen/gl_XML.py
@@ -93,7 +93,6 @@ class gl_print_base(object):
self.name = "a"
-
# License on the *generated* source file. This may differ
# from the license on the script that is generating the file.
# Every derived class should set this to some reasonable
@@ -103,7 +102,6 @@ class gl_print_base(object):
self.license = "The license for this file is unspecified."
-
# The header_tag is the name of the C preprocessor define
# used to prevent multiple inclusion. Typically only
# generated C header files need this to be set. Setting it
@@ -112,7 +110,6 @@ class gl_print_base(object):
self.header_tag = None
-
# List of file-private defines that must be undefined at the
# end of the file. This can be used in header files to define
# names for use in the file, then undefine them at the end of
@@ -121,14 +118,12 @@ class gl_print_base(object):
self.undef_list = []
return
-
def Print(self, api):
self.printHeader()
self.printBody(api)
self.printFooter()
return
-
def printHeader(self):
"""Print the header associated with all files and call the printRealHeader method."""
@@ -146,7 +141,6 @@ class gl_print_base(object):
self.printRealHeader()
return
-
def printFooter(self):
"""Print the header associated with all files and call the printRealFooter method."""
@@ -161,7 +155,6 @@ class gl_print_base(object):
print ''
print '#endif /* !defined( %s ) */' % (self.header_tag)
-
def printRealHeader(self):
"""Print the "real" header for the created file.
@@ -169,7 +162,6 @@ class gl_print_base(object):
classes should over-ride this function."""
return
-
def printRealFooter(self):
"""Print the "real" footer for the created file.
@@ -177,7 +169,6 @@ class gl_print_base(object):
classes should over-ride this function."""
return
-
def printPure(self):
"""Conditionally define `PURE' function attribute.
@@ -198,7 +189,6 @@ class gl_print_base(object):
""")
return
-
def printFastcall(self):
"""Conditionally define `FASTCALL' function attribute.
@@ -220,7 +210,6 @@ class gl_print_base(object):
""")
return
-
def printVisibility(self, S, s):
"""Conditionally define visibility function attribute.
@@ -242,7 +231,6 @@ class gl_print_base(object):
""" % (S, s, S))
return
-
def printNoinline(self):
"""Conditionally define `NOINLINE' function attribute.
@@ -264,7 +252,6 @@ class gl_print_base(object):
""")
return
-
def real_function_name(element):
name = element.get( "name" )
alias = element.get( "alias" )
@@ -313,7 +300,6 @@ def classify_category(name, number):
cat_type = 3
key = name
-
return [cat_type, key]
@@ -414,7 +400,6 @@ class gl_enum( gl_item ):
return priority + bias
-
class gl_parameter(object):
def __init__(self, element, context):
self.name = element.get( "name" )
@@ -460,7 +445,6 @@ class gl_parameter(object):
self.is_counter = is_attr_true( element, 'counter' )
self.is_output = is_attr_true( element, 'output' )
-
# Pixel data has special parameters.
self.width = element.get('img_width')
@@ -484,30 +468,24 @@ class gl_parameter(object):
self.is_padding = is_attr_true( element, 'padding' )
return
-
def compatible(self, other):
return 1
-
def is_array(self):
return self.is_pointer()
-
def is_pointer(self):
return self.type_expr.is_pointer()
-
def is_image(self):
if self.width:
return 1
else:
return 0
-
def is_variable_length(self):
return len(self.count_parameter_list) or self.counter
-
def is_64_bit(self):
count = self.type_expr.get_element_count()
if count:
@@ -519,19 +497,15 @@ class gl_parameter(object):
return 0
-
def string(self):
return self.type_expr.original_string + " " + self.name
-
def type_string(self):
return self.type_expr.original_string
-
def get_base_type_string(self):
return self.type_expr.get_base_name()
-
def get_dimensions(self):
if not self.width:
return [ 0, "0", "0", "0", "0" ]
@@ -556,18 +530,15 @@ class gl_parameter(object):
return [ dim, w, h, d, e ]
-
def get_stack_size(self):
return self.type_expr.get_stack_size()
-
def size(self):
if self.is_image():
return 0
else:
return self.type_expr.get_element_size()
-
def get_element_count(self):
c = self.type_expr.get_element_count()
if c == 0:
@@ -575,7 +546,6 @@ class gl_parameter(object):
return c
-
def size_string(self, use_parens = 1):
s = self.size()
if self.counter or self.count_parameter_list:
@@ -599,7 +569,6 @@ class gl_parameter(object):
else:
return str(s)
-
def format_string(self):
if self.type_expr.original_string == "GLenum":
return "0x%x"
@@ -659,7 +628,6 @@ class gl_function( gl_item ):
return
-
def process_element(self, element):
name = element.get( "name" )
alias = element.get( "alias" )
@@ -710,7 +678,6 @@ class gl_function( gl_item ):
elif self.name != true_name:
raise RuntimeError("Function true name redefined. Was %s, now %s." % (self.name, true_name))
-
# There are two possible cases. The first time an entry-point
# with data is seen, self.initialized will be 0. On that
# pass, we just fill in the data. The next time an
@@ -727,7 +694,6 @@ class gl_function( gl_item ):
param = self.context.factory.create_parameter(child, self.context)
parameters.append( param )
-
if self.initialized:
if self.return_type != return_type:
raise RuntimeError( "Return type changed in %s. Was %s, now %s." % (name, self.return_type, return_type))
@@ -741,7 +707,6 @@ class gl_function( gl_item ):
if not p1.compatible( p2 ):
raise RuntimeError( 'Parameter type mismatch in %s. "%s" was "%s", now "%s".' % (name, p2.name, p2.type_expr.original_string, p1.type_expr.original_string))
-
if true_name == name or not self.initialized:
self.return_type = return_type
self.parameters = parameters
@@ -785,14 +750,12 @@ class gl_function( gl_item ):
"""Return potentially empty list of input images."""
return self.images
-
def parameterIterator(self, name = None):
if name is not None:
return self.entry_point_parameters[name].__iter__()
else:
return self.parameters.__iter__()
-
def get_parameter_string(self, entrypoint = None):
if entrypoint:
params = self.entry_point_parameters[ entrypoint ]
@@ -813,7 +776,6 @@ class gl_function( gl_item ):
return p_string
-
def is_abi(self):
return (self.offset >= 0 and not self.assign_offset)
@@ -851,7 +813,6 @@ class gl_function( gl_item ):
class gl_item_factory(object):
"""Factory to create objects derived from gl_item."""
-
def create_function(self, element, context):
return gl_function(element, context)
@@ -908,19 +869,16 @@ class gl_api(object):
self.functions_by_name = functions_by_name
-
def parse_file(self, file_name):
doc = ET.parse( file_name )
self.process_element(file_name, doc)
-
def process_element(self, file_name, doc):
element = doc.getroot()
if element.tag == "OpenGLAPI":
self.process_OpenGLAPI(file_name, element)
return
-
def process_OpenGLAPI(self, file_name, element):
for child in element.getchildren():
if child.tag == "category":
@@ -934,7 +892,6 @@ class gl_api(object):
return
-
def process_category(self, cat):
cat_name = cat.get( "name" )
cat_number = cat.get( "number" )
@@ -959,7 +916,6 @@ class gl_api(object):
if func.offset >= self.next_offset:
self.next_offset = func.offset + 1
-
elif child.tag == "enum":
enum = self.factory.create_enum( child, self, cat_name )
self.enums_by_name[ enum.name ] = enum
@@ -969,7 +925,6 @@ class gl_api(object):
return
-
def functionIterateByCategory(self, cat = None):
"""Iterate over functions by category.
@@ -1006,20 +961,17 @@ class gl_api(object):
return functions.__iter__()
-
def functionIterateByOffset(self):
max_offset = -1
for func in self.functions_by_name.itervalues():
if func.offset > max_offset:
max_offset = func.offset
-
temp = [None for i in range(0, max_offset + 1)]
for func in self.functions_by_name.itervalues():
if func.offset != -1:
temp[ func.offset ] = func
-
list = []
for i in range(0, max_offset + 1):
if temp[i]:
@@ -1027,11 +979,9 @@ class gl_api(object):
return list.__iter__()
-
def functionIterateAll(self):
return self.functions_by_name.itervalues()
-
def enumIterateByName(self):
keys = self.enums_by_name.keys()
keys.sort()
@@ -1042,7 +992,6 @@ class gl_api(object):
return list.__iter__()
-
def categoryIterate(self):
"""Iterate over categories.
@@ -1061,18 +1010,15 @@ class gl_api(object):
return list.__iter__()
-
def get_category_for_name( self, name ):
if self.category_dict.has_key(name):
return self.category_dict[name]
else:
return ["<unknown category>", None]
-
def typeIterate(self):
return self.types_by_name.itervalues()
-
def find_type( self, type_name ):
if type_name in self.types_by_name:
return self.types_by_name[ type_name ].type_expr
diff --git a/src/mapi/glapi/gen/gl_apitemp.py b/src/mapi/glapi/gen/gl_apitemp.py
index 9f90ad7..ebe6600 100644
--- a/src/mapi/glapi/gen/gl_apitemp.py
+++ b/src/mapi/glapi/gen/gl_apitemp.py
@@ -33,6 +33,7 @@ import glX_XML
import gl_XML
import license
+
class PrintGlOffsets(gl_XML.gl_print_base):
def __init__(self, es=False):
gl_XML.gl_print_base.__init__(self)
@@ -56,7 +57,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
self.undef_list.append( "UNUSED_TABLE_NAME" )
self.undef_list.append( "TABLE_ENTRY" )
-
def printFunction(self, f, name):
p_string = ""
o_string = ""
@@ -89,7 +89,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
silence += "%s(void) %s;" % (space, p.name)
space = ' '
-
if f.return_type != 'void':
dispatch = "RETURN_DISPATCH"
else:
@@ -172,8 +171,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
""")
return
-
-
def printInitDispatch(self, api):
print textwrap.dedent("""\
#endif /* defined( NAME ) */
@@ -209,7 +206,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
print ''
return
-
def printAliasedTable(self, api):
print textwrap.dedent("""\
/*
@@ -251,7 +247,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
print ''
return
-
def classifyEntryPoints(self, func):
normal_names = []
normal_stubs = []
diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index 0ef0633..a55479c 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -35,8 +35,8 @@ import xml.etree.ElementTree as ET
import gl_XML
import license
-class PrintGlEnums(gl_XML.gl_print_base):
+class PrintGlEnums(gl_XML.gl_print_base):
def __init__(self):
gl_XML.gl_print_base.__init__(self)
@@ -49,7 +49,6 @@ class PrintGlEnums(gl_XML.gl_print_base):
# Mapping from enum name to value
self.string_to_int = {}
-
def printRealHeader(self):
print '#include "main/glheader.h"'
print '#include "main/enums.h"'
@@ -143,7 +142,6 @@ class PrintGlEnums(gl_XML.gl_print_base):
""")
return
-
def printBody(self, xml):
self.process_enums(xml)
@@ -173,7 +171,6 @@ class PrintGlEnums(gl_XML.gl_print_base):
print '};'
print ''
-
print 'static const enum_elt enum_string_table_offsets[%u] =' % (len(self.enum_table))
print '{'
for enum in sorted_enum_values:
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index 9374f41..995b526 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -40,7 +40,6 @@ exec_flavor_map = {
'skip': None,
}
-
header = """/**
* \\file api_exec.c
* Initialize dispatch table.
@@ -149,14 +148,12 @@ _mesa_initialize_exec_table(struct gl_context *ctx)
vbo_initialize_exec_dispatch(ctx, exec);
"""
-
footer = """
}
"""
class PrintCode(gl_XML.gl_print_base):
-
def __init__(self):
gl_XML.gl_print_base.__init__(self)
diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
index aa174ab..82be310 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -152,7 +152,6 @@ _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
class PrintCode(gl_XML.gl_print_base):
-
def __init__(self):
gl_XML.gl_print_base.__init__(self)
@@ -166,7 +165,6 @@ class PrintCode(gl_XML.gl_print_base):
return
-
def get_stack_size(self, f):
size = 0
for p in f.parameterIterator():
@@ -177,17 +175,14 @@ class PrintCode(gl_XML.gl_print_base):
return size
-
def printRealHeader(self):
print header
return
-
def printRealFooter(self):
print footer
return
-
def printBody(self, api):
# Determine how many functions have a defined offset.
diff --git a/src/mapi/glapi/gen/gl_procs.py b/src/mapi/glapi/gen/gl_procs.py
index 04c54b5..608ca40 100644
--- a/src/mapi/glapi/gen/gl_procs.py
+++ b/src/mapi/glapi/gen/gl_procs.py
@@ -96,7 +96,6 @@ class PrintGlProcs(gl_XML.gl_print_base):
base_offset += len(func.name) + 3
-
for func in api.functionIterateByOffset():
for n in func.entry_points:
if n != func.name:
@@ -111,7 +110,6 @@ class PrintGlProcs(gl_XML.gl_print_base):
base_offset += len(n) + 3
-
print ' ;'
print ''
print ''
diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
index d15dc0b..0cc0493 100644
--- a/src/mapi/glapi/gen/gl_table.py
+++ b/src/mapi/glapi/gen/gl_table.py
@@ -88,7 +88,6 @@ class PrintRemapTable(gl_XML.gl_print_base):
"(C) Copyright IBM Corporation 2005", "IBM")
return
-
def printRealHeader(self):
print textwrap.dedent("""\
/**
@@ -104,7 +103,6 @@ class PrintRemapTable(gl_XML.gl_print_base):
""")
return
-
def printBody(self, api):
print '#define CALL_by_offset(disp, cast, offset, parameters) \\'
print ' (*(cast (GET_by_offset(disp, offset)))) parameters'
diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py
index 183033a..bdb9a0f 100644
--- a/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -33,6 +33,7 @@ import glX_XML
import gl_XML
import license
+
def should_use_push(registers):
for [reg, offset] in registers:
if reg[1:4] == "xmm":
@@ -104,7 +105,6 @@ def restore_reg(reg, offset, use_move):
class PrintGenericStubs(gl_XML.gl_print_base):
-
def __init__(self):
gl_XML.gl_print_base.__init__(self)
@@ -112,7 +112,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
return
-
def get_stack_size(self, f):
size = 0
for p in f.parameterIterator():
@@ -120,7 +119,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
return size
-
def printRealHeader(self):
print "/* If we build with gcc's -fvisibility=hidden flag, we'll need to change"
print " * the symbol visibility mode to 'default'."
@@ -172,7 +170,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print ''
return
-
def printRealFooter(self):
print ''
print '#if defined (__ELF__) && defined (__linux__)'
@@ -180,7 +177,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '#endif'
return
-
def printFunction(self, f):
# The x86-64 ABI divides function parameters into a couple
@@ -219,7 +215,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
if ((int_class & 1) == 0) and (sse_class == 0):
registers.append( ["%rbp", 0] )
-
name = f.dispatch_name()
print '\t.p2align\t4,,15'
@@ -265,12 +260,10 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print ''
return
-
def printBody(self, api):
for f in api.functionIterateByOffset():
self.printFunction(f)
-
for f in api.functionIterateByOffset():
dispatch = f.dispatch_name()
for n in f.entry_points:
diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index e55a358..6d7c15d 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -33,8 +33,8 @@ import glX_XML
import gl_XML
import license
-class PrintGenericStubs(gl_XML.gl_print_base):
+class PrintGenericStubs(gl_XML.gl_print_base):
def __init__(self):
gl_XML.gl_print_base.__init__(self)
@@ -46,7 +46,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
"BRIAN PAUL, IBM")
return
-
def get_stack_size(self, f):
size = 0
for p in f.parameterIterator():
@@ -57,7 +56,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
return size
-
def printRealHeader(self):
print '#include "x86/assyntax.h"'
print ''
@@ -177,7 +175,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print ''
return
-
def printRealFooter(self):
print ''
print '\t\tGLOBL\tGLNAME(gl_dispatch_functions_end)'
@@ -190,7 +187,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print '#endif'
return
-
def printBody(self, api):
for f in api.functionIterateByOffset():
name = f.dispatch_name()
@@ -202,7 +198,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
if not f.is_static_entry_point(f.name):
print '\tHIDDEN(GL_PREFIX(%s, %s))' % (name, alt)
-
for f in api.functionIterateByOffset():
name = f.dispatch_name()
stack = self.get_stack_size(f)
@@ -223,6 +218,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
return
+
def _parser():
parser = argparse.ArgumentParser()
parser.add_argument('-f',
diff --git a/src/mapi/glapi/gen/remap_helper.py b/src/mapi/glapi/gen/remap_helper.py
index 688ac62..1e99884 100644
--- a/src/mapi/glapi/gen/remap_helper.py
+++ b/src/mapi/glapi/gen/remap_helper.py
@@ -66,14 +66,12 @@ class PrintGlRemap(gl_XML.gl_print_base):
self.license = license.bsd_license_template % ("Copyright (C) 2009 Chia-I Wu <olv at 0xlab.org>", "Chia-I Wu")
return
-
def printRealHeader(self):
print '#include "main/dispatch.h"'
print '#include "main/remap.h"'
print ''
return
-
def printBody(self, api):
pool_indices = {}
diff --git a/src/mapi/glapi/gen/typeexpr.py b/src/mapi/glapi/gen/typeexpr.py
index 284c13d..e48a6eb 100644
--- a/src/mapi/glapi/gen/typeexpr.py
+++ b/src/mapi/glapi/gen/typeexpr.py
@@ -44,7 +44,6 @@ class type_node(object):
self.size = 0 # type's size in bytes
return
-
def string(self):
"""Return string representation of this type_node."""
s = ""
@@ -73,12 +72,10 @@ class type_table(object):
self.types_by_name = {}
return
-
def add_type(self, type_expr):
self.types_by_name[ type_expr.get_base_name() ] = type_expr
return
-
def find_type(self, name):
if name in self.types_by_name:
return self.types_by_name[ name ]
@@ -178,7 +175,6 @@ class type_expression(object):
if signed and unsigned:
raise RuntimeError("Invalid type expression (both signed and unsigned specified)")
-
if const:
raise RuntimeError("Invalid type expression (dangling const)")
@@ -190,7 +186,6 @@ class type_expression(object):
return
-
def set_base_type(self, type_name, signed, unsigned, const, extra_types):
te = type_expression.built_in_types.find_type( type_name )
if not te:
@@ -208,19 +203,16 @@ class type_expression(object):
elif unsigned:
t.signed = 0
-
def set_base_type_node(self, tn):
self.expr = [tn]
return
-
def set_elements(self, count):
tn = self.expr[0]
tn.elements = count
return
-
def string(self):
s = ""
for t in self.expr:
@@ -228,18 +220,15 @@ class type_expression(object):
return s
-
def get_base_type_node(self):
return self.expr[0]
-
def get_base_name(self):
if len(self.expr):
return self.expr[0].name
else:
return None
-
def get_element_size(self):
tn = self.expr[0]
@@ -248,12 +237,10 @@ class type_expression(object):
else:
return tn.size
-
def get_element_count(self):
tn = self.expr[0]
return tn.elements
-
def get_stack_size(self):
tn = self.expr[ -1 ]
@@ -264,12 +251,10 @@ class type_expression(object):
else:
return 4
-
def is_pointer(self):
tn = self.expr[ -1 ]
return tn.pointer
-
def format_string(self):
tn = self.expr[ -1 ]
if tn.pointer:
@@ -280,7 +265,6 @@ class type_expression(object):
return "%d"
-
if __name__ == '__main__':
types_to_try = [ "int", "int *", "const int *", "int * const", "const int * const", \
--
2.8.0
More information about the mesa-dev
mailing list