From 3d7ee324adca4f4c20a793d5d01921c6e757b681 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Tue, 26 Sep 2006 23:47:04 +0000 Subject: Added function convertStringForXCB. Deals with the recent XCB naming convention switch. Updated the generated code to use the new XCB naming scheme. --- src/mesa/glapi/glX_proto_send.py | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'src/mesa/glapi/glX_proto_send.py') diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py index 3fa665dbce..aaee2f605d 100644 --- a/src/mesa/glapi/glX_proto_send.py +++ b/src/mesa/glapi/glX_proto_send.py @@ -24,10 +24,26 @@ # # Authors: # Ian Romanick +# Jeremy Kolb import gl_XML, glX_XML, glX_proto_common, license import sys, getopt, copy, string +def convertStringForXCB(str): + tmp = "" + special = [ "ARB" ] + i = 0 + while i < len(str): + if str[i:i+3] in special: + tmp = '%s_%s' % (tmp, string.lower(str[i:i+3])) + i = i + 2; + elif str[i].isupper(): + tmp = '%s_%s' % (tmp, string.lower(str[i])) + else: + tmp = '%s%s' % (tmp, str[i]) + 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 @@ -153,8 +169,8 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto): print '#include ' print '#ifdef USE_XCB' print '#include ' - print '#include ' - print '#include ' + print '#include ' + print '#include ' print '#endif /* USE_XCB */' print '' @@ -544,9 +560,9 @@ generic_%u_byte( GLint rop, const void * ptr ) print '#ifdef USE_XCB' if self.debug: print ' printf("\\tUsing XCB.\\n");' - print ' XCBConnection *c = XCBConnectionOfDisplay(dpy);' + print ' xcb_connection_t *c = XGetXCBConnection(dpy);' print ' (void) __glXFlushRenderBuffer(gc, gc->pc);' - xcb_name = 'XCBGlx%s' % f.name + xcb_name = 'xcb_glx%s' % convertStringForXCB(f.name) iparams=[] extra_iparams = [] @@ -563,7 +579,7 @@ generic_%u_byte( GLint rop, const void * ptr ) # Hardcode this in. lsb_first param (apparently always GL_FALSE) # also present in GetPolygonStipple, but taken care of above. - if xcb_name == "XCBGlxReadPixels": + if xcb_name == "xcb_glx_read_pixels": extra_iparams.append("0") else: iparams.append(p.name) @@ -572,16 +588,16 @@ generic_%u_byte( GLint rop, const void * ptr ) xcb_request = '%s(%s)' % (xcb_name, ", ".join(["c", "gc->currentContextTag"] + iparams + extra_iparams)) if f.needs_reply(): - print ' %sRep *reply = %sReply(c, %s, NULL);' % (xcb_name, xcb_name, xcb_request) + print ' %s_reply_t *reply = %s_reply(c, %s, NULL);' % (xcb_name, xcb_name, xcb_request) if output and f.reply_always_array: - print ' (void)memcpy(%s, %sData(reply), %sDataLength(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) + print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) elif output and not f.reply_always_array: if not output.is_image(): - print ' if (%sDataLength(reply) == 0)' % (xcb_name) + print ' if (%s_data_length(reply) == 0)' % (xcb_name) print ' (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name) print ' else' - print ' (void)memcpy(%s, %sData(reply), %sDataLength(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) + print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string()) if f.return_type != 'void': -- cgit v1.2.3