glapi: Include headers with directory prefixes.
[mesa.git] / src / mesa / glapi / glX_proto_recv.py
index 86bdd0ec93a930782a77b1b90f1a5c83ba275933..f423c6db08476aa4f97f4758bb2c774b7d202fbe 100644 (file)
@@ -50,13 +50,18 @@ class PrintGlxDispatch_h(gl_XML.gl_print_base):
        def printBody(self, api):
                for func in api.functionIterateAll():
                        if not func.ignore and not func.vectorequiv:
-                               if func.glx_rop != 0:
+                               if func.glx_rop:
                                        print 'extern HIDDEN void __glXDisp_%s(GLbyte * pc);' % (func.name)
                                        print 'extern HIDDEN void __glXDispSwap_%s(GLbyte * pc);' % (func.name)
-                               elif func.glx_sop != 0 or func.glx_vendorpriv != 0:
+                               elif func.glx_sop or func.glx_vendorpriv:
                                        print 'extern HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name)
                                        print 'extern HIDDEN int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name)
 
+                                       if func.glx_sop and func.glx_vendorpriv:
+                                               n = func.glx_vendorpriv_names[0]
+                                               print 'extern HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (n)
+                                               print 'extern HIDDEN int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (n)
+
                return
 
 
@@ -76,35 +81,16 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                print '#include <GL/gl.h>'
                print '#include <GL/glxproto.h>'
 
-
-               # FIXME: Since this block will require changes as other
-               # FIXME: platforms are added, it should probably be in a
-               # FIXME: header file that is not generated by a script.
-
-               if self.do_swap:
-                       print '#ifdef __linux__'
-                       print '#include <byteswap.h>'
-                       print '#elif defined(__OpenBSD__)'
-                       print '#include <sys/endian.h>'
-                       print '#define bswap_16 __swap16'
-                       print '#define bswap_32 __swap32'
-                       print '#define bswap_64 __swap64'
-                       print '#else'
-                       print '#include <sys/endian.h>'
-                       print '#define bswap_16 bswap16'
-                       print '#define bswap_32 bswap32'
-                       print '#define bswap_64 bswap64'
-                       print '#endif'
-
                print '#include <inttypes.h>'
                print '#include "indirect_size.h"'
                print '#include "indirect_size_get.h"'
                print '#include "indirect_dispatch.h"'
                print '#include "glxserver.h"'
+               print '#include "glxbyteorder.h"'
                print '#include "indirect_util.h"'
                print '#include "singlesize.h"'
-               print '#include "glapitable.h"'
                print '#include "glapi.h"'
+               print '#include "glapitable.h"'
                print '#include "glthread.h"'
                print '#include "dispatch.h"'
                print ''
@@ -129,12 +115,15 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
 
                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)
+                               self.printFunction(func, func.name)
+                               if func.glx_sop and func.glx_vendorpriv:
+                                       self.printFunction(func, func.glx_vendorpriv_names[0])
+                                       
 
                return
 
 
-       def printFunction(self, f):
+       def printFunction(self, f, name):
                if (f.glx_sop or f.glx_vendorpriv) and (len(f.get_images()) != 0):
                        return
 
@@ -144,9 +133,9 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                        base = '__glXDispSwap'
 
                if f.glx_rop:
-                       print 'void %s_%s(GLbyte * pc)' % (base, f.name)
+                       print 'void %s_%s(GLbyte * pc)' % (base, name)
                else:
-                       print 'int %s_%s(__GLXclientState *cl, GLbyte *pc)' % (base, f.name)
+                       print 'int %s_%s(__GLXclientState *cl, GLbyte *pc)' % (base, name)
 
                print '{'
 
@@ -154,9 +143,9 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                        self.printRenderFunction(f)
                elif f.glx_sop or f.glx_vendorpriv:
                        if len(f.get_images()) == 0: 
-                               self.printSingleFunction(f)
+                               self.printSingleFunction(f, name)
                else:
-                       print "/* Missing GLX protocol for %s. */" % (f.name)
+                       print "/* Missing GLX protocol for %s. */" % (name)
 
                print '}'
                print ''
@@ -236,6 +225,8 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                list = []
 
                for param in f.parameterIterator():
+                       if param.is_padding:
+                               continue
 
                        if param.is_counter or param.is_image() or param.is_output or param.name in f.count_parameter_list or len(param.count_parameter_list):
                                location = param.name
@@ -286,7 +277,7 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                        if param.is_image():
                                offset = f.offset_of( param.name )
 
-                               print '%s    %s const %s = (%s) %s(pc + %s);' % (indent, type_string, param.name, type_string, cond, offset)
+                               print '%s    %s const %s = (%s) (%s(pc + %s));' % (indent, type_string, param.name, type_string, cond, offset)
                                
                                if param.depth:
                                        print '%s    __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);' % (indent)
@@ -384,8 +375,8 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                return
 
 
-       def printSingleFunction(self, f):
-               if f.glx_sop:
+       def printSingleFunction(self, f, name):
+               if name not in f.glx_vendorpriv_names:
                        print '    xGLXSingleReq * const req = (xGLXSingleReq *) pc;'
                else:
                        print '    xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;'
@@ -398,7 +389,7 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                    print '    __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);'
 
                print ''
-               if f.glx_sop:
+               if name not in f.glx_vendorpriv_names:
                        print '    pc += __GLX_SINGLE_HDR_SIZE;'
                else:
                        print '    pc += __GLX_VENDPRIV_HDR_SIZE;'