Changeset 63939 in vbox
- Timestamp:
- Sep 22, 2016 7:58:05 AM (8 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 61 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/DD_glc.py
r62521 r63939 1 print """ 1 from __future__ import print_function 2 print(""" 2 3 /** @file 3 4 * VBox OpenGL chromium functions header … … 15 16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 17 */ 17 """ 18 """) 18 19 # Copyright (c) 2001, Stanford University 19 20 # All rights reserved. … … 27 28 apiutil.CopyrightC() 28 29 29 print 30 print(""" 30 31 /* DO NOT EDIT - THIS FILE GENERATED BY THE DD_gl.py SCRIPT */ 31 32 … … 36 37 #include "dri_drv.h" 37 38 #include "cr_gl.h" 38 """ 39 """) 39 40 40 41 commoncall_special = [ … … 122 123 123 124 if func_name in commoncall_special: 124 print "%s vboxDD_gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))125 print("%s vboxDD_gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params) )) 125 126 else: 126 127 if apiutil.MakeDeclarationString(params)=="void": 127 print "%s vboxDD_gl%s( GLcontext *ctx )" % (return_type, func_name)128 print("%s vboxDD_gl%s( GLcontext *ctx )" % (return_type, func_name )) 128 129 else: 129 print "%s vboxDD_gl%s( GLcontext *ctx, %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))130 print "{"130 print("%s vboxDD_gl%s( GLcontext *ctx, %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params) )) 131 print("{") 131 132 132 133 if return_type != "void": 133 print "\treturn ",134 print("\treturn ", end=' ') 134 135 135 print "\tcr_gl%s( %s );" % (func_name, apiutil.MakeCallString(params))136 print "}"137 print ""136 print("\tcr_gl%s( %s );" % (func_name, apiutil.MakeCallString(params))) 137 print("}") 138 print("") 138 139 -
trunk/src/VBox/Additions/common/crOpenGL/DD_glh.py
r62521 r63939 1 print """ 1 from __future__ import print_function 2 print(""" 2 3 /** @file 3 4 * VBox OpenGL chromium functions header … … 15 16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 17 */ 17 """ 18 """) 18 19 # Copyright (c) 2001, Stanford University 19 20 # All rights reserved. … … 27 28 apiutil.CopyrightC() 28 29 29 print 30 print(""" 30 31 /* DO NOT EDIT - THIS FILE GENERATED BY THE DD_gl.py SCRIPT */ 31 32 #ifndef __DD_GL_H__ … … 37 38 #include "stub.h" 38 39 39 """ 40 """) 40 41 41 42 commoncall_special = [ … … 124 125 125 126 if func_name in commoncall_special: 126 print 127 apiutil.MakeDeclarationString( params )) 127 print("extern %s vboxDD_gl%s( %s );" % (return_type, func_name, 128 apiutil.MakeDeclarationString( params ))) 128 129 else: 129 130 if apiutil.MakeDeclarationString(params)=="void": 130 print "extern %s vboxDD_gl%s( GLcontext *ctx );" % (return_type, func_name)131 print("extern %s vboxDD_gl%s( GLcontext *ctx );" % (return_type, func_name)) 131 132 else: 132 print 133 apiutil.MakeDeclarationString( params )) 133 print("extern %s vboxDD_gl%s( GLcontext *ctx, %s );" % (return_type, func_name, 134 apiutil.MakeDeclarationString( params ))) 134 135 135 print "#endif /* __DD_GL_H__ */"136 print("#endif /* __DD_GL_H__ */") -
trunk/src/VBox/Additions/common/crOpenGL/Linux_i386_exports.py
r30457 r63939 5 5 6 6 7 from __future__ import print_function 7 8 import sys 8 9 … … 17 18 # The order is very important - it must match cr_opcodes.h 18 19 # and spu_dispatch_table.h 19 print '%include "iprt/asmdefs.mac"'20 print ""21 print "%ifdef RT_ARCH_AMD64"22 print "extern glim"23 print "%else ; X86"24 print "extern glim"25 print "%endif"26 print ""20 print('%include "iprt/asmdefs.mac"') 21 print("") 22 print("%ifdef RT_ARCH_AMD64") 23 print("extern glim") 24 print("%else ; X86") 25 print("extern glim") 26 print("%endif") 27 print("") 27 28 28 29 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 35 36 continue 36 37 37 print "BEGINPROC_EXPORTED gl%s" % func_name38 print "%ifdef RT_ARCH_AMD64"39 print "\tmov \trax, qword glim+%d" % (8*index)40 print "\tjmp \t[rax]"41 print "%else ; X86"42 print "\tmov \teax, dword glim+%d" % (4*index)43 print "\tjmp \t[eax]"44 print "%endif"45 print "ENDPROC gl%s" % func_name46 print ""38 print("BEGINPROC_EXPORTED gl%s" % func_name) 39 print("%ifdef RT_ARCH_AMD64") 40 print("\tmov \trax, qword glim+%d" % (8*index)) 41 print("\tjmp \t[rax]") 42 print("%else ; X86") 43 print("\tmov \teax, dword glim+%d" % (4*index)) 44 print("\tjmp \t[eax]") 45 print("%endif") 46 print("ENDPROC gl%s" % func_name) 47 print("") 47 48 48 49 49 print ';'50 print '; Aliases'51 print ';'50 print(';') 51 print('; Aliases') 52 print(';') 52 53 53 54 # Now loop over all the functions and take care of any aliases … … 66 67 # this dict lookup should never fail (raise an exception)! 67 68 index = keys.index(alias) 68 print "BEGINPROC_EXPORTED gl%s" % func_name69 print "%ifdef RT_ARCH_AMD64"70 print "\tmov \trax, qword glim+%d" % (8*index)71 print "\tjmp \t[rax]"72 print "%else ; X86"73 print "\tmov \teax, dword glim+%d" % (4*index)74 print "\tjmp \t[eax]"75 print "%endif"76 print "ENDPROC gl%s" % func_name77 print ""69 print("BEGINPROC_EXPORTED gl%s" % func_name) 70 print("%ifdef RT_ARCH_AMD64") 71 print("\tmov \trax, qword glim+%d" % (8*index)) 72 print("\tjmp \t[rax]") 73 print("%else ; X86") 74 print("\tmov \teax, dword glim+%d" % (4*index)) 75 print("\tjmp \t[eax]") 76 print("%endif") 77 print("ENDPROC gl%s" % func_name) 78 print("") 78 79 79 80 80 print ';'81 print '; No-op stubs'82 print ';'81 print(';') 82 print('; No-op stubs') 83 print(';') 83 84 84 85 # Now generate no-op stub functions 85 86 for func_name in allkeys: 86 87 if "stub" in apiutil.ChromiumProps(func_name): 87 print "BEGINPROC_EXPORTED gl%s" % func_name88 print "\tleave"89 print "\tret"90 print "ENDPROC gl%s" % func_name91 print ""88 print("BEGINPROC_EXPORTED gl%s" % func_name) 89 print("\tleave") 90 print("\tret") 91 print("ENDPROC gl%s" % func_name) 92 print("") 92 93 93 94 -
trunk/src/VBox/Additions/common/crOpenGL/Linux_i386_exports_dri.py
r30457 r63939 5 5 6 6 7 from __future__ import print_function 7 8 import sys 8 9 … … 17 18 # The order is very important - it must match cr_opcodes.h 18 19 # and spu_dispatch_table.h 19 print '%include "iprt/asmdefs.mac"'20 print ""21 print "%ifdef RT_ARCH_AMD64"22 print "extern glim"23 print "%else ; X86"24 print "extern glim"25 print "%endif"26 print ""20 print('%include "iprt/asmdefs.mac"') 21 print("") 22 print("%ifdef RT_ARCH_AMD64") 23 print("extern glim") 24 print("%else ; X86") 25 print("extern glim") 26 print("%endif") 27 print("") 27 28 28 29 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 35 36 continue 36 37 37 print "BEGINPROC_EXPORTED cr_gl%s" % func_name38 print "%ifdef RT_ARCH_AMD64"39 print "\tmov \trax, qword glim+%d" % (8*index)40 print "\tjmp \t[rax]"41 print "%else ; X86"42 print "\tmov \teax, dword glim+%d" % (4*index)43 print "\tjmp \t[eax]"44 print "%endif"45 print "ENDPROC cr_gl%s" % func_name46 print ""38 print("BEGINPROC_EXPORTED cr_gl%s" % func_name) 39 print("%ifdef RT_ARCH_AMD64") 40 print("\tmov \trax, qword glim+%d" % (8*index)) 41 print("\tjmp \t[rax]") 42 print("%else ; X86") 43 print("\tmov \teax, dword glim+%d" % (4*index)) 44 print("\tjmp \t[eax]") 45 print("%endif") 46 print("ENDPROC cr_gl%s" % func_name) 47 print("") 47 48 48 49 49 print ';'50 print '; Aliases'51 print ';'50 print(';') 51 print('; Aliases') 52 print(';') 52 53 53 54 # Now loop over all the functions and take care of any aliases … … 66 67 # this dict lookup should never fail (raise an exception)! 67 68 index = keys.index(alias) 68 print "BEGINPROC_EXPORTED cr_gl%s" % func_name69 print "%ifdef RT_ARCH_AMD64"70 print "\tmov \trax, qword glim+%d" % (8*index)71 print "\tjmp \t[rax]"72 print "%else ; X86"73 print "\tmov \teax, dword glim+%d" % (4*index)74 print "\tjmp \t[eax]"75 print "%endif"76 print "ENDPROC cr_gl%s" % func_name77 print ""69 print("BEGINPROC_EXPORTED cr_gl%s" % func_name) 70 print("%ifdef RT_ARCH_AMD64") 71 print("\tmov \trax, qword glim+%d" % (8*index)) 72 print("\tjmp \t[rax]") 73 print("%else ; X86") 74 print("\tmov \teax, dword glim+%d" % (4*index)) 75 print("\tjmp \t[eax]") 76 print("%endif") 77 print("ENDPROC cr_gl%s" % func_name) 78 print("") 78 79 79 80 80 print ';'81 print '; No-op stubs'82 print ';'81 print(';') 82 print('; No-op stubs') 83 print(';') 83 84 84 85 # Now generate no-op stub functions 85 86 for func_name in allkeys: 86 87 if "stub" in apiutil.ChromiumProps(func_name): 87 print "BEGINPROC_EXPORTED cr_gl%s" % func_name88 print "\tleave"89 print "\tret"90 print "ENDPROC cr_gl%s" % func_name91 print ""88 print("BEGINPROC_EXPORTED cr_gl%s" % func_name) 89 print("\tleave") 90 print("\tret") 91 print("ENDPROC cr_gl%s" % func_name) 92 print("") 92 93 93 94 -
trunk/src/VBox/Additions/common/crOpenGL/Linux_i386_glxapi_exports.py
r62520 r63939 11 11 """ 12 12 13 from __future__ import print_function 13 14 import sys 14 15 … … 80 81 ]; 81 82 82 print '%include "iprt/asmdefs.mac"'83 print ""84 print "%ifdef RT_ARCH_AMD64"85 print "extern glxim"86 print "%else ; X86"87 print "extern glxim"88 print "%endif"89 print ""83 print('%include "iprt/asmdefs.mac"') 84 print("") 85 print("%ifdef RT_ARCH_AMD64") 86 print("extern glxim") 87 print("%else ; X86") 88 print("extern glxim") 89 print("%endif") 90 print("") 90 91 91 92 for index in range(len(glx_functions)): 92 93 func_name = glx_functions[index] 93 94 94 print "BEGINPROC_EXPORTED vbox_glX%s" % func_name95 print "%ifdef RT_ARCH_AMD64"96 print "\tmov \trax, qword glxim+%d" % (8*index)97 print "\tjmp \t[rax]"98 print "%else ; X86"99 print "\tmov \teax, dword glxim+%d" % (4*index)100 print "\tjmp \t[eax]"101 print "%endif"102 print "ENDPROC vbox_glX%s" % func_name103 print ""95 print("BEGINPROC_EXPORTED vbox_glX%s" % func_name) 96 print("%ifdef RT_ARCH_AMD64") 97 print("\tmov \trax, qword glxim+%d" % (8*index)) 98 print("\tjmp \t[rax]") 99 print("%else ; X86") 100 print("\tmov \teax, dword glxim+%d" % (4*index)) 101 print("\tjmp \t[eax]") 102 print("%endif") 103 print("ENDPROC vbox_glX%s" % func_name) 104 print("") 104 105 -
trunk/src/VBox/Additions/common/crOpenGL/NULLfuncs.py
r16381 r63939 5 5 6 6 7 from __future__ import print_function 7 8 import sys 8 9 … … 13 14 apiutil.CopyrightC() 14 15 15 print 16 print(""" 16 17 /* DO NOT EDIT - THIS FILE GENERATED BY THE NULLfuncs.py SCRIPT */ 17 18 18 19 #include "cr_error.h" 19 20 #include "stub.h" 20 """ 21 """) 21 22 22 23 for func_name in keys: … … 24 25 params = apiutil.Parameters(func_name) 25 26 26 print "static %s SPULOAD_APIENTRY NULL_%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))27 print "{"28 print "\t/* do nothing */"29 print "\tcrWarning(\"YOU ARE CALLING A NULLED FUNCTION (%s)\");" % func_name27 print("static %s SPULOAD_APIENTRY NULL_%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))) 28 print("{") 29 print("\t/* do nothing */") 30 print("\tcrWarning(\"YOU ARE CALLING A NULLED FUNCTION (%s)\");" % func_name) 30 31 for (name, type, vecSize) in params: 31 print "\t(void) %s;" % name32 print("\t(void) %s;" % name) 32 33 if return_type != "void": 33 print "\treturn 0;"34 print "}"35 print ""34 print("\treturn 0;") 35 print("}") 36 print("") 36 37 37 38 38 print "DECLEXPORT(SPUDispatchTable) stubNULLDispatch = {"39 print("DECLEXPORT(SPUDispatchTable) stubNULLDispatch = {") 39 40 for func_name in keys: 40 print "\tNULL_%s," % (func_name)41 print "\tNULL, /* copyList */"42 print "\tNULL, /* copy_of */"43 print "\t0, /* mark */"44 print "\tNULL /* server */"45 print "};"41 print("\tNULL_%s," % (func_name)) 42 print("\tNULL, /* copyList */") 43 print("\tNULL, /* copy_of */") 44 print("\t0, /* mark */") 45 print("\tNULL /* server */") 46 print("};") 46 47 47 print ""48 print "/* Declare and initialize the glim dispatch table here so that we */"49 print "/* can initialize all entries to no-op routines. */"50 print "SPUDispatchTable glim = {"48 print("") 49 print("/* Declare and initialize the glim dispatch table here so that we */") 50 print("/* can initialize all entries to no-op routines. */") 51 print("SPUDispatchTable glim = {") 51 52 for func_name in keys: 52 print "\tNULL_%s," % (func_name)53 print "\tNULL, /* copyList */"54 print "\tNULL, /* copy_of */"55 print "\t0, /* mark */"56 print "\tNULL /* server */"57 print "};"53 print("\tNULL_%s," % (func_name)) 54 print("\tNULL, /* copyList */") 55 print("\tNULL, /* copy_of */") 56 print("\t0, /* mark */") 57 print("\tNULL /* server */") 58 print("};") -
trunk/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports.py
r62521 r63939 11 11 """ 12 12 13 from __future__ import print_function 13 14 import sys 14 15 … … 23 24 # The order is very important - it must match cr_opcodes.h 24 25 # and spu_dispatch_table.h 25 print '%include "iprt/asmdefs.mac"'26 print ""27 print "%ifdef RT_ARCH_AMD64"28 print "extern glim"29 print "%else ; X86"30 print "extern glim"31 print "%endif"32 print ""26 print('%include "iprt/asmdefs.mac"') 27 print("") 28 print("%ifdef RT_ARCH_AMD64") 29 print("extern glim") 30 print("%else ; X86") 31 print("extern glim") 32 print("%endif") 33 print("") 33 34 34 35 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 41 42 continue 42 43 43 print "BEGINPROC_EXPORTED gl%s" % func_name44 print "%ifdef RT_ARCH_AMD64"45 print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)46 print "%else ; X86"47 print "\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)48 print "%endif"49 print "ENDPROC gl%s" % func_name50 print ""44 print("BEGINPROC_EXPORTED gl%s" % func_name) 45 print("%ifdef RT_ARCH_AMD64") 46 print("\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)) 47 print("%else ; X86") 48 print("\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)) 49 print("%endif") 50 print("ENDPROC gl%s" % func_name) 51 print("") 51 52 52 53 53 print ';'54 print '; Aliases'55 print ';'54 print(';') 55 print('; Aliases') 56 print(';') 56 57 57 58 # Now loop over all the functions and take care of any aliases … … 70 71 # this dict lookup should never fail (raise an exception)! 71 72 index = keys.index(alias) 72 print "BEGINPROC_EXPORTED gl%s" % func_name73 print "%ifdef RT_ARCH_AMD64"74 print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)75 print "%else ; X86"76 print "\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)77 print "%endif"78 print "ENDPROC gl%s" % func_name79 print ""73 print("BEGINPROC_EXPORTED gl%s" % func_name) 74 print("%ifdef RT_ARCH_AMD64") 75 print("\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)) 76 print("%else ; X86") 77 print("\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)) 78 print("%endif") 79 print("ENDPROC gl%s" % func_name) 80 print("") 80 81 81 82 82 print ';'83 print '; No-op stubs'84 print ';'83 print(';') 84 print('; No-op stubs') 85 print(';') 85 86 86 87 # Now generate no-op stub functions 87 88 for func_name in allkeys: 88 89 if "stub" in apiutil.ChromiumProps(func_name): 89 print "BEGINPROC_EXPORTED gl%s" % func_name90 print "\tleave"91 print "\tret"92 print "ENDPROC gl%s" % func_name93 print ""90 print("BEGINPROC_EXPORTED gl%s" % func_name) 91 print("\tleave") 92 print("\tret") 93 print("ENDPROC gl%s" % func_name) 94 print("") 94 95 95 96 -
trunk/src/VBox/Additions/common/crOpenGL/SunOS_i386_exports_dri.py
r62521 r63939 11 11 """ 12 12 13 from __future__ import print_function 13 14 import sys 14 15 … … 23 24 # The order is very important - it must match cr_opcodes.h 24 25 # and spu_dispatch_table.h 25 print '%include "iprt/asmdefs.mac"'26 print ""27 print "%ifdef RT_ARCH_AMD64"28 print "extern glim"29 print "%else ; X86"30 print "extern glim"31 print "%endif"32 print ""26 print('%include "iprt/asmdefs.mac"') 27 print("") 28 print("%ifdef RT_ARCH_AMD64") 29 print("extern glim") 30 print("%else ; X86") 31 print("extern glim") 32 print("%endif") 33 print("") 33 34 34 35 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 41 42 continue 42 43 43 print "BEGINPROC_EXPORTED cr_gl%s" % func_name44 print "%ifdef RT_ARCH_AMD64"45 print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)46 print "%else ; X86"47 print "\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)48 print "%endif"49 print "ENDPROC cr_gl%s" % func_name50 print ""44 print("BEGINPROC_EXPORTED cr_gl%s" % func_name) 45 print("%ifdef RT_ARCH_AMD64") 46 print("\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)) 47 print("%else ; X86") 48 print("\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)) 49 print("%endif") 50 print("ENDPROC cr_gl%s" % func_name) 51 print("") 51 52 52 53 53 print ';'54 print '; Aliases'55 print ';'54 print(';') 55 print('; Aliases') 56 print(';') 56 57 57 58 # Now loop over all the functions and take care of any aliases … … 70 71 # this dict lookup should never fail (raise an exception)! 71 72 index = keys.index(alias) 72 print "BEGINPROC_EXPORTED cr_gl%s" % func_name73 print "%ifdef RT_ARCH_AMD64"74 print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)75 print "%else ; X86"76 print "\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)77 print "%endif"78 print "ENDPROC cr_gl%s" % func_name79 print ""73 print("BEGINPROC_EXPORTED cr_gl%s" % func_name) 74 print("%ifdef RT_ARCH_AMD64") 75 print("\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)) 76 print("%else ; X86") 77 print("\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)) 78 print("%endif") 79 print("ENDPROC cr_gl%s" % func_name) 80 print("") 80 81 81 82 82 print ';'83 print '; No-op stubs'84 print ';'83 print(';') 84 print('; No-op stubs') 85 print(';') 85 86 86 87 # Now generate no-op stub functions 87 88 for func_name in allkeys: 88 89 if "stub" in apiutil.ChromiumProps(func_name): 89 print "BEGINPROC_EXPORTED cr_gl%s" % func_name90 print "\tleave"91 print "\tret"92 print "ENDPROC cr_gl%s" % func_name93 print ""90 print("BEGINPROC_EXPORTED cr_gl%s" % func_name) 91 print("\tleave") 92 print("\tret") 93 print("ENDPROC cr_gl%s" % func_name) 94 print("") 94 95 95 96 -
trunk/src/VBox/Additions/common/crOpenGL/SunOS_i386_glxapi_exports.py
r62521 r63939 11 11 """ 12 12 13 from __future__ import print_function 13 14 import sys 14 15 … … 80 81 ]; 81 82 82 print '%include "iprt/asmdefs.mac"'83 print ""84 print "%ifdef RT_ARCH_AMD64"85 print "extern glxim"86 print "%else ; X86"87 print "extern glxim"88 print "%endif"89 print ""83 print('%include "iprt/asmdefs.mac"') 84 print("") 85 print("%ifdef RT_ARCH_AMD64") 86 print("extern glxim") 87 print("%else ; X86") 88 print("extern glxim") 89 print("%endif") 90 print("") 90 91 91 92 for index in range(len(glx_functions)): 92 93 func_name = glx_functions[index] 93 94 94 print "BEGINPROC_EXPORTED vbox_glX%s" % func_name95 print "%ifdef RT_ARCH_AMD64"96 print "\tjmp \t[glxim+%d wrt rip wrt ..gotpcrel]" % (8*index)97 print "%else ; X86"98 print "\tjmp \t[glxim+%d wrt ..gotpc]" % (4*index)99 print "%endif"100 print "ENDPROC vbox_glX%s" % func_name101 print ""95 print("BEGINPROC_EXPORTED vbox_glX%s" % func_name) 96 print("%ifdef RT_ARCH_AMD64") 97 print("\tjmp \t[glxim+%d wrt rip wrt ..gotpcrel]" % (8*index)) 98 print("%else ; X86") 99 print("\tjmp \t[glxim+%d wrt ..gotpc]" % (4*index)) 100 print("%endif") 101 print("ENDPROC vbox_glX%s" % func_name) 102 print("") 102 103 -
trunk/src/VBox/Additions/common/crOpenGL/cr_gl.py
r62521 r63939 1 print """ 1 from __future__ import print_function 2 print(""" 2 3 /** @file 3 4 * VBox OpenGL chromium functions header … … 15 16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 17 */ 17 """ 18 """) 18 19 # Copyright (c) 2001, Stanford University 19 20 # All rights reserved. … … 27 28 apiutil.CopyrightC() 28 29 29 print 30 print(""" 30 31 /* DO NOT EDIT - THIS FILE GENERATED BY THE cr_gl.py SCRIPT */ 31 32 #ifndef __CR_GL_H__ … … 41 42 #endif 42 43 43 """ 44 """) 44 45 45 46 … … 59 60 params = apiutil.Parameters(func_name) 60 61 61 print 62 apiutil.MakeDeclarationString( params )) 62 print("extern %s cr_gl%s( %s );" % (return_type, func_name, 63 apiutil.MakeDeclarationString( params ))) 63 64 64 print "#endif /* __CR_GL_H__ */"65 print("#endif /* __CR_GL_H__ */") -
trunk/src/VBox/Additions/common/crOpenGL/defs.py
r48999 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 13 14 #print "LIBRARY VBoxOGL" 14 15 #print "DESCRIPTION \"\"" - warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored 15 print "EXPORTS"16 print("EXPORTS") 16 17 17 18 # XXX can't these values be automatically computed by analyzing parameters? … … 424 425 continue 425 426 try: 426 print "gl%s@%d = cr_gl%s" % (func_name,stack_sizes[func_name],func_name)427 print("gl%s@%d = cr_gl%s" % (func_name,stack_sizes[func_name],func_name)) 427 428 except KeyError: 428 429 pass … … 456 457 "wglGetPixelFormatAttribfvEXT", 457 458 "wglGetExtensionsStringEXT"): 458 print "%s = %s_prox" % (func_name,func_name)459 print("%s = %s_prox" % (func_name,func_name)) 459 460 460 461 """ … … 475 476 """ 476 477 477 print 478 print("""DrvCopyContext 478 479 DrvCreateContext 479 480 DrvCreateLayerContext … … 491 492 DrvSetContext@12 = DrvSetContext 492 493 DrvValidateVersion@4 = DrvValidateVersion 493 DrvSetPixelFormat@8 = DrvSetPixelFormat""" 494 495 print 494 DrvSetPixelFormat@8 = DrvSetPixelFormat""") 495 496 print("""crCreateContext 496 497 crMakeCurrent 497 498 crSwapBuffers … … 501 502 VBoxGetWindowId 502 503 VBoxGetContextId 503 VBoxFlushToHost""" 504 VBoxFlushToHost""") 504 505 #print "DllMain" -
trunk/src/VBox/Additions/common/crOpenGL/defs64.py
r48999 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 12 13 #print "LIBRARY VBoxOGL" 13 14 #print "DESCRIPTION \"\"" - warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored 14 print "EXPORTS"15 print("EXPORTS") 15 16 16 17 # XXX can't these values be automatically computed by analyzing parameters? … … 423 424 continue 424 425 if func_name in exports_special: 425 print "gl%s = cr_gl%s" % (func_name,func_name)426 print("gl%s = cr_gl%s" % (func_name,func_name)) 426 427 427 428 for func_name in ( "wglChoosePixelFormat", … … 453 454 "wglGetPixelFormatAttribfvEXT", 454 455 "wglGetExtensionsStringEXT"): 455 print "%s = %s_prox" % (func_name,func_name)456 457 print 456 print("%s = %s_prox" % (func_name,func_name)) 457 458 print("""DrvCopyContext 458 459 DrvCreateContext 459 460 DrvCreateLayerContext … … 471 472 DrvSetContext = DrvSetContext 472 473 DrvValidateVersion = DrvValidateVersion 473 DrvSetPixelFormat = DrvSetPixelFormat""" 474 475 print 474 DrvSetPixelFormat = DrvSetPixelFormat""") 475 476 print("""crCreateContext 476 477 crMakeCurrent 477 478 crSwapBuffers … … 481 482 VBoxGetWindowId 482 483 VBoxGetContextId 483 VBoxFlushToHost""" 484 VBoxFlushToHost""") 484 485 #print "DllMain" -
trunk/src/VBox/Additions/common/crOpenGL/entrypoints.py
r63205 r63939 11 11 12 12 13 from __future__ import print_function 13 14 import sys 14 15 … … 23 24 apiutil.CopyrightC() 24 25 25 print '#define GL_GLEXT_PROTOTYPES'26 print '#include <stdio.h>'27 print '#include <stdlib.h>'28 print '#include <GL/gl.h>'29 print '#include "chromium.h"'30 print '#include "stub.h"'31 print '#include "dri_glx.h"'32 print ''33 print '#ifdef __GNUC__';34 print '# if (__GNUC__ << 16) + __GNUC_MINOR__ >= 0x40002';35 print '# pragma GCC diagnostic ignored "-Wunused-parameter"';36 print '# endif';37 print '#endif';26 print('#define GL_GLEXT_PROTOTYPES') 27 print('#include <stdio.h>') 28 print('#include <stdlib.h>') 29 print('#include <GL/gl.h>') 30 print('#include "chromium.h"') 31 print('#include "stub.h"') 32 print('#include "dri_glx.h"') 33 print('') 34 print('#ifdef __GNUC__') 35 print('# if (__GNUC__ << 16) + __GNUC_MINOR__ >= 0x40002') 36 print('# pragma GCC diagnostic ignored "-Wunused-parameter"') 37 print('# endif') 38 print('#endif') 38 39 39 40 … … 53 54 54 55 if func_name in hacks: 55 print "/* hacked entrypoint: %s */" % func_name56 print("/* hacked entrypoint: %s */" % func_name) 56 57 if func_name == "TexImage3D": 57 58 # Pretty common: internalformat is GLenum, not GLint 58 print "void glTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels )"59 print "{"60 print "\tglim.TexImage3D( target, level, (GLint) internalformat, width, height, depth, border, format, type, pixels );"61 print "}"59 print("void glTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels )") 60 print("{") 61 print("\tglim.TexImage3D( target, level, (GLint) internalformat, width, height, depth, border, format, type, pixels );") 62 print("}") 62 63 elif func_name == "TexImage2D": 63 64 # Pretty common: internalformat is GLenum, not GLint 64 print "void glTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )"65 print "{"66 print "\tglim.TexImage2D( target, level, (GLint) internalformat, width, height, border, format, type, pixels );"67 print "}"65 print("void glTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )") 66 print("{") 67 print("\tglim.TexImage2D( target, level, (GLint) internalformat, width, height, border, format, type, pixels );") 68 print("}") 68 69 elif func_name == "TexImage1D": 69 70 # Pretty common: internalformat is GLenum, not GLint 70 print "void glTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels )"71 print "{"72 print "\tglim.TexImage1D( target, level, (GLint) internalformat, width, border, format, type, pixels );"73 print "}"71 print("void glTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels )") 72 print("{") 73 print("\tglim.TexImage1D( target, level, (GLint) internalformat, width, border, format, type, pixels );") 74 print("}") 74 75 elif func_name == "EdgeFlagPointer": 75 76 # second arg is GLboolean instead of GLvoid 76 print "void glEdgeFlagPointer( GLsizei stride, const GLboolean *pointer )"77 print "{"78 print "\tglim.EdgeFlagPointer( stride, pointer );"79 print "}"77 print("void glEdgeFlagPointer( GLsizei stride, const GLboolean *pointer )") 78 print("{") 79 print("\tglim.EdgeFlagPointer( stride, pointer );") 80 print("}") 80 81 elif func_name == "ProgramParameters4fvNV": 81 print "void glProgramParameters4fvNV( GLenum target, GLuint index, GLuint num, const GLfloat *params )"82 print "{"83 print "\tglim.ProgramParameters4fvNV( target, index, num, params );"84 print "}"82 print("void glProgramParameters4fvNV( GLenum target, GLuint index, GLuint num, const GLfloat *params )") 83 print("{") 84 print("\tglim.ProgramParameters4fvNV( target, index, num, params );") 85 print("}") 85 86 elif func_name == "MultiDrawElementsEXT": 86 print "void glMultiDrawElementsEXT(GLenum mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)"87 print "{"88 print "\tglim.MultiDrawElementsEXT(mode, count,type, indices, primcount);"89 print "}"87 print("void glMultiDrawElementsEXT(GLenum mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)") 88 print("{") 89 print("\tglim.MultiDrawElementsEXT(mode, count,type, indices, primcount);") 90 print("}") 90 91 elif func_name == "ProgramParameters4dvNV": 91 print "void glProgramParameters4dvNV( GLenum target, GLuint index, GLuint num, const GLdouble *params )"92 print "{"93 print "\tglim.ProgramParameters4dvNV( target, index, num, params );"94 print "}"92 print("void glProgramParameters4dvNV( GLenum target, GLuint index, GLuint num, const GLdouble *params )") 93 print("{") 94 print("\tglim.ProgramParameters4dvNV( target, index, num, params );") 95 print("}") 95 96 else: 96 97 # the usual path 97 print "%s VBOXGLTAG(gl%s)( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params))98 print ""99 print "%s VBOXGLTAG(gl%s)( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))100 print "{"101 print "\t",98 print("%s VBOXGLTAG(gl%s)( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params))) 99 print("") 100 print("%s VBOXGLTAG(gl%s)( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))) 101 print("{") 102 print("\t", end="") 102 103 if return_type != "void": 103 print "return ",104 print "glim.%s( %s );" % (func_name, apiutil.MakeCallString(params))105 print "}"106 print ""104 print("return ", end=" ") 105 print("glim.%s( %s );" % (func_name, apiutil.MakeCallString(params))) 106 print("}") 107 print("") 107 108 108 print '/*'109 print '* Aliases'110 print '*/'109 print('/*') 110 print('* Aliases') 111 print('*/') 111 112 112 113 # Now loop over all the functions and take care of any aliases … … 124 125 if alias: 125 126 if func_name in hacks: 126 print "/* hacked entrypoint: %s */" % func_name127 print("/* hacked entrypoint: %s */" % func_name) 127 128 if func_name == "MultiDrawArrays": 128 print "void glMultiDrawArrays( GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount )"129 print "{"130 print "\tglim.MultiDrawArraysEXT( mode, (GLint*)first, (GLsizei*)count, primcount );"131 print "}"129 print("void glMultiDrawArrays( GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount )") 130 print("{") 131 print("\tglim.MultiDrawArraysEXT( mode, (GLint*)first, (GLsizei*)count, primcount );") 132 print("}") 132 133 elif func_name == "BufferData": 133 print "void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)"134 print "{"135 print "\tglim.BufferDataARB(target, size, data, usage);"136 print "}"134 print("void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)") 135 print("{") 136 print("\tglim.BufferDataARB(target, size, data, usage);") 137 print("}") 137 138 elif func_name == "BufferSubData": 138 print "void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)"139 print "{"140 print "\tglim.BufferSubDataARB(target, offset, size, data);"141 print "}"139 print("void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)") 140 print("{") 141 print("\tglim.BufferSubDataARB(target, offset, size, data);") 142 print("}") 142 143 elif func_name == "GetBufferSubData": 143 print "void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)"144 print "{"145 print "\tglim.GetBufferSubDataARB(target, offset, size, data);"146 print "}"144 print("void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)") 145 print("{") 146 print("\tglim.GetBufferSubDataARB(target, offset, size, data);") 147 print("}") 147 148 else: 148 149 return_type = apiutil.ReturnType(func_name) 149 150 params = apiutil.Parameters(func_name) 150 print "%s VBOXGLTAG(gl%s)( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params))151 print ""152 print "%s VBOXGLTAG(gl%s)( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))153 print "{"154 print "\t",151 print("%s VBOXGLTAG(gl%s)( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params))) 152 print("") 153 print("%s VBOXGLTAG(gl%s)( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))) 154 print("{") 155 print("\t", end="") 155 156 if return_type != "void": 156 print "return ",157 print "glim.%s( %s );" % (alias, apiutil.MakeCallString(params))158 print "}"159 print ""157 print("return ", end=" ") 158 print("glim.%s( %s );" % (alias, apiutil.MakeCallString(params))) 159 print("}") 160 print("") 160 161 161 print '/*'162 print '* No-op stubs'163 print '*/'162 print('/*') 163 print('* No-op stubs') 164 print('*/') 164 165 165 166 # Now generate no-op stub functions … … 169 170 params = apiutil.Parameters(func_name) 170 171 171 print "%s VBOXGLTAG(gl%s)( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params))172 print ""173 print "%s VBOXGLTAG(gl%s)( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))174 print "{"172 print("%s VBOXGLTAG(gl%s)( %s );" % (return_type, func_name, apiutil.MakeDeclarationString(params))) 173 print("") 174 print("%s VBOXGLTAG(gl%s)( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))) 175 print("{") 175 176 if return_type != "void": 176 print "return (%s) 0" % return_type177 print "}"178 print ""177 print("return (%s) 0" % return_type) 178 print("}") 179 print("") 179 180 180 181 -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedback.py
r17269 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(""" 14 15 /* DO NOT EDIT - generated by feedback.py */ 15 16 #include <stdio.h> … … 20 21 #include "cr_glstate.h" 21 22 22 """ 23 """) 23 24 24 25 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 28 29 params = apiutil.Parameters(func_name) 29 30 if apiutil.FindSpecial( "feedback", func_name ): 30 print 'static %s FEEDBACKSPU_APIENTRY feedbackspu_%s( %s )' % ( return_type, func_name, apiutil.MakeDeclarationString(params))31 print '{'32 print '\tfeedback_spu.super.%s( %s );' % ( func_name, apiutil.MakeCallString(params))33 print '}'34 35 36 37 print 31 print('static %s FEEDBACKSPU_APIENTRY feedbackspu_%s( %s )' % ( return_type, func_name, apiutil.MakeDeclarationString(params) )) 32 print('{') 33 print('\tfeedback_spu.super.%s( %s );' % ( func_name, apiutil.MakeCallString(params) )) 34 print('}') 35 36 37 38 print(""" 38 39 #define CHANGE( name, func ) crSPUChangeInterface( (void *)&(feedback_spu.self), (void *)feedback_spu.self.name, (void *)((SPUGenericFunction) func) ) 39 40 #define CHANGESWAP( name, swapfunc, regfunc ) crSPUChangeInterface( (void *)&(feedback_spu.self), (void *)feedback_spu.self.name, (void *)((SPUGenericFunction) (feedback_spu.swap ? swapfunc: regfunc )) ) … … 41 42 static void __loadFeedbackAPI( void ) 42 43 { 43 """ 44 """) 44 45 for func_name in keys: 45 46 return_type = apiutil.ReturnType(func_name) 46 47 params = apiutil.Parameters(func_name) 47 48 if apiutil.FindSpecial( "feedback", func_name ): 48 print '\tCHANGE( %s, crStateFeedback%s );' % (func_name, func_name)49 print 49 print('\tCHANGE( %s, crStateFeedback%s );' % (func_name, func_name )) 50 print(""" 50 51 } 51 52 52 53 static void __loadSelectAPI( void ) 53 54 { 54 """ 55 """) 55 56 for func_name in keys: 56 57 if apiutil.FindSpecial( "select", func_name ): 57 print '\tCHANGE( %s, crStateSelect%s );' % (func_name, func_name)58 print('\tCHANGE( %s, crStateSelect%s );' % (func_name, func_name )) 58 59 elif apiutil.FindSpecial( "feedback", func_name ): 59 print '\tCHANGE( %s, feedbackspu_%s );' % (func_name, func_name)60 print 60 print('\tCHANGE( %s, feedbackspu_%s );' % (func_name, func_name )) 61 print(""" 61 62 } 62 63 63 64 static void __loadRenderAPI( void ) 64 65 { 65 """ 66 """) 66 67 67 68 for func_name in keys: 68 69 return_type = apiutil.ReturnType(func_name) 69 70 if apiutil.FindSpecial( "feedback", func_name ) or apiutil.FindSpecial( "select", func_name ): 70 print '\tCHANGE( %s, feedbackspu_%s );' % (func_name, func_name)71 print 72 } 73 """ 74 75 print 71 print('\tCHANGE( %s, feedbackspu_%s );' % (func_name, func_name )) 72 print(""" 73 } 74 """) 75 76 print(""" 76 77 static GLint FEEDBACKSPU_APIENTRY feedbackspu_RenderMode ( GLenum mode ) 77 78 { … … 211 212 212 213 SPUNamedFunctionTable _cr_feedback_table[] = { 213 """ 214 """) 214 215 215 216 for func_name in keys: 216 217 if apiutil.FindSpecial( "feedback_state", func_name ): 217 print '\t{ "%s", (SPUGenericFunction) feedbackspu_%s }, ' % ( func_name, func_name)218 print 218 print('\t{ "%s", (SPUGenericFunction) feedbackspu_%s }, ' % ( func_name, func_name )) 219 print(""" 219 220 { "GetBooleanv", (SPUGenericFunction) feedbackspu_GetBooleanv }, 220 221 { "GetDoublev", (SPUGenericFunction) feedbackspu_GetDoublev }, … … 267 268 { NULL, NULL } 268 269 }; 269 """ 270 """) -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedback_funcs.py
r17269 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(""" 14 15 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY feedback_funcs.py SCRIPT */ 15 16 #ifndef CR_STATE_FEEDBACK_FUNCS_H … … 24 25 #endif 25 26 26 #define STATE_UNUSED(x) ((void)x)""" 27 #define STATE_UNUSED(x) ((void)x)""") 27 28 28 29 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 31 32 return_type = apiutil.ReturnType(func_name) 32 33 params = apiutil.Parameters(func_name) 33 print '%s STATE_APIENTRY crStateFeedback%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))34 print('%s STATE_APIENTRY crStateFeedback%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 34 35 35 36 for func_name in apiutil.AllSpecials( "select" ): 36 37 return_type = apiutil.ReturnType(func_name) 37 38 params = apiutil.Parameters(func_name) 38 print '%s STATE_APIENTRY crStateSelect%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))39 print '\n#endif /* CR_STATE_FEEDBACK_FUNCS_H */'39 print('%s STATE_APIENTRY crStateSelect%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 40 print('\n#endif /* CR_STATE_FEEDBACK_FUNCS_H */') -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedback_state.py
r42499 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(""" 14 15 #include "cr_server.h" 15 16 #include "feedbackspu.h" 16 17 #include "feedbackspu_proto.h" 17 """ 18 """) 18 19 custom = ["CreateContext", "VBoxCreateContext", "MakeCurrent", "DestroyContext"] 19 20 … … 26 27 return_type = apiutil.ReturnType(func_name) 27 28 params = apiutil.Parameters(func_name) 28 print '%s FEEDBACKSPU_APIENTRY feedbackspu_%s( %s )' % (return_type, func_name, apiutil.MakeDeclarationString(params))29 print '{'30 print '\tcrState%s( %s );' % (func_name, apiutil.MakeCallString(params))31 print ''32 print '\tfeedback_spu.super.%s( %s );' % (func_name, apiutil.MakeCallString(params))33 print '}'29 print('%s FEEDBACKSPU_APIENTRY feedbackspu_%s( %s )' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 30 print('{') 31 print('\tcrState%s( %s );' % (func_name, apiutil.MakeCallString(params))) 32 print('') 33 print('\tfeedback_spu.super.%s( %s );' % (func_name, apiutil.MakeCallString(params))) 34 print('}') -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_proto.py
r17269 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(""" 14 15 /* DO NOT EDIT - generated by feedback.py */ 15 16 … … 19 20 #include "feedbackspu.h" 20 21 21 """ 22 """) 22 23 23 24 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 27 28 return_type = apiutil.ReturnType(func_name) 28 29 params = apiutil.Parameters(func_name) 29 print 'extern %s FEEDBACKSPU_APIENTRY feedbackspu_%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))30 print('extern %s FEEDBACKSPU_APIENTRY feedbackspu_%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 30 31 31 32 32 print 33 print(""" 33 34 #endif 34 """ 35 """) -
trunk/src/VBox/Additions/common/crOpenGL/getprocaddress.py
r51200 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 /* DO NOT EDIT - THIS FILE GENERATED BY THE getprocaddress.py SCRIPT */ 14 15 … … 30 31 31 32 static struct name_address functions[] = { 32 """ 33 """) 33 34 34 35 … … 48 49 address = "VBOXGLTAG(gl" + func_name + ")" 49 50 if wrap: 50 print '#ifdef CR_%s' % wrap51 print '\t{ "%s", (CR_PROC) %s },' % (name, address)51 print('#ifdef CR_%s' % wrap) 52 print('\t{ "%s", (CR_PROC) %s },' % (name, address)) 52 53 if wrap: 53 print '#endif'54 print('#endif') 54 55 55 56 56 print "\t/* Chromium binding/glue functions */"57 print("\t/* Chromium binding/glue functions */") 57 58 58 59 for func_name in keys: … … 63 64 continue 64 65 if apiutil.Category(func_name) == "Chromium": 65 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)66 print('\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)) 66 67 67 68 68 print 69 print(""" 69 70 { NULL, NULL } 70 71 }; … … 102 103 } 103 104 104 """ 105 """) 105 106 106 107 -
trunk/src/VBox/Additions/common/crOpenGL/pack/pack.py
r20083 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 14 15 apiutil.CopyrightC() 15 16 16 print 17 print(""" 17 18 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY pack.py SCRIPT */ 18 19 #include <stdio.h> … … 22 23 #include "cr_packfunctions.h" 23 24 #include "packspu_proto.h" 24 """ 25 """) 25 26 26 27 num_funcs = len(keys) - len(apiutil.AllSpecials('packspu_unimplemented')) 27 print 'SPUNamedFunctionTable _cr_pack_table[%d];' % (num_funcs+1)28 print('SPUNamedFunctionTable _cr_pack_table[%d];' % (num_funcs+1)) 28 29 29 print 30 print(""" 30 31 static void __fillin( int offset, char *name, SPUGenericFunction func ) 31 32 { 32 33 _cr_pack_table[offset].name = crStrdup( name ); 33 34 _cr_pack_table[offset].fn = func; 34 }""" 35 }""") 35 36 36 37 pack_specials = [] … … 43 44 pack_specials.append( func_name ) 44 45 45 print '\nvoid packspuCreateFunctions( void )'46 print '{'46 print('\nvoid packspuCreateFunctions( void )') 47 print('{') 47 48 for index in range(len(keys)): 48 49 func_name = keys[index] … … 50 51 continue 51 52 if func_name in pack_specials: 52 print '\t__fillin( %3d, "%s", (SPUGenericFunction) packspu_%s );' % (index, func_name, func_name)53 print('\t__fillin( %3d, "%s", (SPUGenericFunction) packspu_%s );' % (index, func_name, func_name )) 53 54 else: 54 print '\t__fillin( %3d, "%s", (SPUGenericFunction) (pack_spu.swap ? crPack%sSWAP : crPack%s) );' % (index, func_name, func_name, func_name)55 print '\t__fillin( %3d, NULL, NULL );' % num_funcs56 print '}'55 print('\t__fillin( %3d, "%s", (SPUGenericFunction) (pack_spu.swap ? crPack%sSWAP : crPack%s) );' % (index, func_name, func_name, func_name )) 56 print('\t__fillin( %3d, NULL, NULL );' % num_funcs) 57 print('}') -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py
r63206 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print("""/* DO NOT EDIT - AUTOMATICALLY GENERATED BY packspu_beginend.py */ 14 15 #include "packspu.h" 15 16 #include "assert.h" … … 157 158 DoVertex(); 158 159 } 159 """ 160 """) 160 161 161 162 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 163 164 for func_name in apiutil.AllSpecials( "packspu_vertex" ): 164 165 params = apiutil.Parameters(func_name) 165 print 'void PACKSPU_APIENTRY packspu_%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))166 print '{'167 print '\tif (pack_spu.swap)'168 print '\t{'169 print '\t\tcrPack%sSWAP( %s );' % ( func_name, apiutil.MakeCallString( params ))170 print '\t}'171 print '\telse'172 print '\t{'173 print '\t\tcrPack%s( %s );' % ( func_name, apiutil.MakeCallString( params ))174 print '\t}'175 print '\tRunState();'176 print '}'166 print('void PACKSPU_APIENTRY packspu_%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params) )) 167 print('{') 168 print('\tif (pack_spu.swap)') 169 print('\t{') 170 print('\t\tcrPack%sSWAP( %s );' % ( func_name, apiutil.MakeCallString( params ) )) 171 print('\t}') 172 print('\telse') 173 print('\t{') 174 print('\t\tcrPack%s( %s );' % ( func_name, apiutil.MakeCallString( params ) )) 175 print('\t}') 176 print('\tRunState();') 177 print('}') -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_flush.py
r20083 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(""" 14 15 /* DO NOT EDIT - this file generated by packspu_flush.py script */ 15 16 … … 21 22 #include "packspu.h" 22 23 #include "packspu_proto.h" 23 """ 24 """) 24 25 25 26 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 27 28 for func_name in apiutil.AllSpecials( "packspu_flush" ): 28 29 params = apiutil.Parameters(func_name) 29 print 'void PACKSPU_APIENTRY packspu_%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))30 print '{'31 print '\tGET_THREAD(thread);'32 print '\tif (pack_spu.swap)'33 print '\t{'34 print '\t\tcrPack%sSWAP( %s );' % ( func_name, apiutil.MakeCallString( params ))35 print '\t}'36 print '\telse'37 print '\t{'38 print '\t\tcrPack%s( %s );' % ( func_name, apiutil.MakeCallString( params ))39 print '\t}'40 print '\tpackspuFlush( (void *) thread );'41 print '}\n'30 print('void PACKSPU_APIENTRY packspu_%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))) 31 print('{') 32 print('\tGET_THREAD(thread);') 33 print('\tif (pack_spu.swap)') 34 print('\t{') 35 print('\t\tcrPack%sSWAP( %s );' % ( func_name, apiutil.MakeCallString( params ) )) 36 print('\t}') 37 print('\telse') 38 print('\t{') 39 print('\t\tcrPack%s( %s );' % ( func_name, apiutil.MakeCallString( params ) )) 40 print('\t}') 41 print('\tpackspuFlush( (void *) thread );') 42 print('}\n') -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
r63206 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(""" 14 15 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY packspu_get.py SCRIPT */ 15 16 #include "packspu.h" … … 18 19 #include "cr_mem.h" 19 20 #include "packspu_proto.h" 20 """ 21 22 print 21 """) 22 23 print(""" 23 24 static GLboolean crPackIsPixelStoreParm(GLenum pname) 24 25 { … … 46 47 return GL_FALSE; 47 48 } 48 """ 49 """) 49 50 50 51 from get_sizes import * … … 85 86 86 87 if "get" in apiutil.Properties(func_name): 87 print '%s PACKSPU_APIENTRY packspu_%s( %s )' % ( return_type, func_name, apiutil.MakeDeclarationString( params ))88 print '{'89 print '\tGET_THREAD(thread);'90 print '\tint writeback = 1;'88 print('%s PACKSPU_APIENTRY packspu_%s( %s )' % ( return_type, func_name, apiutil.MakeDeclarationString( params ) )) 89 print('{') 90 print('\tGET_THREAD(thread);') 91 print('\tint writeback = 1;') 91 92 if return_type != 'void': 92 print '\t%s return_val = (%s) 0;' % (return_type, return_type)93 print('\t%s return_val = (%s) 0;' % (return_type, return_type)) 93 94 params.append( ("&return_val", "foo", 0) ) 94 if (func_name in easy_swaps .keys() and easy_swaps[func_name] != '0') or func_name in simple_funcs or func_name in hard_funcs.keys():95 print '\tunsigned int i;'96 print '\tif (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))'97 print '\t{'98 print '\t\tcrError( "packspu_%s doesn\'t work when there\'s no actual network involved!\\nTry using the simplequery SPU in your chain!" );' % func_name99 print '\t}'95 if (func_name in easy_swaps and easy_swaps[func_name] != '0') or func_name in simple_funcs or func_name in hard_funcs: 96 print('\tunsigned int i;') 97 print('\tif (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))') 98 print('\t{') 99 print('\t\tcrError( "packspu_%s doesn\'t work when there\'s no actual network involved!\\nTry using the simplequery SPU in your chain!" );' % func_name) 100 print('\t}') 100 101 if func_name in simple_funcs: 101 print 102 print(""" 102 103 if (crPackIsPixelStoreParm(pname) 103 104 || pname == GL_DRAW_BUFFER … … 162 163 163 164 } 164 """ % (params[-1][1], params[-1][1], func_name, func_name, apiutil.MakeCallString(params), func_name, func_name) 165 """ % (params[-1][1], params[-1][1], func_name, func_name, apiutil.MakeCallString(params), func_name, func_name)) 165 166 166 167 if func_name in vertattr_get_funcs: 167 print 168 print(""" 168 169 if (pname != GL_CURRENT_VERTEX_ATTRIB_ARB) 169 170 { … … 189 190 return; 190 191 } 191 """ % (params[-1][1], params[-1][1], func_name, func_name, apiutil.MakeCallString(params), func_name, func_name) 192 """ % (params[-1][1], params[-1][1], func_name, func_name, apiutil.MakeCallString(params), func_name, func_name)) 192 193 193 194 params.append( ("&writeback", "foo", 0) ) 194 print '\tif (pack_spu.swap)'195 print '\t{'196 print '\t\tcrPack%sSWAP( %s );' % (func_name, apiutil.MakeCallString( params ))197 print '\t}'198 print '\telse'199 print '\t{'200 print '\t\tcrPack%s( %s );' % (func_name, apiutil.MakeCallString( params ))201 print '\t}'202 print '\tpackspuFlush( (void *) thread );'203 print '\tCRPACKSPU_WRITEBACK_WAIT(thread, writeback);'195 print('\tif (pack_spu.swap)') 196 print('\t{') 197 print('\t\tcrPack%sSWAP( %s );' % (func_name, apiutil.MakeCallString( params ) )) 198 print('\t}') 199 print('\telse') 200 print('\t{') 201 print('\t\tcrPack%s( %s );' % (func_name, apiutil.MakeCallString( params ) )) 202 print('\t}') 203 print('\tpackspuFlush( (void *) thread );') 204 print('\tCRPACKSPU_WRITEBACK_WAIT(thread, writeback);') 204 205 205 206 … … 207 208 lastParamName = params[-2][0] 208 209 if return_type != 'void': 209 print '\tif (pack_spu.swap)'210 print '\t{'211 print '\t\treturn_val = (%s) SWAP32(return_val);' % return_type212 print '\t}'213 print '\treturn return_val;'214 if func_name in easy_swaps .keys()and easy_swaps[func_name] != '0':210 print('\tif (pack_spu.swap)') 211 print('\t{') 212 print('\t\treturn_val = (%s) SWAP32(return_val);' % return_type) 213 print('\t}') 214 print('\treturn return_val;') 215 if func_name in easy_swaps and easy_swaps[func_name] != '0': 215 216 limit = easy_swaps[func_name] 216 print '\tif (pack_spu.swap)'217 print '\t{'218 print '\t\tfor (i = 0 ; i < %s ; i++)' % limit219 print '\t\t{'217 print('\tif (pack_spu.swap)') 218 print('\t{') 219 print('\t\tfor (i = 0 ; i < %s ; i++)' % limit) 220 print('\t\t{') 220 221 if params[-2][1].find( "double" ) > -1: 221 print '\t\t\t%s[i] = SWAPDOUBLE(%s[i]);' % (lastParamName, lastParamName)222 print('\t\t\t%s[i] = SWAPDOUBLE(%s[i]);' % (lastParamName, lastParamName)) 222 223 else: 223 print '\t\t\t%s[i] = SWAP32(%s[i]);' % (lastParamName, lastParamName)224 print '\t\t}'225 print '\t}'224 print('\t\t\t%s[i] = SWAP32(%s[i]);' % (lastParamName, lastParamName)) 225 print('\t\t}') 226 print('\t}') 226 227 for index in range(len(simple_funcs)): 227 228 if simple_funcs[index] == func_name: 228 print '\tif (pack_spu.swap)'229 print '\t{'230 print '\t\tfor (i = 0 ; i < __numValues( pname ) ; i++)'231 print '\t\t{'229 print('\tif (pack_spu.swap)') 230 print('\t{') 231 print('\t\tfor (i = 0 ; i < __numValues( pname ) ; i++)') 232 print('\t\t{') 232 233 if simple_swaps[index] == 'SWAPDOUBLE': 233 print '\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName)234 print('\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName)) 234 235 else: 235 print '\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName)236 print '\t\t}'237 print '\t}'238 if func_name in hard_funcs .keys():239 print '\tif (pack_spu.swap)'240 print '\t{'241 print '\t\tfor (i = 0 ; i < crStateHlpComponentsCount(pname) ; i++)'242 print '\t\t{'236 print('\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName)) 237 print('\t\t}') 238 print('\t}') 239 if func_name in hard_funcs: 240 print('\tif (pack_spu.swap)') 241 print('\t{') 242 print('\t\tfor (i = 0 ; i < crStateHlpComponentsCount(pname) ; i++)') 243 print('\t\t{') 243 244 if hard_funcs[func_name] == 'SWAPDOUBLE': 244 print '\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName)245 print('\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName)) 245 246 else: 246 print '\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName)247 print '\t\t}'248 print '\t}'249 print '}\n'247 print('\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName)) 248 print('\t\t}') 249 print('\t}') 250 print('}\n') -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_proto.py
r20083 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY packspu_proto.py SCRIPT */ 14 15 … … 21 22 #include "packspu.h" 22 23 #include "cr_packfunctions.h" 23 """ 24 """) 24 25 25 26 … … 42 43 return_type = apiutil.ReturnType(func_name) 43 44 params = apiutil.Parameters(func_name) 44 print 'extern %s PACKSPU_APIENTRY packspu_%s( %s );' % ( return_type, func_name, apiutil.MakeDeclarationString(params))45 print('extern %s PACKSPU_APIENTRY packspu_%s( %s );' % ( return_type, func_name, apiutil.MakeDeclarationString(params) )) 45 46 46 47 47 print 48 print(""" 48 49 #endif 49 """ 50 """) -
trunk/src/VBox/Additions/common/crOpenGL/passthrough/passthrough.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print("""#include <stdio.h> 14 15 #include "cr_error.h" 15 16 #include "cr_string.h" 16 17 #include "cr_spu.h" 17 18 #include "passthroughspu.h" 18 """ 19 """) 19 20 20 21 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 21 22 22 23 23 print 'SPUNamedFunctionTable _cr_passthrough_table[%d];' % ( len(keys) + 1)24 print('SPUNamedFunctionTable _cr_passthrough_table[%d];' % ( len(keys) + 1 )) 24 25 25 print 26 print(""" 26 27 static void __fillin( int offset, char *name, SPUGenericFunction func ) 27 28 { … … 31 32 32 33 void BuildPassthroughTable( SPU *child ) 33 {""" 34 {""") 34 35 35 36 for index in range(len(keys)): 36 37 func_name = keys[index] 37 print '\t__fillin( %3d, "%s", (SPUGenericFunction) child->dispatch_table.%s );' % (index, func_name, func_name)38 print '\t__fillin( %3d, NULL, NULL );' % len(keys)39 print '}'38 print('\t__fillin( %3d, "%s", (SPUGenericFunction) child->dispatch_table.%s );' % (index, func_name, func_name )) 39 print('\t__fillin( %3d, NULL, NULL );' % len(keys)) 40 print('}') -
trunk/src/VBox/Additions/common/crOpenGL/stub_common.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 curver = sys.version_info[0] + sys.version_info[1]/10.0 8 9 if curver < 2.2: 9 print >>sys.stderr, "Your python is version %g. Chromium requires at least"%(curver)10 print >>sys.stderr, "version 2.2. Please upgrade your python installation."10 print("Your python is version %g. Chromium requires at least"%(curver), file=sys.stderr) 11 print("version 2.2. Please upgrade your python installation.", file=sys.stderr) 11 12 sys.exit(1) 12 13 … … 15 16 16 17 def CopyrightC( ): 17 print 18 print("""/* Copyright (c) 2001, Stanford University 18 19 All rights reserved. 19 20 20 21 See the file LICENSE.txt for information on redistributing this software. */ 21 """ 22 """) 22 23 23 24 def CopyrightDef( ): 24 print 25 print("""; Copyright (c) 2001, Stanford University 25 26 ; All rights reserved. 26 27 ; 27 28 ; See the file LICENSE.txt for information on redistributing this software. 28 """ 29 """) 29 30 30 31 def DecoderName( glName ): … … 101 102 return [] 102 103 103 keys = subtable.keys() 104 keys.sort() 105 return keys 104 return sorted(subtable.keys()) 106 105 107 106 def FindAnnotation( filename, key, subkey ): … … 167 166 table = LoadSpecials( filename ) 168 167 169 keys = table.keys() 170 keys.sort() 171 return keys 168 return sorted(table.keys()) 172 169 173 170 def AllSpecials( table_file ): … … 180 177 table = LoadSpecials(filename) 181 178 182 ret = table.keys() 183 ret.sort() 184 return ret 179 return sorted(table.keys()) 185 180 186 181 def NumSpecials( table_file ): -
trunk/src/VBox/Additions/common/crOpenGL/tsfuncs.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(""" 14 15 /* DO NOT EDIT - THIS FILE GENERATED BY THE tsfuncs.py SCRIPT */ 15 16 16 17 #include "stub.h" 17 """ 18 """) 18 19 19 20 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 23 24 params = apiutil.Parameters(func_name) 24 25 25 print "static %s SPULOAD_APIENTRY ts_%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))26 print "{"27 print "\tSPUDispatchTable *tab = (SPUDispatchTable *) crGetTSD(&stub.dispatchTSD);"26 print("static %s SPULOAD_APIENTRY ts_%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params) )) 27 print("{") 28 print("\tSPUDispatchTable *tab = (SPUDispatchTable *) crGetTSD(&stub.dispatchTSD);") 28 29 29 30 if return_type != "void": 30 print "\treturn ",31 print("\treturn ", end=" ") 31 32 32 print "\ttab->%s( %s );" % (func_name, apiutil.MakeCallString(params))33 print "}"34 print ""33 print("\ttab->%s( %s );" % (func_name, apiutil.MakeCallString(params))) 34 print("}") 35 print("") 35 36 36 37 37 print "SPUDispatchTable stubThreadsafeDispatch = {"38 print("SPUDispatchTable stubThreadsafeDispatch = {") 38 39 39 40 for func_name in keys: 40 print "\tts_%s," % func_name41 print("\tts_%s," % func_name) 41 42 42 print "\tNULL, /* copyList */"43 print "\tNULL, /* copy_of */"44 print "\t0, /* mark */"45 print "\tNULL /* server */"46 print "};"43 print("\tNULL, /* copyList */") 44 print("\tNULL, /* copy_of */") 45 print("\t0, /* mark */") 46 print("\tNULL /* server */") 47 print("};") -
trunk/src/VBox/Additions/common/crOpenGL/windows_exports.py
r30457 r63939 5 5 6 6 7 from __future__ import print_function 7 8 import sys 8 9 … … 14 15 apiutil.CopyrightC() 15 16 16 print '#include "chromium.h"'17 print '#include "stub.h"'18 print ''19 print '#define NAKED __declspec(naked)'20 print '#define UNUSED(x) ((void)(x))'21 print ''17 print('#include "chromium.h"') 18 print('#include "stub.h"') 19 print('') 20 print('#define NAKED __declspec(naked)') 21 print('#define UNUSED(x) ((void)(x))') 22 print('') 22 23 23 24 … … 37 38 params = apiutil.Parameters(func_name) 38 39 39 print 40 apiutil.MakeDeclarationString( params )) 41 print "{"42 print "\t__asm jmp [glim.%s]" % func_name40 print("NAKED %s cr_gl%s( %s )" % (return_type, func_name, 41 apiutil.MakeDeclarationString( params ))) 42 print("{") 43 print("\t__asm jmp [glim.%s]" % func_name) 43 44 for (name, type, vecSize) in params: 44 print "\tUNUSED( %s );" % name45 print "}"46 print ""45 print("\tUNUSED( %s );" % name) 46 print("}") 47 print("") 47 48 48 print '/*'49 print '* Aliases'50 print '*/'49 print('/*') 50 print('* Aliases') 51 print('*/') 51 52 52 53 # Now loop over all the functions and take care of any aliases … … 65 66 return_type = apiutil.ReturnType(func_name) 66 67 params = apiutil.Parameters(func_name) 67 print 68 apiutil.MakeDeclarationString( params )) 69 print "{"70 print "\t__asm jmp [glim.%s]" % alias68 print("NAKED %s cr_gl%s( %s )" % (return_type, func_name, 69 apiutil.MakeDeclarationString( params ))) 70 print("{") 71 print("\t__asm jmp [glim.%s]" % alias) 71 72 for (name, type, vecSize) in params: 72 print "\tUNUSED( %s );" % name73 print "}"74 print ""73 print("\tUNUSED( %s );" % name) 74 print("}") 75 print("") 75 76 76 77 77 print '/*'78 print '* No-op stubs'79 print '*/'78 print('/*') 79 print('* No-op stubs') 80 print('*/') 80 81 81 82 # Now generate no-op stub functions … … 84 85 return_type = apiutil.ReturnType(func_name) 85 86 params = apiutil.Parameters(func_name) 86 print "NAKED %s cr_gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))87 print "{"87 print("NAKED %s cr_gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))) 88 print("{") 88 89 if return_type != "void": 89 print "return (%s) 0" % return_type90 print "}"91 print ""90 print("return (%s) 0" % return_type) 91 print("}") 92 print("") 92 93 93 94 -
trunk/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py
r51200 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 /* DO NOT EDIT - THIS FILE GENERATED BY THE getprocaddress.py SCRIPT */ 14 15 #include "chromium.h" … … 24 25 #endif 25 26 26 """ 27 """) 27 28 28 print 29 print(""" 29 30 struct name_address { 30 31 const char *name; … … 35 36 36 37 static struct name_address functions[] = { 37 """ 38 """) 38 39 39 40 … … 60 61 address = "cr_gl" + proc_name 61 62 if wrap: 62 print '#ifdef CR_%s' % wrap63 print '\t{ "%s", (CR_PROC) %s },' % (name, address)63 print('#ifdef CR_%s' % wrap) 64 print('\t{ "%s", (CR_PROC) %s },' % (name, address)) 64 65 if wrap: 65 print '#endif'66 print('#endif') 66 67 67 68 68 print "\t/* Chromium binding/glue functions */"69 print("\t/* Chromium binding/glue functions */") 69 70 70 71 for func_name in keys: … … 75 76 continue 76 77 if apiutil.Category(func_name) == "Chromium": 77 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)78 print('\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)) 78 79 79 print "\t/* Windows ICD functions */"80 print("\t/* Windows ICD functions */") 80 81 81 82 for func_name in ( "CopyContext", … … 95 96 "SetContext", 96 97 "ValidateVersion"): 97 print '\t{ "Drv%s", (CR_PROC) Drv%s },' % (func_name, func_name)98 print('\t{ "Drv%s", (CR_PROC) Drv%s },' % (func_name, func_name)) 98 99 99 print '\t{ "DrvGetProcAddress", (CR_PROC) wglGetProcAddress_prox },'100 print('\t{ "DrvGetProcAddress", (CR_PROC) wglGetProcAddress_prox },') 100 101 101 print 102 print(""" 102 103 { NULL, NULL } 103 104 }; … … 149 150 } 150 151 151 """ 152 """) 152 153 153 154 -
trunk/src/VBox/Additions/common/crOpenGL/windows_i386_exports.py
r30457 r63939 5 5 6 6 7 from __future__ import print_function 7 8 import sys 8 9 … … 13 14 14 15 #apiutil.CopyrightC() 15 print '%include "iprt/asmdefs.mac"'16 print ""17 print "%ifdef RT_ARCH_AMD64"18 print "extern glim"19 print "%else ; X86"20 print "extern _glim"21 print "%endif"22 print ""16 print('%include "iprt/asmdefs.mac"') 17 print("") 18 print("%ifdef RT_ARCH_AMD64") 19 print("extern glim") 20 print("%else ; X86") 21 print("extern _glim") 22 print("%endif") 23 print("") 23 24 24 25 # Get sorted list of dispatched functions. … … 34 35 continue 35 36 36 print "BEGINPROC_EXPORTED cr_gl%s" % func_name37 print "%ifdef RT_ARCH_AMD64"38 print "\tmov \trax, qword glim+%d" % (8*index)39 print "\tjmp \t[rax]"40 print "%else ; X86"41 print "\tmov \teax, dword _glim+%d" % (4*index)42 print "\tjmp \t[eax]"43 print "%endif"44 print "ENDPROC cr_gl%s" % func_name45 print ""37 print("BEGINPROC_EXPORTED cr_gl%s" % func_name) 38 print("%ifdef RT_ARCH_AMD64") 39 print("\tmov \trax, qword glim+%d" % (8*index)) 40 print("\tjmp \t[rax]") 41 print("%else ; X86") 42 print("\tmov \teax, dword _glim+%d" % (4*index)) 43 print("\tjmp \t[eax]") 44 print("%endif") 45 print("ENDPROC cr_gl%s" % func_name) 46 print("") 46 47 47 48 48 print ';'49 print '; Aliases'50 print ';'49 print(';') 50 print('; Aliases') 51 print(';') 51 52 52 53 # Now loop over all the functions and take care of any aliases … … 65 66 # this dict lookup should never fail (raise an exception)! 66 67 index = keys.index(alias) 67 print "BEGINPROC_EXPORTED cr_gl%s" % func_name68 print "%ifdef RT_ARCH_AMD64"69 print "\tmov \trax, qword glim+%d" % (8*index)70 print "\tjmp \t[rax]"71 print "%else ; X86"72 print "\tmov \teax, dword _glim+%d" % (4*index)73 print "\tjmp \t[eax]"74 print "%endif"75 print "ENDPROC cr_gl%s" % func_name76 print ""68 print("BEGINPROC_EXPORTED cr_gl%s" % func_name) 69 print("%ifdef RT_ARCH_AMD64") 70 print("\tmov \trax, qword glim+%d" % (8*index)) 71 print("\tjmp \t[rax]") 72 print("%else ; X86") 73 print("\tmov \teax, dword _glim+%d" % (4*index)) 74 print("\tjmp \t[eax]") 75 print("%endif") 76 print("ENDPROC cr_gl%s" % func_name) 77 print("") 77 78 78 79 79 print ';'80 print '; No-op stubs'81 print ';'80 print(';') 81 print('; No-op stubs') 82 print(';') 82 83 83 84 # Now generate no-op stub functions 84 85 for func_name in allkeys: 85 86 if "stub" in apiutil.ChromiumProps(func_name): 86 print "BEGINPROC_EXPORTED cr_gl%s" % func_name87 print "\tleave"88 print "\tret"89 print "ENDPROC cr_gl%s" % func_name90 print ""87 print("BEGINPROC_EXPORTED cr_gl%s" % func_name) 88 print("\tleave") 89 print("\tret") 90 print("ENDPROC cr_gl%s" % func_name) 91 print("") 91 92 92 93 -
trunk/src/VBox/GuestHost/OpenGL/error/error.py
r37392 r63939 5 5 6 6 7 from __future__ import print_function 7 8 import sys 8 9 … … 12 13 13 14 14 print 15 print("""#include <stdio.h> 15 16 #include "cr_error.h" 16 17 #include "cr_spu.h" … … 23 24 #endif 24 25 25 #define ERROR_UNUSED(x) ((void)x)""" 26 #define ERROR_UNUSED(x) ((void)x)""") 26 27 27 28 … … 31 32 return_type = apiutil.ReturnType(func_name) 32 33 params = apiutil.Parameters(func_name) 33 print '\nstatic %s ERROR_APIENTRY error%s( %s )' % (return_type, func_name, apiutil.MakeDeclarationString(params))34 print '{'34 print('\nstatic %s ERROR_APIENTRY error%s( %s )' % (return_type, func_name, apiutil.MakeDeclarationString(params ))) 35 print('{') 35 36 # Handle the void parameter list 36 37 for (name, type, vecSize) in params: 37 print '\tERROR_UNUSED(%s);' % name38 print '\tcrError( "ERROR SPU: Unsupported function gl%s called!" );' % func_name38 print('\tERROR_UNUSED(%s);' % name) 39 print('\tcrError( "ERROR SPU: Unsupported function gl%s called!" );' % func_name) 39 40 if return_type != "void": 40 print '\treturn (%s)0;' % return_type41 print '}'41 print('\treturn (%s)0;' % return_type) 42 print('}') 42 43 43 print 'SPUNamedFunctionTable _cr_error_table[] = {'44 print('SPUNamedFunctionTable _cr_error_table[] = {') 44 45 for index in range(len(keys)): 45 46 func_name = keys[index] 46 print '\t{ "%s", (SPUGenericFunction) error%s },' % (func_name, func_name)47 print '\t{ NULL, NULL }'48 print '};'47 print('\t{ "%s", (SPUGenericFunction) error%s },' % (func_name, func_name )) 48 print('\t{ NULL, NULL }') 49 print('};') -
trunk/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py
r50041 r63939 6 6 # generation. 7 7 8 from __future__ import print_function 8 9 import sys, string, re 9 10 … … 12 13 13 14 def CopyrightC( ): 14 print 15 print("""/* Copyright (c) 2001, Stanford University 15 16 All rights reserved. 16 17 17 18 See the file LICENSE.txt for information on redistributing this software. */ 18 """ 19 """) 19 20 20 21 def CopyrightDef( ): 21 print 22 print("""; Copyright (c) 2001, Stanford University 22 23 ; All rights reserved. 23 24 ; 24 25 ; See the file LICENSE.txt for information on redistributing this software. 25 """ 26 """) 26 27 27 28 … … 56 57 specFile = open(filename, "r") 57 58 if not specFile: 58 print "Error: couldn't open %s file!" % filename59 print("Error: couldn't open %s file!" % filename) 59 60 sys.exit() 60 61 … … 64 65 65 66 # split line into tokens 66 tokens = string.split(line)67 tokens = line.split() 67 68 68 69 if len(tokens) > 0 and line[0] != '#': … … 78 79 79 80 elif tokens[0] == 'return': 80 record.returnType = string.join(tokens[1:], ' ')81 record.returnType = ' '.join(tokens[1:]) 81 82 82 83 elif tokens[0] == 'param': 83 84 name = tokens[1] 84 type = string.join(tokens[2:], ' ')85 type = ' '.join(tokens[2:]) 85 86 vecSize = 0 86 87 record.params.append((name, type, vecSize)) … … 167 168 168 169 else: 169 print 'Invalid token %s after function %s' % (tokens[0], record.name)170 print('Invalid token %s after function %s' % (tokens[0], record.name)) 170 171 #endif 171 172 #endif … … 189 190 190 191 def AddFunction(record): 191 assert not __FunctionDict.has_key(record.name)192 assert record.name not in __FunctionDict 192 193 #if not "omit" in record.chromium: 193 194 __FunctionDict[record.name] = record … … 210 211 a = __FunctionDict[func].alias 211 212 if a: 212 __ReverseAliases[a] = func 213 #endif 214 #endfor 213 if a in __ReverseAliases: 214 __ReverseAliases[a].append(func) 215 else: 216 __ReverseAliases[a] = [func] 215 217 #endif 216 218 return __FunctionDict … … 336 338 337 339 338 def ReverseAlias(funcName): 339 """Like Alias(), but the inverse.""" 340 d = GetFunctionDict() 341 if funcName in __ReverseAliases.keys(): 342 return __ReverseAliases[funcName] 343 else: 344 return '' 340 def ReverseAliases(funcName): 341 """Return a list of aliases.""" 342 d = GetFunctionDict() 343 if funcName in __ReverseAliases: 344 return sorted(__ReverseAliases[funcName]) 345 else: 346 return [] 347 348 349 def ReverseAliasesMaxCount(): 350 """Returns the maximum number of aliases possible for a function.""" 351 d = GetFunctionDict() 352 return max([len(a) for a in __ReverseAliases.values()]) 345 353 346 354 … … 383 391 cat == '2.1'): 384 392 # i.e. OpenGL 1.3 or 1.4 or 1.5 385 return "OPENGL_VERSION_" + string.replace(cat,".", "_")393 return "OPENGL_VERSION_" + cat.replace(".", "_") 386 394 else: 387 395 assert cat != '' 388 return string.replace(cat,"GL_", "")396 return cat.replace("GL_", "") 389 397 390 398 … … 518 526 def IsPointer(dataType): 519 527 """Determine if the datatype is a pointer. Return 1 or 0.""" 520 if string.find(dataType,"*") == -1:528 if dataType.find("*") == -1: 521 529 return 0 522 530 else: … … 528 536 Ex: PointerType('const GLubyte *') = 'GLubyte' 529 537 """ 530 t = string.split(pointerType,' ')538 t = pointerType.split(' ') 531 539 if t[0] == "const": 532 540 t[0] = t[1] … … 538 546 def OpcodeName(funcName): 539 547 """Return the C token for the opcode for the given function.""" 540 return "CR_" + string.upper(funcName) + "_OPCODE"548 return "CR_" + funcName.upper() + "_OPCODE" 541 549 542 550 543 551 def ExtendedOpcodeName(funcName): 544 552 """Return the C token for the extended opcode for the given function.""" 545 return "CR_" + string.upper(funcName) + "_EXTEND_OPCODE"553 return "CR_" + funcName.upper() + "_EXTEND_OPCODE" 546 554 547 555 … … 683 691 size = PointerSize() 684 692 else: 685 assert string.find(type,"const") == -1693 assert type.find("const") == -1 686 694 size = sizeof(type) 687 695 len = FixAlignment( len, size ) + size … … 706 714 707 715 for line in f.readlines(): 708 line = string.strip(line)716 line = line.strip() 709 717 if line == "" or line[0] == '#': 710 718 continue … … 740 748 table = LoadSpecials( filename ) 741 749 742 keys = table.keys() 743 keys.sort() 744 return keys 745 746 747 def AllSpecials( table_file ): 748 filename = table_file + "_special" 749 table = {} 750 try: 751 table = __specials[filename] 752 except KeyError: 753 table = LoadSpecials(filename) 754 755 ret = table.keys() 756 ret.sort() 757 return ret 758 750 return sorted(table.keys()) 751 759 752 760 753 def NumSpecials( table_file ): … … 773 766 else: 774 767 prefix = "gl" 775 print '%s %s%s(%s);' % (record.returnType, prefix, record.name, argList)768 print('%s %s%s(%s);' % (record.returnType, prefix, record.name, argList )) 776 769 if len(record.props) > 0: 777 print ' /* %s */' % string.join(record.props, ' ')770 print(' /* %s */' % string.join(record.props, ' ')) 778 771 779 772 #ProcessSpecFile("APIspec.txt", PrintRecord) -
trunk/src/VBox/GuestHost/OpenGL/packer/opcodes.py
r52451 r63939 6 6 # This script generates include/cr_opcodes.h from the gl_header.parsed file. 7 7 8 from __future__ import print_function 8 9 import sys; 9 import cPickle;10 10 import string; 11 11 import re; … … 15 15 apiutil.CopyrightC() 16 16 17 print ""18 print "/* DO NOT EDIT - THIS FILE GENERATED BY THE opcodes.py SCRIPT */"19 print ""20 print "#ifndef CR_OPCODES_H"21 print "#define CR_OPCODES_H"22 print ""17 print("") 18 print("/* DO NOT EDIT - THIS FILE GENERATED BY THE opcodes.py SCRIPT */") 19 print("") 20 print("#ifndef CR_OPCODES_H") 21 print("#define CR_OPCODES_H") 22 print("") 23 23 24 24 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 25 25 assert len(keys) > 0 26 26 27 print "/* Functions with no return value and input-only parameters */"28 print "typedef enum {"27 print("/* Functions with no return value and input-only parameters */") 28 print("typedef enum {") 29 29 30 30 enum_index = 0 31 31 for func in keys: 32 32 if "pack" in apiutil.ChromiumProps(func): 33 print "\t%s = %d," % ( apiutil.OpcodeName(func), enum_index)33 print("\t%s = %d," % ( apiutil.OpcodeName(func), enum_index )) 34 34 enum_index = enum_index + 1 35 35 36 print "\tCR_EXTEND_OPCODE=%d," % enum_index36 print("\tCR_EXTEND_OPCODE=%d," % enum_index) 37 37 enum_index = enum_index + 1 38 print "\tCR_CMDBLOCKBEGIN_OPCODE=%d," % enum_index38 print("\tCR_CMDBLOCKBEGIN_OPCODE=%d," % enum_index) 39 39 enum_index = enum_index + 1 40 print "\tCR_CMDBLOCKEND_OPCODE=%d," % enum_index40 print("\tCR_CMDBLOCKEND_OPCODE=%d," % enum_index) 41 41 enum_index = enum_index + 1 42 print "\tCR_CMDBLOCKFLUSH_OPCODE=%d," % enum_index43 print "\tCR_NOP_OPCODE=255"42 print("\tCR_CMDBLOCKFLUSH_OPCODE=%d," % enum_index) 43 print("\tCR_NOP_OPCODE=255") 44 44 if enum_index > 254: 45 45 # This would have saved Mike some grief if it had been here earlier. … … 52 52 print >> sys.stderr, "I'm putting an error in the generated header file so you won't miss" 53 53 print >> sys.stderr, "this even if you're doing a 'make -k.'" 54 print "#error -- more than 255 opcodes!"54 print("#error -- more than 255 opcodes!") 55 55 sys.exit(-1) 56 print "} CROpcode;\n"56 print("} CROpcode;\n") 57 57 58 58 # count up number of extended opcode commands … … 72 72 print >> sys.stderr, "if this is really what you want to do, please adjust this script" 73 73 print >> sys.stderr, "to handle a new auto-generated opcodes count" 74 print "#error -- num_auto_codes should be 304, but is " + str(num_auto_codes)74 print("#error -- num_auto_codes should be 304, but is " + str(num_auto_codes)) 75 75 sys.exit(-1) 76 76 77 print "/* Functions with a return value or output parameters */"78 print "typedef enum {"77 print("/* Functions with a return value or output parameters */") 78 print("typedef enum {") 79 79 80 80 opcode_index = 0 … … 87 87 opcode = -1 88 88 if chrelopcode >= 0: 89 if not chrelopcode in chrelopcodes .keys():89 if not chrelopcode in chrelopcodes: 90 90 chrelopcodes[chrelopcode] = chrelopcode 91 91 else: 92 92 print >> sys.stderr, "non-unique chrelopcode: " + str(chrelopcode) 93 print "#error -- non-unique chrelopcode: " + str(num_auto_codes)93 print("#error -- non-unique chrelopcode: " + str(num_auto_codes)) 94 94 sys.exit(-1) 95 95 opcode = num_auto_codes + chrelopcode … … 99 99 100 100 if enum_index != num_extends-1: 101 print "\t%s = %d," % (opcodeName, opcode)101 print("\t%s = %d," % (opcodeName, opcode )) 102 102 else: 103 print "\t%s = %d" % (opcodeName, opcode)103 print("\t%s = %d" % (opcodeName, opcode )) 104 104 enum_index = enum_index + 1 105 print "} CRExtendOpcode;\n"106 print "#endif /* CR_OPCODES_H */"105 print("} CRExtendOpcode;\n") 106 print("#endif /* CR_OPCODES_H */") -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_current.py
r33475 r63939 6 6 # This script generates the pack_current.c file. 7 7 8 from __future__ import print_function 8 9 import sys 9 10 sys.path.append( "../glapi_parser" ) … … 14 15 apiutil.CopyrightC() 15 16 16 print 17 print(""" 17 18 /* DO NOT EDIT - THIS FILE GENERATED BY THE pack_current.py SCRIPT */ 18 19 … … 35 36 GLfogcoord_p *fogCoord = &(pc->current.c.fogCoord); 36 37 int i; 37 """ 38 """) 38 39 39 for k in current_fns.keys():40 for k in sorted(current_fns.keys()): 40 41 name = '%s%s' % (k[:1].lower(),k[1:]) 41 if current_fns[k].has_key( 'array' ):42 print '\tfor (i = 0 ; i < %s ; i++)' % current_fns[k]['array']43 print '\t{'42 if 'array' in current_fns[k]: 43 print('\tfor (i = 0 ; i < %s ; i++)' % current_fns[k]['array']) 44 print('\t{') 44 45 for type in current_fns[k]['types']: 45 46 for size in current_fns[k]['sizes']: 46 47 indent = "" 47 48 ptr = "%s->%s%d" % (name, type, size ) 48 if current_fns[k].has_key( 'array' ):49 if 'array' in current_fns[k]: 49 50 ptr += "[i]" 50 51 indent = "\t" 51 print "%s\tif ( %s )" % (indent, ptr)52 print "%s\t{" % indent53 print "%s\t\t%s += offset;" % (indent, ptr)54 print "%s\t}" % indent55 if current_fns[k].has_key( 'array' ):56 print '\t}'57 print 52 print("%s\tif ( %s )" % (indent, ptr)) 53 print("%s\t{" % indent) 54 print("%s\t\t%s += offset;" % (indent, ptr )) 55 print("%s\t}" % indent) 56 if 'array' in current_fns[k]: 57 print('\t}') 58 print(""" 58 59 } 59 60 … … 62 63 CR_GET_PACKER_CONTEXT(pc); 63 64 CRCurrentStateAttr *c = &(pc->current.c); 64 """ 65 print '\tmemset ( c, 0, sizeof (CRCurrentStateAttr));'66 print "}"65 """) 66 print('\tmemset ( c, 0, sizeof (CRCurrentStateAttr));') 67 print("}") -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_currentheader.py
r51313 r63939 6 6 # This script generates the include/state/cr_currentpointers.h file. 7 7 8 from __future__ import print_function 8 9 import sys 9 10 sys.path.append( "../glapi_parser" ) … … 14 15 apiutil.CopyrightC() 15 16 16 print 17 print(""" 17 18 /* DO NOT EDIT - THIS FILE GENERATED BY THE pack_currentheader.py SCRIPT */ 18 19 … … 21 22 22 23 #include "state/cr_limits.h" 23 """ 24 """) 24 25 25 for k in current_fns.keys(): 26 sorted_keys = sorted(current_fns.keys()) 27 28 for k in sorted_keys: 26 29 name = k.lower(); 27 print "typedef struct {"28 if current_fns[k].has_key( 'array' ):29 print "\tconst unsigned char *ptr[%s];" % current_fns[k]['array']30 print("typedef struct {") 31 if 'array' in current_fns[k]: 32 print("\tconst unsigned char *ptr[%s];" % current_fns[k]['array']) 30 33 else: 31 print "\tconst unsigned char *ptr;"34 print("\tconst unsigned char *ptr;") 32 35 for type in current_fns[k]['types']: 33 36 for size in current_fns[k]['sizes']: 34 if current_fns[k].has_key( 'array' ):35 print "\tconst unsigned char *%s%d[%s];" % (type, size, current_fns[k]['array'])37 if 'array' in current_fns[k]: 38 print("\tconst unsigned char *%s%d[%s];" % (type, size, current_fns[k]['array'])) 36 39 else: 37 print "\tconst unsigned char *%s%d;" % (type, size)38 print "} GL%s_p;\n" % name40 print("\tconst unsigned char *%s%d;" % (type, size)) 41 print("} GL%s_p;\n" % name) 39 42 40 print "typedef struct attrs {"41 for k in current_fns.keys():43 print("typedef struct attrs {") 44 for k in sorted_keys: 42 45 name = k.lower() 43 46 field = '%s%s' % (k[:1].lower(),k[1:]) 44 print "\tGL%s_p %s;" % (name,field)45 print " } CRCurrentStateAttr;"47 print("\tGL%s_p %s;" % (name,field)) 48 print(" } CRCurrentStateAttr;") 46 49 47 50 48 print "typedef struct {"49 print 51 print("typedef struct {") 52 print(""" 50 53 CRCurrentStateAttr c; 51 54 unsigned char *vtx_op; … … 61 64 62 65 #endif /* CR_CURRENT_H */ 63 """ 66 """) -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_header.py
r42028 r63939 7 7 # gl_header.parsed file. 8 8 9 from __future__ import print_function 9 10 import sys 10 11 import string … … 15 16 apiutil.CopyrightC() 16 17 17 print 18 print("""#ifndef CR_PACKFUNCTIONS_H 18 19 #define CR_PACKFUNCTIONS_H 19 20 … … 35 36 extern "C" { 36 37 #endif 37 """ 38 """) 38 39 39 40 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 60 61 args.append(("writeback", "int *", 0)) 61 62 62 print 'void PACK_APIENTRY crPack%s( %s );' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args))63 print 'void PACK_APIENTRY crPack%sSWAP( %s );' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args))63 print('void PACK_APIENTRY crPack%s( %s );' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args))) 64 print('void PACK_APIENTRY crPack%sSWAP( %s );' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args))) 64 65 65 66 … … 76 77 77 78 args = apiutil.Parameters(func_name) 78 print 'void PACK_APIENTRY crPack%sBBOX(%s);' % (func_name, apiutil.MakeDeclarationString(args))79 print 'void PACK_APIENTRY crPack%sBBOX_COUNT(%s);' % (func_name, apiutil.MakeDeclarationString(args))80 print 'void PACK_APIENTRY crPack%sBBOXSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args))81 print 'void PACK_APIENTRY crPack%sBBOX_COUNTSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args))79 print('void PACK_APIENTRY crPack%sBBOX(%s);' % (func_name, apiutil.MakeDeclarationString(args))) 80 print('void PACK_APIENTRY crPack%sBBOX_COUNT(%s);' % (func_name, apiutil.MakeDeclarationString(args))) 81 print('void PACK_APIENTRY crPack%sBBOXSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args))) 82 print('void PACK_APIENTRY crPack%sBBOX_COUNTSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args))) 82 83 83 84 84 print 85 print(""" 85 86 #ifdef __cplusplus 86 87 } … … 88 89 89 90 #endif /* CR_PACKFUNCTIONS_H */ 90 """ 91 """) -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_swap.py
r21310 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys, string 7 8 … … 16 17 file = open(sys.argv[1]) 17 18 18 print "/* THIS FILE IS AUTOGENERATED FROM %s BY pack_swap.py */\n\n" % sys.argv[1]19 print("/* THIS FILE IS AUTOGENERATED FROM %s BY pack_swap.py */\n\n" % sys.argv[1]) 19 20 20 21 for line in file.readlines(): 21 22 line = line.rstrip() 22 23 if line.find( "crPackAlloc" ) != -1 or line.find( "crPackFree" ) != -1: 23 print line24 print(line) 24 25 continue 25 26 elif line.find( "crPack" ) != -1: … … 35 36 quote_index = 1000000; # HACK HACK 36 37 the_index = min( min( paren_index, space_index ), quote_index ) 37 print "%sSWAP%s" % (line[:the_index], line[the_index:])38 print("%sSWAP%s" % (line[:the_index], line[the_index:])) 38 39 elif line.find("WRITE_DATA_AI") != -1: 39 40 lparen_index = line.find( "(" ) 40 41 rparen_index = line.rfind( ")" ) 41 args = map( string.strip, line[lparen_index+1:rparen_index].split( "," ))42 args = list(map( str.strip, line[lparen_index+1:rparen_index].split( "," ) )) 42 43 indentation = line[:line.find( "WRITE_DATA_AI" )] 43 44 if apiutil.sizeof(args[0]) == 1: 44 print "%sWRITE_DATA_AI(%s, %s);" % (indentation, args[0], args[1])45 print("%sWRITE_DATA_AI(%s, %s);" % (indentation, args[0], args[1])) 45 46 elif apiutil.sizeof(args[0]) == 2: 46 print "%sWRITE_DATA_AI(%s, SWAP16(%s) );" % (indentation, args[0], args[1])47 print("%sWRITE_DATA_AI(%s, SWAP16(%s) );" % (indentation, args[0], args[1])) 47 48 elif args[0] == 'GLfloat' or args[0] == 'GLclampf': 48 print "%sWRITE_DATA_AI(GLuint, SWAPFLOAT(%s) );" % (indentation, args[0])49 print("%sWRITE_DATA_AI(GLuint, SWAPFLOAT(%s) );" % (indentation, args[0])) 49 50 elif apiutil.sizeof(args[0]) == 4: 50 print "%sWRITE_DATA_AI(%s, SWAP32(%s) );" % (indentation, args[0], args[1])51 print("%sWRITE_DATA_AI(%s, SWAP32(%s) );" % (indentation, args[0], args[1])) 51 52 else: 52 53 print >> sys.stderr, "UNKNOWN TYPE FOR WRITE_DATA: %s" % args[1] … … 55 56 lparen_index = line.find( "(" ) 56 57 rparen_index = line.rfind( ")" ) 57 args = map( string.strip, line[lparen_index+1:rparen_index].split( "," ))58 args = list(map( str.strip, line[lparen_index+1:rparen_index].split( "," ) )) 58 59 indentation = line[:line.find( "WRITE_DATA" )] 59 60 if apiutil.sizeof(args[1]) == 1: 60 print "%sWRITE_DATA( %s, %s, %s );" % (indentation, args[0], args[1], args[2])61 print("%sWRITE_DATA( %s, %s, %s );" % (indentation, args[0], args[1], args[2])) 61 62 elif apiutil.sizeof(args[1]) == 2: 62 print "%sWRITE_DATA( %s, %s, SWAP16(%s) );" % (indentation, args[0], args[1], args[2])63 print("%sWRITE_DATA( %s, %s, SWAP16(%s) );" % (indentation, args[0], args[1], args[2])) 63 64 elif args[1] == 'GLfloat' or args[1] == 'GLclampf': 64 print "%sWRITE_DATA( %s, GLuint, SWAPFLOAT(%s) );" % (indentation, args[0], args[2])65 print("%sWRITE_DATA( %s, GLuint, SWAPFLOAT(%s) );" % (indentation, args[0], args[2])) 65 66 elif apiutil.sizeof(args[1]) == 4: 66 print "%sWRITE_DATA( %s, %s, SWAP32(%s) );" % (indentation, args[0], args[1], args[2])67 print("%sWRITE_DATA( %s, %s, SWAP32(%s) );" % (indentation, args[0], args[1], args[2])) 67 68 else: 68 69 print >> sys.stderr, "UNKNOWN TYPE FOR WRITE_DATA: %s" % args[1] 69 70 sys.exit(-1) 70 71 elif line.find( "WRITE_DOUBLE" ) != -1: 71 print line.replace( "WRITE_DOUBLE", "WRITE_SWAPPED_DOUBLE")72 print(line.replace( "WRITE_DOUBLE", "WRITE_SWAPPED_DOUBLE" )) 72 73 else: 73 print line74 print(line) -
trunk/src/VBox/GuestHost/OpenGL/packer/packer.py
r52451 r63939 6 6 # This script generates the packer.c file from the gl_header.parsed file. 7 7 8 from __future__ import print_function 8 9 import sys, string, re 9 10 … … 46 47 name = '%s%s' % (k[:1].lower(),k[1:]) 47 48 type = m.group(3) + m.group(2) 48 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)49 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 49 50 return 50 51 … … 54 55 name = 'secondaryColor' 55 56 type = m.group(3) + m.group(2) 56 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)57 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 57 58 return 58 59 … … 62 63 name = 'texCoord' 63 64 type = m.group(3) + m.group(2) 64 print "\tpc->current.c.%s.%s[0] = data_ptr;" % (name,type)65 print("\tpc->current.c.%s.%s[0] = data_ptr;" % (name,type)) 65 66 return 66 67 … … 70 71 name = 'texCoord' 71 72 type = m.group(3) + m.group(2) 72 print "\tpc->current.c.%s.%s[texture-GL_TEXTURE0_ARB] = data_ptr + 4;" % (name,type)73 print("\tpc->current.c.%s.%s[texture-GL_TEXTURE0_ARB] = data_ptr + 4;" % (name,type)) 73 74 return 74 75 … … 78 79 name = 'index' 79 80 type = m.group(2) + "1" 80 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)81 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 81 82 return 82 83 … … 86 87 name = 'edgeFlag' 87 88 type = "l1" 88 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)89 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 89 90 return 90 91 … … 94 95 name = 'fogCoord' 95 96 type = m.group(2) + "1" 96 print "\tpc->current.c.%s.%s = data_ptr;" % (name,type)97 print("\tpc->current.c.%s.%s = data_ptr;" % (name,type)) 97 98 return 98 99 … … 104 105 type = m.group(3) + m.group(2) 105 106 # Add 12 to skip the packet length, opcode and index fields 106 print "\tpc->current.c.%s.%s[index] = data_ptr + 4;" % (name,type)107 print("\tpc->current.c.%s.%s[index] = data_ptr + 4;" % (name,type)) 107 108 if m.group(4) == "ARB" or m.group(4) == "NV": 108 print "\tpc->current.attribsUsedMask |= (1 << index);"109 print "\tpc->current.changedVertexAttrib |= (1 << index);"109 print("\tpc->current.attribsUsedMask |= (1 << index);") 110 print("\tpc->current.changedVertexAttrib |= (1 << index);") 110 111 return 111 112 … … 115 116 """Emit a packer function.""" 116 117 if is_swapped: 117 print 'void PACK_APIENTRY crPack%sSWAP( %s )' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params))118 else: 119 print 'void PACK_APIENTRY crPack%s( %s )' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params))120 print '{'121 print '\tCR_GET_PACKER_CONTEXT(pc);'118 print('void PACK_APIENTRY crPack%sSWAP( %s )' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params))) 119 else: 120 print('void PACK_APIENTRY crPack%s( %s )' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params))) 121 print('{') 122 print('\tCR_GET_PACKER_CONTEXT(pc);') 122 123 123 124 # Save original function name … … 138 139 if bail_out: 139 140 for (name, type, vecSize) in nonVecParams: 140 print '\t(void)%s;' % (name)141 print '\tcrError ( "%s needs to be special cased %d %d!");' % (func_name, vecSize, can_have_pointers)142 print '\t(void) pc;'143 print '}'141 print('\t(void)%s;' % (name)) 142 print('\tcrError ( "%s needs to be special cased %d %d!");' % (func_name, vecSize, can_have_pointers)) 143 print('\t(void) pc;') 144 print('}') 144 145 # XXX we should really abort here 145 146 return … … 151 152 152 153 153 print "\tunsigned char *data_ptr;"154 print '\t(void) pc;'154 print("\tunsigned char *data_ptr;") 155 print('\t(void) pc;') 155 156 #if func_name == "Enable" or func_name == "Disable": 156 157 # print "\tCRASSERT(!pc->buffer.geometry_only); /* sanity check */" … … 159 160 (name, type, vecSize) = params[index] 160 161 if vecSize>0 and func_name!=orig_func_name: 161 print " if (!%s) {" % name162 print(" if (!%s) {" % name) 162 163 # Know the reason for this one, so avoid the spam. 163 164 if orig_func_name != "SecondaryColor3fvEXT": 164 print " crDebug(\"App passed NULL as %s for %s\");" % (name, orig_func_name)165 print " return;"166 print " }"165 print(" crDebug(\"App passed NULL as %s for %s\");" % (name, orig_func_name)) 166 print(" return;") 167 print(" }") 167 168 168 169 packet_length = apiutil.PacketLength(nonVecParams) 169 170 170 171 if packet_length == 0 and not is_extended: 171 print "\tCR_GET_BUFFERED_POINTER_NO_ARGS( pc );"172 print("\tCR_GET_BUFFERED_POINTER_NO_ARGS( pc );") 172 173 elif func_name[:9] == "Translate" or func_name[:5] == "Color": 173 174 # XXX WTF is the purpose of this? 174 175 if is_extended: 175 176 packet_length += 8 176 print "\tCR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, %d, GL_TRUE );" % packet_length177 print("\tCR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, %d, GL_TRUE );" % packet_length) 177 178 else: 178 179 if is_extended: 179 180 packet_length += 8 180 print "\tCR_GET_BUFFERED_POINTER( pc, %d );" % packet_length181 print("\tCR_GET_BUFFERED_POINTER( pc, %d );" % packet_length) 181 182 UpdateCurrentPointer( func_name ) 182 183 183 184 if is_extended: 184 185 counter = 8 185 print WriteData( 0, 'GLint', packet_length, is_swapped)186 print WriteData( 4, 'GLenum', apiutil.ExtendedOpcodeName( func_name ), is_swapped)186 print(WriteData( 0, 'GLint', packet_length, is_swapped )) 187 print(WriteData( 4, 'GLenum', apiutil.ExtendedOpcodeName( func_name ), is_swapped )) 187 188 else: 188 189 counter = 0 … … 195 196 ptrType = apiutil.PointerType(type) 196 197 for i in range(0, vecSize): 197 print 198 ptrType, "%s[%d]" % (name, i), is_swapped ) 198 print(WriteData( counter + i * apiutil.sizeof(ptrType), 199 ptrType, "%s[%d]" % (name, i), is_swapped )) 199 200 # XXX increment counter here? 200 201 else: 201 print WriteData( counter, type, name, is_swapped)202 print(WriteData( counter, type, name, is_swapped )) 202 203 if apiutil.IsPointer(type): 203 204 counter += apiutil.PointerSize() … … 207 208 # finish up 208 209 if is_extended: 209 print "\tWRITE_OPCODE( pc, CR_EXTEND_OPCODE );"210 else: 211 print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name)210 print("\tWRITE_OPCODE( pc, CR_EXTEND_OPCODE );") 211 else: 212 print("\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name )) 212 213 213 214 if "get" in apiutil.Properties(func_name): 214 print '\tCR_CMDBLOCK_CHECK_FLUSH(pc);'215 216 print '\tCR_UNLOCK_PACKER_CONTEXT(pc);'217 print '}\n'215 print('\tCR_CMDBLOCK_CHECK_FLUSH(pc);') 216 217 print('\tCR_UNLOCK_PACKER_CONTEXT(pc);') 218 print('}\n') 218 219 219 220 … … 223 224 apiutil.CopyrightC() 224 225 225 print 226 print(""" 226 227 /* DO NOT EDIT - THIS FILE GENERATED BY THE packer.py SCRIPT */ 227 228 … … 233 234 #include "cr_opcodes.h" 234 235 235 """ 236 """) 236 237 237 238 … … 252 253 if return_type != 'void': 253 254 # Yet another gross hack for glGetString 254 if string.find( return_type, '*') == -1:255 if return_type.find('*') == -1: 255 256 return_type = return_type + " *" 256 257 params.append(("return_value", return_type, 0)) … … 264 265 265 266 if not func_name in r0_funcs: 266 print '#ifndef IN_RING0'267 print('#ifndef IN_RING0') 267 268 268 269 PrintFunc( func_name, params, 0, pointers_ok ) … … 270 271 271 272 if not func_name in r0_funcs: 272 print '#endif'273 print('#endif') 273 274 -
trunk/src/VBox/GuestHost/OpenGL/packer/packer_bbox.py
r33475 r63939 6 6 # This script generates the packer_bbox.c file from gl_header.parsed 7 7 8 from __future__ import print_function 8 9 import sys 9 import cPickle10 10 import string 11 11 … … 15 15 apiutil.CopyrightC() 16 16 17 print 17 print(""" 18 18 /* DO NOT EDIT - THIS FILE GENERATED BY THE packer_bbox.py SCRIPT */ 19 19 … … 64 64 } 65 65 66 """ 66 """) 67 67 68 68 def WriteData( offset, arg_type, arg_name, is_swapped ): 69 if string.find( arg_type, '*') != -1:69 if arg_type.find('*') != -1: 70 70 retval = "\tWRITE_NETWORK_POINTER( %d, (void *) %s );" % (offset, arg_name ) 71 71 else: … … 135 135 vector_type = "GLdouble" 136 136 else: 137 print "type is %s" % argtype137 print("type is %s" % argtype) 138 138 abort() 139 139 … … 146 146 params = apiutil.Parameters(func_name + extSuffix) 147 147 148 print 149 swapSuffix, apiutil.MakeDeclarationString(params)) 150 print '{'148 print('void PACK_APIENTRY crPack%sBBOX%s%s( %s )' % (func_name + extSuffix, countSuffix, 149 swapSuffix, apiutil.MakeDeclarationString(params))) 150 print('{') 151 151 152 152 if do_vector: … … 167 167 168 168 169 print "\tCR_GET_PACKER_CONTEXT(pc);"170 print "\tunsigned char *data_ptr;"169 print("\tCR_GET_PACKER_CONTEXT(pc);") 170 print("\tunsigned char *data_ptr;") 171 171 172 172 if normalized: … … 186 186 abort() 187 187 if do_vector: 188 print "\tCREATE_%dD_VFLOATS_%s_NORMALIZED();" % (num_coords, t)189 else: 190 print "\tCREATE_%dD_FLOATS_%s_NORMALIZED();" % (num_coords, t)188 print("\tCREATE_%dD_VFLOATS_%s_NORMALIZED();" % (num_coords, t)) 189 else: 190 print("\tCREATE_%dD_FLOATS_%s_NORMALIZED();" % (num_coords, t)) 191 191 else: 192 192 if do_vector: 193 print "\tCREATE_%dD_VFLOATS();" % num_coords194 else: 195 print "\tCREATE_%dD_FLOATS();" % num_coords196 197 print "\tCR_GET_BUFFERED%s_POINTER( pc, %d );" % (countSuffix, packet_length)193 print("\tCREATE_%dD_VFLOATS();" % num_coords) 194 else: 195 print("\tCREATE_%dD_FLOATS();" % num_coords) 196 197 print("\tCR_GET_BUFFERED%s_POINTER( pc, %d );" % (countSuffix, packet_length)) 198 198 199 199 # Bounding box code 200 200 if isVertexAttrib: 201 print "\tif (pc->updateBBOX && index == 0)"202 else: 203 print "\tif (pc->updateBBOX)"204 print "\t{"201 print("\tif (pc->updateBBOX && index == 0)") 202 else: 203 print("\tif (pc->updateBBOX)") 204 print("\t{") 205 205 if num_coords < 4: 206 print "\t\tUPDATE_%dD_BBOX();" % num_coords207 else: 208 print "\t\tUPDATE_3D_BBOX();"209 print "\t}"206 print("\t\tUPDATE_%dD_BBOX();" % num_coords) 207 else: 208 print("\t\tUPDATE_3D_BBOX();") 209 print("\t}") 210 210 211 211 if isVertexAttrib: 212 print "\tif (index > 0) {"212 print("\tif (index > 0) {") 213 213 t = argtype 214 print "\t\tpc->current.c.vertexAttrib.%s%d[index] = data_ptr + 4;" % (t, num_coords)215 print "\t\tpc->current.attribsUsedMask |= (1 << index);"214 print("\t\tpc->current.c.vertexAttrib.%s%d[index] = data_ptr + 4;" % (t, num_coords)) 215 print("\t\tpc->current.attribsUsedMask |= (1 << index);") 216 216 if do_count: 217 print "\t\tpc->current.vtx_count--;"218 219 print "\t}"217 print("\t\tpc->current.vtx_count--;") 218 219 print("\t}") 220 220 221 221 fname = func_name + extSuffix … … 230 230 if isVertexAttrib: 231 231 if do_swapped: 232 print "\tWRITE_DATA( 0, GLuint, SWAP32(index) );"232 print("\tWRITE_DATA( 0, GLuint, SWAP32(index) );") 233 233 else: 234 print "\tWRITE_DATA( 0, GLuint, index );"234 print("\tWRITE_DATA( 0, GLuint, index );") 235 235 counter += 4 236 236 argname = params[1][0] # skip 'index' parameter … … 239 239 240 240 for index in range(num_coords): 241 print WriteData( counter, vector_type, "%s[%d]" % (argname, index), do_swapped)241 print(WriteData( counter, vector_type, "%s[%d]" % (argname, index), do_swapped )) 242 242 counter += apiutil.sizeof(vector_type) 243 243 … … 245 245 if do_vector == 2: 246 246 # this is a bit of a hack 247 print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name + "ARB")247 print("\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name + "ARB" )) 248 248 else: 249 print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name[:-1] + "ARB")250 else: 251 print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name[:-1])249 print("\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name[:-1] + "ARB" )) 250 else: 251 print("\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name[:-1] )) 252 252 else: 253 253 for index in range(0,len(params)): 254 254 (name, type, vecSize) = params[index] 255 print WriteData( counter, type, name, do_swapped)255 print(WriteData( counter, type, name, do_swapped )) 256 256 counter += apiutil.sizeof(type) 257 257 258 258 if isVertexAttrib: 259 print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name + "ARB")260 else: 261 print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name)262 263 print "\tCR_UNLOCK_PACKER_CONTEXT(pc);"264 265 266 print '}\n'259 print("\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name + "ARB" )) 260 else: 261 print("\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name )) 262 263 print("\tCR_UNLOCK_PACKER_CONTEXT(pc);") 264 265 266 print('}\n') 267 267 268 268 #end PrintFunction() -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/dispatch.py
r63199 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 import apiutil … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 14 15 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY dispatch.py SCRIPT */ … … 43 44 44 45 void __buildDispatch( SPU *spu ) 45 {""" 46 {""") 46 47 47 48 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 48 49 for func_name in keys: 49 print '\tspu->dispatch_table.%s = (%sFunc_t) __findFunc( "%s", spu );' % (func_name,func_name,func_name)50 print '}'50 print('\tspu->dispatch_table.%s = (%sFunc_t) __findFunc( "%s", spu );' % (func_name,func_name,func_name)) 51 print('}') 51 52 52 53 53 print 54 print(""" 54 55 55 56 /* … … 80 81 */ 81 82 void crSPUInitDispatch( SPUDispatchTable *dispatch, const SPUNamedFunctionTable *table ) 82 {""" 83 {""") 83 84 84 85 for func_name in keys: 85 print '\tdispatch->%s = (%sFunc_t) crSPUFindFunction(table, "%s");' % (func_name, func_name, func_name)86 print '}'86 print('\tdispatch->%s = (%sFunc_t) crSPUFindFunction(table, "%s");' % (func_name, func_name, func_name)) 87 print('}') 87 88 88 89 89 90 90 print 91 print(""" 91 92 /* 92 93 * Generic no-op function … … 123 124 } 124 125 } 125 """ 126 """) -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py
r56473 r63939 6 6 # This script generates the spu_dispatch_table.h file from gl_header.parsed 7 7 8 from __future__ import print_function 8 9 import sys, string 9 10 … … 13 14 apiutil.CopyrightC() 14 15 15 print 16 print(""" 16 17 /* DO NOT EDIT - THIS FILE GENERATED BY THE dispatchheader.py SCRIPT */ 17 18 … … 27 28 #include "chromium.h" 28 29 #include "state/cr_statetypes.h" 29 """ 30 """) 30 31 31 32 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 32 33 33 34 34 print '/* Offsets of each function within the dispatch table */'35 print('/* Offsets of each function within the dispatch table */') 35 36 offset = 0 36 37 for func_name in keys: 37 print '#define DISPATCH_OFFSET_%s %d' % (func_name, offset)38 print('#define DISPATCH_OFFSET_%s %d' % (func_name, offset)) 38 39 offset += 1 39 print ''40 print('') 40 41 41 print '/* Function typedefs */'42 print('/* Function typedefs */') 42 43 for func_name in keys: 43 44 return_type = apiutil.ReturnType(func_name) 44 45 params = apiutil.Parameters(func_name) 45 46 46 print 'typedef %s (SPU_APIENTRY *%sFunc_t)(%s);' % (return_type, func_name, apiutil.MakePrototypeString(params))47 print ''47 print('typedef %s (SPU_APIENTRY *%sFunc_t)(%s);' % (return_type, func_name, apiutil.MakePrototypeString(params))) 48 print('') 48 49 49 print 'struct _copy_list_node;'50 print ''51 print '/* Prototype for SPU internal state load/unload callbacks. */'52 print ''53 print 'typedef int (*SPUStateFunc_t)(void *);'54 print ''55 print '/* The SPU dispatch table */'56 print 'typedef struct _spu_dispatch_table {'50 print('struct _copy_list_node;') 51 print('') 52 print('/* Prototype for SPU internal state load/unload callbacks. */') 53 print('') 54 print('typedef int (*SPUStateFunc_t)(void *);') 55 print('') 56 print('/* The SPU dispatch table */') 57 print('typedef struct _spu_dispatch_table {') 57 58 58 59 for func_name in keys: 59 print "\t%sFunc_t %s; " % ( func_name, func_name)60 print("\t%sFunc_t %s; " % ( func_name, func_name )) 60 61 61 print 62 print(""" 62 63 struct _copy_list_node *copyList; 63 64 struct _spu_dispatch_table *copy_of; … … 75 76 76 77 #endif /* CR_SPU_DISPATCH_TABLE_H */ 77 """ 78 """) -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/glloader.py
r63199 r63939 5 5 6 6 7 from __future__ import print_function 7 8 import sys 8 9 import apiutil … … 13 14 apiutil.CopyrightC() 14 15 15 print 16 print(""" 16 17 /* DO NOT EDIT - THIS FILE GENERATED BY THE glloader.py SCRIPT */ 17 18 #include "cr_error.h" … … 212 213 #endif 213 214 } 214 """ 215 """) 215 216 216 217 … … 229 230 return_type = apiutil.ReturnType(func_name); 230 231 params = apiutil.Parameters(func_name) 231 print 'static %s GLLOADER_APIENTRY Nop%s(%s)' % (return_type, func_name, apiutil.MakeDeclarationString(params))232 print '{'232 print('static %s GLLOADER_APIENTRY Nop%s(%s)' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 233 print('{') 233 234 for (name, type, vecSize) in params: 234 235 if name != "": 235 print '\t(void) %s;' % name236 print('\t(void) %s;' % name) 236 237 if apiutil.ReturnType(func_name) != 'void': 237 print '\treturn 0;'238 print '}'239 print ''238 print('\treturn 0;') 239 print('}') 240 print('') 240 241 241 242 … … 252 253 # Generate the crLoadOpenGL() function 253 254 # 254 print 255 print(""" 255 256 void 256 257 crUnloadOpenGL( void ) … … 281 282 { 282 283 static const char *coreFunctions[] = { 283 """ 284 """) 284 285 285 286 for func_name in keys: 286 287 if not IsExtensionFunc(func_name): 287 print '\t\t"gl%s",' % func_name288 289 print 288 print('\t\t"gl%s",' % func_name) 289 290 print(""" 290 291 NULL 291 292 }; … … 338 339 # endif 339 340 #endif 340 """ 341 """) 341 342 342 343 useful_wgl_functions = [ … … 459 460 ] 460 461 461 print '#ifdef WINDOWS'462 print('#ifdef WINDOWS') 462 463 463 464 for fun in useful_wgl_functions: 464 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun,fun,fun)465 466 print '#elif defined(DARWIN)'467 print '# ifndef VBOX_WITH_COCOA_QT'465 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun,fun,fun)) 466 467 print('#elif defined(DARWIN)') 468 print('# ifndef VBOX_WITH_COCOA_QT') 468 469 for fun in useful_agl_functions: 469 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( aglDll, "%s" );' % (fun,fun,fun)470 print '# endif'470 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( aglDll, "%s" );' % (fun,fun,fun)) 471 print('# endif') 471 472 472 473 for fun in useful_cgl_functions: 473 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( cglDll, "%s" );' % (fun, fun,fun)474 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( cglDll, "%s" );' % (fun, fun,fun)) 474 475 475 476 for fun in in_gl_functions: 476 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun,fun)477 478 print '#else'479 print '\t/* GLX */'477 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun,fun)) 478 479 print('#else') 480 print('\t/* GLX */') 480 481 481 482 # XXX merge these loops? 482 483 for fun in useful_glx_functions: 483 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun, fun)484 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun, fun)) 484 485 for fun in possibly_useful_glx_functions: 485 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun, fun)486 print '#endif'487 488 print 486 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun, fun)) 487 print('#endif') 488 489 print(""" 489 490 if (!entry) 490 491 return 1; /* token value */ … … 513 514 { 514 515 struct extfunc { 515 const char *funcName; 516 const char *aliasName; 517 SPUGenericFunction nopFunction; 516 const char *funcName;""") 517 max_aliases = apiutil.ReverseAliasesMaxCount() 518 for i in range(1, 1 + max_aliases): 519 print("\t\tconst char *aliasName%d;" % i) 520 print(""" SPUGenericFunction nopFunction; 518 521 }; 519 522 static const struct extfunc functions[] = { 520 """ 523 """) 521 524 522 525 for func_name in keys: … … 526 529 else: 527 530 prefix = "gl" 528 s = '\t\t{ "' + prefix + func_name + '", ' 529 a = apiutil.ReverseAlias(func_name) 530 if a: 531 s += '"' + prefix + a + '", ' 532 else: 533 s += 'NULL, ' 534 s += '(SPUGenericFunction) Nop' + func_name + ' },' 535 print s 536 537 print """ 538 { NULL, NULL, NULL} 531 s = '\t\t{ "' + prefix + func_name + '"' 532 aliases = apiutil.ReverseAliases(func_name) 533 s += ''.join([', "' + prefix + a + '"' for a in aliases]) + ', NULL' * (max_aliases - len(aliases)) 534 s += ', (SPUGenericFunction) Nop' + func_name + ' },' 535 print(s) 536 537 print('\t\t{ NULL%s, NULL}' % (', NULL' * max_aliases)) 538 print(""" 539 539 }; 540 540 const struct extfunc *func; … … 550 550 551 551 for (func = functions; func->funcName; func++) { 552 SPUGenericFunction f = findExtFunction(interface, func->funcName); 553 if (!f && func->aliasName) { 554 f = findExtFunction(interface, func->aliasName); 555 } 556 if (!f) { 552 SPUGenericFunction f = findExtFunction(interface, func->funcName);""") 553 for i in range(1, 1 + max_aliases): 554 print(""" if (!f && func->aliasName%d) { 555 f = findExtFunction(interface, func->aliasName%d); 556 }"""% (i, i)) 557 print(""" if (!f) { 557 558 f = func->nopFunction; 558 559 } … … 566 567 return entry - table; /* number of entries filled */ 567 568 } 568 """ 569 570 571 print 569 """) 570 571 572 print(""" 572 573 573 574 #ifdef USE_OSMESA … … 605 606 #endif 606 607 607 """ 608 608 """) 609 -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/spuchange.py
r63199 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 import apiutil … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 14 15 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY spuchange.py SCRIPT */ … … 29 30 } 30 31 table->mark = 1; 31 """ 32 """) 32 33 33 34 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 34 35 for func_name in keys: 35 print '\tif ((uintptr_t)table->%s == (uintptr_t)orig_func)' % func_name36 print '\t{'37 print '\t\ttable->%s = (%sFunc_t)(uintptr_t)new_func;' % (func_name, func_name)38 print '\t\tfor (temp = table->copyList ; temp ; temp = temp->next)'39 print '\t\t{'40 print '\t\t\tcrSPUChangeInterface( temp->copy, orig_func, new_func );'41 print '\t\t}'42 print '\t}'36 print('\tif ((uintptr_t)table->%s == (uintptr_t)orig_func)' % func_name) 37 print('\t{') 38 print('\t\ttable->%s = (%sFunc_t)(uintptr_t)new_func;' % (func_name, func_name)) 39 print('\t\tfor (temp = table->copyList ; temp ; temp = temp->next)') 40 print('\t\t{') 41 print('\t\t\tcrSPUChangeInterface( temp->copy, orig_func, new_func );') 42 print('\t\t}') 43 print('\t}') 43 44 44 print 45 print(""" 45 46 if (table->copy_of != NULL) 46 47 { … … 52 53 } 53 54 table->mark = 0; 54 """ 55 print '}'55 """) 56 print('}') 56 57 57 print 58 print(""" 58 59 void crSPUChangeDispatch(SPUDispatchTable *dispatch, const SPUNamedFunctionTable *newtable) 59 60 { 60 61 SPUGenericFunction func; 61 """ 62 """) 62 63 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 63 64 for func_name in keys: 64 print '\tfunc = crSPUFindFunction(newtable, "%s");' % func_name65 print '\tif (func && ((SPUGenericFunction)dispatch->%s!=func))' % func_name66 print '\t{'67 print '\t\tcrDebug("%%s changed from %%p to %%p", "gl%s", (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % (func_name, func_name)68 print '\t\tcrSPUChangeInterface(dispatch, (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % func_name69 print '\t}\n'70 print 65 print('\tfunc = crSPUFindFunction(newtable, "%s");' % func_name) 66 print('\tif (func && ((SPUGenericFunction)dispatch->%s!=func))' % func_name) 67 print('\t{') 68 print('\t\tcrDebug("%%s changed from %%p to %%p", "gl%s", (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % (func_name, func_name)) 69 print('\t\tcrSPUChangeInterface(dispatch, (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % func_name) 70 print('\t}\n') 71 print(""" 71 72 } 72 """ 73 """) -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 import apiutil … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 14 15 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY spucopy.py SCRIPT */ … … 19 20 void crSPUCopyDispatchTable( SPUDispatchTable *dst, SPUDispatchTable *src ) 20 21 { 21 """ 22 """) 22 23 23 24 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 24 25 for func_name in keys: 25 print '\tdst->%s = src->%s;' % (func_name, func_name)26 print('\tdst->%s = src->%s;' % (func_name, func_name)) 26 27 27 28 # if the destination is already a copy of something, we'd better make sure 28 29 # that we take it off its source's copy list first. 29 30 30 print 31 print(""" 31 32 if (dst->copy_of != NULL) 32 33 { … … 77 78 } 78 79 } 79 """ 80 """) -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/convert.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 17 18 apiutil.CopyrightC() 18 19 19 print 20 print(''' 20 21 #include "state/cr_statetypes.h" 21 22 … … 28 29 return d; 29 30 } 30 ''' 31 ''') 31 32 32 for k in gltypes.keys():33 for k in sorted(gltypes.keys()): 33 34 for i in range(1,5): 34 print 'static void __convert_%s%d (GLfloat *dst, const %s *src) {' % (k,i,gltypes[k]['type'])35 print('static void __convert_%s%d (GLfloat *dst, const %s *src) {' % (k,i,gltypes[k]['type'])) 35 36 if k == 'd': 36 37 for j in range(i-1): 37 print '\t*dst++ = (GLfloat) __read_double(src++);'38 print '\t*dst = (GLfloat) __read_double(src);'38 print('\t*dst++ = (GLfloat) __read_double(src++);') 39 print('\t*dst = (GLfloat) __read_double(src);') 39 40 else: 40 41 for j in range(i-1): 41 print '\t*dst++ = (GLfloat) *src++;';42 print '\t*dst = (GLfloat) *src;';43 print '}\n';42 print('\t*dst++ = (GLfloat) *src++;') 43 print('\t*dst = (GLfloat) *src;') 44 print('}\n') 44 45 45 46 scale = { … … 54 55 } 55 56 56 for k in gltypes.keys():57 for k in sorted(gltypes.keys()): 57 58 if k != 'f' and k != 'd' and k != 'l': 58 59 if k[0:1] == "N": … … 61 62 k2 = k 62 63 for i in range(1,5): 63 print 'static void __convert_rescale_%s%d (GLfloat *dst, const %s *src) {' % (k,i,gltypes[k2]['type'])64 print('static void __convert_rescale_%s%d (GLfloat *dst, const %s *src) {' % (k,i,gltypes[k2]['type'])) 64 65 for j in range(i-1): 65 print '\t*dst++ = ((GLfloat) *src++) / %s;' % scale[k2]66 print '\t*dst = ((GLfloat) *src) / %s;' % scale[k2]67 print '}\n'66 print('\t*dst++ = ((GLfloat) *src++) / %s;' % scale[k2]) 67 print('\t*dst = ((GLfloat) *src) / %s;' % scale[k2]) 68 print('}\n') 68 69 69 print 70 print(''' 70 71 71 72 static void __convert_boolean (GLboolean *dst, const GLboolean *src) { 72 73 *dst = *src; 73 74 } 74 ''' 75 ''') -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py
r50041 r63939 1 from __future__ import print_function 1 2 import sys 2 3 … … 34 35 apiutil.CopyrightC() 35 36 36 print 37 print("""#include "cr_blitter.h" 37 38 #include "cr_spu.h" 38 39 #include "chromium.h" … … 52 53 53 54 #ifdef VBOX_WITH_CRDUMPER 54 """ 55 """) 55 56 56 57 from get_sizes import *; … … 69 70 # print "//%s" % prop 70 71 # 71 print 72 print(""" 72 73 static void crRecDumpPrintVal(CR_DUMPER *pDumper, struct nv_struct *pDesc, float *pfData) 73 74 { … … 94 95 { 95 96 GLboolean fEnabled; 96 """ 97 keys = params.keys() 98 keys.sort(); 99 100 for pname in keys: 101 print "\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname 102 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname 103 104 keys = extended_params.keys(); 105 keys.sort() 106 107 for pname in keys: 97 """) 98 for pname in sorted(params.keys()): 99 print("\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname) 100 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname) 101 102 for pname in sorted(extended_params.keys()): 108 103 (srctype,ifdef,fields) = extended_params[pname] 109 104 ext = ifdef[3:] # the extension name with the "GL_" prefix removed 110 105 ext = ifdef 111 print '#ifdef CR_%s' % ext112 print "\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname113 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname114 print '#endif /* CR_%s */' % ext106 print('#ifdef CR_%s' % ext) 107 print("\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname) 108 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname) 109 print('#endif /* CR_%s */' % ext) 115 110 116 111 #print "//missing enable props:" … … 124 119 # print "//%s" % prop 125 120 # 126 print 121 print(""" 127 122 } 128 123 #endif 129 """ 124 """) 130 125 131 126 texenv_mappings = { … … 184 179 ] 185 180 186 print 181 print(""" 187 182 void crRecDumpTexParam(CR_RECORDER *pRec, CRContext *ctx, GLenum enmTarget) 188 183 { … … 191 186 unsigned int cComponents; 192 187 crDmpStrF(pRec->pDumper, "==TEX_PARAM for target(0x%x)==", enmTarget); 193 """ 188 """) 194 189 for pname in texparam_names: 195 print "\tcComponents = crStateHlpComponentsCount(%s);" % pname196 print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));"197 print "\tmemset(afBuf, 0, sizeof (afBuf));"198 print "\tpRec->pDispatch->GetTexParameterfv(enmTarget, %s, afBuf);" % pname199 print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);"200 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname201 print 190 print("\tcComponents = crStateHlpComponentsCount(%s);" % pname) 191 print("\tAssert(cComponents <= RT_ELEMENTS(afBuf));") 192 print("\tmemset(afBuf, 0, sizeof (afBuf));") 193 print("\tpRec->pDispatch->GetTexParameterfv(enmTarget, %s, afBuf);" % pname) 194 print("\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);") 195 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname) 196 print(""" 202 197 crDmpStrF(pRec->pDumper, "==Done TEX_PARAM for target(0x%x)==", enmTarget); 203 198 } 204 """ 205 206 print 199 """) 200 201 print(""" 207 202 void crRecDumpTexEnv(CR_RECORDER *pRec, CRContext *ctx) 208 203 { … … 211 206 unsigned int cComponents; 212 207 crDmpStrF(pRec->pDumper, "==TEX_ENV=="); 213 """ 214 215 keys = texenv_mappings.keys() 216 keys.sort(); 217 218 for target in keys: 219 print "\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % target 208 """) 209 210 for target in sorted(texenv_mappings.keys()): 211 print("\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % target) 220 212 values = texenv_mappings[target] 221 213 for pname in values: 222 print "\tcComponents = crStateHlpComponentsCount(%s);" % pname223 print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));"224 print "\tmemset(afBuf, 0, sizeof (afBuf));"225 print "\tpRec->pDispatch->GetTexEnvfv(%s, %s, afBuf);" % (target, pname)226 print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);"227 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname228 print "\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % target229 print 214 print("\tcComponents = crStateHlpComponentsCount(%s);" % pname) 215 print("\tAssert(cComponents <= RT_ELEMENTS(afBuf));") 216 print("\tmemset(afBuf, 0, sizeof (afBuf));") 217 print("\tpRec->pDispatch->GetTexEnvfv(%s, %s, afBuf);" % (target, pname)) 218 print("\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);") 219 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname) 220 print("\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % target) 221 print(""" 230 222 crDmpStrF(pRec->pDumper, "==Done TEX_ENV=="); 231 223 } 232 """ 233 234 235 print 224 """) 225 226 227 print(""" 236 228 void crRecDumpTexGen(CR_RECORDER *pRec, CRContext *ctx) 237 229 { … … 240 232 unsigned int cComponents; 241 233 crDmpStrF(pRec->pDumper, "==TEX_GEN=="); 242 """ 234 """) 243 235 244 236 for coord in texgen_coords: 245 print "\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % coord237 print("\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % coord) 246 238 for pname in texgen_names: 247 print "\tcComponents = crStateHlpComponentsCount(%s);" % pname248 print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));"249 print "\tmemset(afBuf, 0, sizeof (afBuf));"250 print "\tpRec->pDispatch->GetTexGendv(%s, %s, afBuf);" % (coord, pname)251 print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);"252 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname253 print "\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % coord254 print 239 print("\tcComponents = crStateHlpComponentsCount(%s);" % pname) 240 print("\tAssert(cComponents <= RT_ELEMENTS(afBuf));") 241 print("\tmemset(afBuf, 0, sizeof (afBuf));") 242 print("\tpRec->pDispatch->GetTexGendv(%s, %s, afBuf);" % (coord, pname)) 243 print("\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);") 244 print("\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname) 245 print("\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % coord) 246 print(""" 255 247 crDmpStrF(pRec->pDumper, "==Done TEX_GEN=="); 256 248 } 257 """ 249 """) -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/gendiffcode.py
r33540 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 10 11 Name = sys.argv[2] 11 12 12 print 13 print("""/* This code is AUTOGENERATED!!! */ 13 14 14 15 #include "state.h" 15 #include "state_internals.h\"""" 16 17 print 16 #include "state_internals.h\"""") 17 18 print(""" 18 19 void crState%(Name)sDiff(CR%(Name)sBits *b, CRbitvalue *bitID, 19 20 CRContext *fromCtx, CRContext *toCtx) 20 21 { 21 22 CR%(Name)sState *from = &(fromCtx->%(name)s); 22 CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars() 23 CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars()) 23 24 gendiffcode("state_%s.txt"%(name.lower()), name, docopy=1, doinvalid=0) 24 print 25 print("""} 25 26 26 27 void crState%(Name)sSwitch(CR%(Name)sBits *b, CRbitvalue *bitID, … … 28 29 { 29 30 CR%(Name)sState *from = &(fromCtx->%(name)s); 30 CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars() 31 CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars()) 31 32 gendiffcode("state_%s.txt"%(Name.lower()), Name, docopy=0, doinvalid=1) 32 print "}\n"33 print("}\n") 33 34 34 35 def gendiffcode(fname, state_name, docopy, doinvalid): … … 55 56 FILE = open(sys.argv[3]+"/"+fname, "r") 56 57 57 print 58 print(""" unsigned int j, i; 58 59 CRbitvalue nbitID[CR_MAX_BITARRAY]; 59 60 for (j=0;j<CR_MAX_BITARRAY;j++) 60 61 nbitID[j] = ~bitID[j]; 61 i = 0; /* silence compiler */""" 62 i = 0; /* silence compiler */""") 62 63 63 64 import re 64 for line in FILE .xreadlines():65 for line in FILE: 65 66 line = line.rstrip() 66 67 … … 87 88 if re.search("}", line): 88 89 tab = tab[:-1] 89 print tab+text90 print(tab+text) 90 91 if re.search("{", line): 91 92 tab = tab+"\t" … … 109 110 if re.search("%flush", line): 110 111 if current_guard != "": 111 print tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars()112 tab = tab[:-1] 113 print tab+"}"112 print(tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars()) 113 tab = tab[:-1] 114 print(tab+"}") 114 115 if docopy and current_dependency != "": 115 116 tab = tab[:-1] 116 print tab+"}"117 print(tab+"}") 117 118 current_guard = "" 118 119 current_dependency = "" … … 127 128 ## Close the guardbit and dependency 128 129 if current_guard != "" and current_guard != guardbit: 129 print tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars()130 print(tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars()) 130 131 tab = tab[:-1] 131 print tab+"}"132 print(tab+"}") 132 133 if docopy and current_dependency != "" and current_dependency != dependency: 133 134 tab = tab[:-1] 134 print tab+"}"135 print(tab+"}") 135 136 136 137 ## Open the dependency if 137 138 if docopy and current_dependency != dependency and dependency != "": 138 print tab+"if (%(target)s->%(dependency)s)\n%(tab)s{"%vars()139 print(tab+"if (%(target)s->%(dependency)s)\n%(tab)s{"%vars()) 139 140 tab = tab+"\t" 140 141 current_dependency = dependency … … 142 143 ## Open the guard if 143 144 if docopy and current_dependency != dependency and dependency != "": 144 print tab+"if ($(target)s->%(dependency)s)\n%(tab)s{"%vars()145 print(tab+"if ($(target)s->%(dependency)s)\n%(tab)s{"%vars()) 145 146 tab = tab+"\t" 146 147 147 148 if current_guard != guardbit and guardbit != "": 148 print tab+"if (CHECKDIRTY(%(bit)s->%(guardbit)s, bitID))\n%(tab)s{"%vars()149 print(tab+"if (CHECKDIRTY(%(bit)s->%(guardbit)s, bitID))\n%(tab)s{"%vars()) 149 150 tab = tab+"\t" 150 151 if members[0] != "*" and guardbit[0:6] == "enable": 151 print tab+"glAble able[2];"152 print tab+"able[0] = diff_api.Disable;"153 print tab+"able[1] = diff_api.Enable;"152 print(tab+"glAble able[2];") 153 print(tab+"able[0] = diff_api.Disable;") 154 print(tab+"able[1] = diff_api.Enable;") 154 155 155 156 current_dependency = dependency … … 158 159 ## Handle text dump 159 160 if members[0] == "*": 160 print tab+members[1:]161 print(tab+members[1:]) 161 162 else: 162 163 ## Parse the members variable … … 181 182 for elem in elems: 182 183 if first != 1: 183 print " ||\n"+tab+" ",184 print(" ||\n"+tab+" ", end="") 184 185 first = 0 185 186 sys.stdout.write("%(current)s->%(elem)s != %(target)s->%(elem)s"%vars()) 186 print ")\n"+tab+"{"187 print(")\n"+tab+"{") 187 188 tab = tab+"\t" 188 189 … … 190 191 if func[0] == "*": 191 192 func = func[1:] 192 print tab+func193 print(tab+func) 193 194 else: 194 195 if func != "": 195 196 ## Call the glhw function 196 197 if guardbit[0:6] == "enable": 197 print tab+"able["+target+"->"+elems[0]+"]("+func+");"198 print(tab+"able["+target+"->"+elems[0]+"]("+func+");") 198 199 elif guardbit == "extensions": 199 print tab+"crState$state_name",200 print(tab+"crState$state_name",end="") 200 201 if docopy == 1: 201 print "Diff",202 print("Diff",end="") 202 203 else: 203 print "Switch",204 print "Extensions( from, to );"204 print("Switch",end="") 205 print("Extensions( from, to );") 205 206 else: 206 207 funcargs = re.split(",", func) … … 211 212 v_type = func[-2:-1] 212 213 num_elems = len(elems) 213 print tab+v_types[v_type]+" varg["+str(num_elems)+"];"214 print(tab+v_types[v_type]+" varg["+str(num_elems)+"];") 214 215 i = 0 215 216 for elem in elems: 216 print tab+"varg["+str(i)+"] = "+target+"->"+elem+";"217 print(tab+"varg["+str(i)+"] = "+target+"->"+elem+";") 217 218 i += 1 218 219 elif func[-3:] == "vNV": 219 220 v_type = func[-4:-3] 220 221 num_elems = len(elems) 221 print tab+v_types[v_type]+" varg["+str(num_elems)+"];"222 print(tab+v_types[v_type]+" varg["+str(num_elems)+"];") 222 223 i = 0 223 224 for elem in elems: 224 print tab+"varg["+str(i)+"] = "+target+"->"+elem+";"225 print(tab+"varg["+str(i)+"] = "+target+"->"+elem+";") 225 226 i += 1 226 227 … … 239 240 first = 0 240 241 sys.stdout.write(target+"->"+elem) 241 print ");"242 print(");") 242 243 243 244 ## Do the sync if necessary 244 245 if docopy and guardbit != "extensions": 245 246 for elem in mainelem: 246 print tab+current+"->"+elem+" = "+target+"->"+elem+";"247 print(tab+current+"->"+elem+" = "+target+"->"+elem+";") 247 248 248 249 ## Do the clear if necessary 249 250 if doinvalid: 250 251 if guardbit != "": 251 print tab+"FILLDIRTY(%(bit)s->%(guardbit)s);"%vars()252 print tab+"FILLDIRTY(%(bit)s->dirty);"%vars()252 print(tab+"FILLDIRTY(%(bit)s->%(guardbit)s);"%vars()) 253 print(tab+"FILLDIRTY(%(bit)s->dirty);"%vars()) 253 254 if extrabit != "": 254 print tab+"FILLDIRTY(%(extrabit)s->dirty);"%vars()255 print(tab+"FILLDIRTY(%(extrabit)s->dirty);"%vars()) 255 256 256 257 ## Close the compare 257 258 if guardbit != "extensions": 258 259 tab = tab[:-1] 259 print tab+"}"260 print(tab+"}") 260 261 261 262 ## Do final closures 262 263 if current_guard != "": 263 print tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars()264 print(tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars()) 264 265 tab = tab[:-1] 265 print tab+"}"266 print(tab+"}") 266 267 if docopy and current_dependency != "": 267 268 tab = tab[:-1] 268 print tab+"} /*%(current_dependency)s*/"%vars()269 270 print tab+"CLEARDIRTY(%(bit)s->dirty, nbitID);"%vars()269 print(tab+"} /*%(current_dependency)s*/"%vars()) 270 271 print(tab+"CLEARDIRTY(%(bit)s->dirty, nbitID);"%vars()) 271 272 272 273 main() -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/get_components.py
r50041 r63939 3 3 # 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 6 from __future__ import print_function 5 7 6 8 num_components = { … … 114 116 } 115 117 116 print 118 print("""unsigned int crStateHlpComponentsCount( GLenum pname ) 117 119 { 118 120 switch( pname ) 119 121 { 120 """ 121 comps = num_components.keys(); 122 comps.sort(); 123 for comp in comps: 124 print '\t\t\tcase %s: return %d;' % (comp,num_components[comp]) 122 """) 123 for comp in sorted(num_components.keys()): 124 print('\t\t\tcase %s: return %d;' % (comp,num_components[comp])) 125 125 126 comps = num_extended_components.keys(); 127 comps.sort(); 128 for comp in comps: 126 for comp in sorted(num_extended_components.keys()): 129 127 (nc, ifdef) = num_extended_components[comp] 130 print '#ifdef %s' % ifdef131 print '\t\t\tcase %s: return %d;' % (comp,nc)132 print '#endif /* %s */' % ifdef128 print('#ifdef %s' % ifdef) 129 print('\t\t\tcase %s: return %d;' % (comp,nc)) 130 print('#endif /* %s */' % ifdef) 133 131 134 print 132 print(""" 135 133 default: 136 134 crError( "Unknown parameter name in crStateHlpComponentsCount: %d", (int) pname ); … … 140 138 return 0; 141 139 } 142 """ 140 """) 143 141 144 142 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.py
r51319 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(''' 14 15 #include "state/cr_currentpointers.h" 15 16 #include "state.h" … … 22 23 23 24 typedef void (*convert_func) (GLfloat *, const unsigned char *); 24 ''' 25 ''') 25 26 26 27 import convert 27 28 28 for k in current_fns.keys():29 for k in sorted(current_fns.keys()): 29 30 name = k 30 31 name = '%s%s' % (k[:1].lower(),k[1:]) … … 32 33 num_members = len(current_fns[k]['default']) + 1 33 34 34 print '#define VPINCH_CONVERT_%s(op,data,dst) \\' % ucname35 print '{\\'36 print '\tGLfloat vdata[%d] = {' % num_members,35 print('#define VPINCH_CONVERT_%s(op,data,dst) \\' % ucname) 36 print('{\\') 37 print('\tGLfloat vdata[%d] = {' % num_members, end=' ') 37 38 38 39 ## Copy dst data into vdata 39 40 i = 0; 40 41 for defaultvar in current_fns[k]['default']: 41 print '%d' % defaultvar,42 print('%d' % defaultvar, end=' ') 42 43 if i != num_members: 43 print ',',44 print(',', end=' ') 44 45 i += 1 45 print '};\\'46 47 print '\tswitch (op) { \\'46 print('};\\') 47 48 print('\tswitch (op) { \\') 48 49 for type in current_fns[k]['types']: 49 50 if type[0:1] == "N": … … 55 56 uctype = type.upper() 56 57 if ucname == 'EDGEFLAG': 57 print '\tcase CR_%s_OPCODE: \\' % ucname58 print('\tcase CR_%s_OPCODE: \\' % ucname) 58 59 else: 59 print '\tcase CR_%s%d%s_OPCODE: \\' % (ucname,size,uctype)60 print('\tcase CR_%s%d%s_OPCODE: \\' % (ucname,size,uctype)) 60 61 61 62 if (ucname == 'COLOR' or ucname == 'NORMAL' or ucname == 'SECONDARYCOLOR' or normalize) and type != 'f' and type != 'd': 62 print '\t\t__convert_rescale_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type'])63 print('\t\t__convert_rescale_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type'])) 63 64 else: 64 print '\t\t__convert_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type'])65 print '\t\tbreak; \\'66 67 print '\tdefault: \\'68 print '\t\tcrSimpleError ( "Unknown opcode in VPINCH_CONVERT_%s" ); \\' % ucname69 print '\t}\\'65 print('\t\t__convert_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type'])) 66 print('\t\tbreak; \\') 67 68 print('\tdefault: \\') 69 print('\t\tcrSimpleError ( "Unknown opcode in VPINCH_CONVERT_%s" ); \\' % ucname) 70 print('\t}\\') 70 71 71 72 i = 0 72 73 for member in current_fns[k]['members']: 73 print '\t(dst).%s = vdata[%d];\\' % (member,i)74 print('\t(dst).%s = vdata[%d];\\' % (member,i)) 74 75 i += 1 75 76 76 print '}\n'77 78 print 77 print('}\n') 78 79 print(''' 79 80 80 81 void crStateCurrentRecover( void ) … … 187 188 c->colorIndexPre = c->colorIndex; 188 189 189 ''' 190 191 for k in current_fns.keys():192 print '\t/* %s */' % k193 print '\tv=NULL;'190 ''') 191 192 for k in sorted(current_fns.keys()): 193 print('\t/* %s */' % k) 194 print('\tv=NULL;') 194 195 name = '%s%s' % (k[:1].lower(),k[1:]) 195 196 196 197 indent = "" 197 if current_fns[k].has_key( 'array' ):198 print '\tfor (i = 0 ; i < %s ; i++)' % current_fns[k]['array']199 print '\t{'198 if 'array' in current_fns[k]: 199 print('\tfor (i = 0 ; i < %s ; i++)' % current_fns[k]['array']) 200 print('\t{') 200 201 indent += "\t" 201 202 for type in current_fns[k]['types']: … … 208 209 for size in current_fns[k]['sizes']: 209 210 ptr = '%s->%s%d' % (name, type, size ) 210 if current_fns[k].has_key( 'array' ):211 if 'array' in current_fns[k]: 211 212 ptr += "[i]" 212 print '%s\tif (v < %s)' % (indent, ptr)213 print '%s\t{' % indent214 print '%s\t\tv = %s;' % (indent, ptr)213 print('%s\tif (v < %s)' % (indent, ptr)) 214 print('%s\t{' % indent) 215 print('%s\t\tv = %s;' % (indent, ptr)) 215 216 if (k == 'Color' or k == 'Normal' or k == 'SecondaryColor' or normalized) and type != 'f' and type != 'd' and type != 'l': 216 print '%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size)217 print('%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size)) 217 218 else: 218 print '%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size)219 print '%s\t}' % indent220 print ''221 print '%s\tif (v != NULL) {' % indent222 if current_fns[k].has_key( 'array' ):219 print('%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size)) 220 print('%s\t}' % indent) 221 print('') 222 print('%s\tif (v != NULL) {' % indent) 223 if 'array' in current_fns[k]: 223 224 if k == 'TexCoord': 224 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name)225 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name)) 225 226 else: 226 print '%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name)227 print('%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name)) 227 228 else: 228 229 if k == 'Normal': 229 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name)230 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name)) 230 231 elif k == 'FogCoord': 231 print '%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] = %s_default;' % (indent,name)232 print('%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] = %s_default;' % (indent,name)) 232 233 elif k == 'Color': 233 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name)234 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name)) 234 235 elif k == 'SecondaryColor': 235 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1], %s_default);' % (indent,name)236 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1], %s_default);' % (indent,name)) 236 237 elif k == 'TexCoord': 237 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name)238 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name)) 238 239 elif k == 'Index': 239 print '%s\t\tc->colorIndex = %s_default;' % (indent,name)240 print('%s\t\tc->colorIndex = %s_default;' % (indent,name)) 240 241 elif k == 'EdgeFlag': 241 print '%s\t\tc->edgeFlag = %s_default;' % (indent,name)242 print('%s\t\tc->edgeFlag = %s_default;' % (indent,name)) 242 243 else: 243 print '%s\t\tc->%s = %s_default;' % (indent,name,name)244 print('%s\t\tc->%s = %s_default;' % (indent,name,name)) 244 245 if k == 'EdgeFlag': 245 print '%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent)246 print('%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent)) 246 247 dirtyVar = 'cb->edgeFlag' 247 248 elif k == 'Normal': 248 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent)249 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent)) 249 250 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_NORMAL]' 250 251 elif k == 'TexCoord': 251 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent)252 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent)) 252 253 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_TEX0 + i]' 253 254 elif k == 'Color': 254 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent)255 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent)) 255 256 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR0]' 256 257 elif k == 'Index': 257 print '%s\t\tconvert(&(c->colorIndex), v);' % (indent)258 print('%s\t\tconvert(&(c->colorIndex), v);' % (indent)) 258 259 dirtyVar = 'cb->colorIndex' 259 260 elif k == 'SecondaryColor': 260 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent)261 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent)) 261 262 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR1]' 262 263 elif k == 'FogCoord': 263 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent)264 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent)) 264 265 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_FOG]' 265 266 elif k == 'VertexAttrib': 266 print '%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent)267 print('%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent)) 267 268 dirtyVar = 'cb->vertexAttrib[i]' 268 269 else: 269 270 assert 0 # should never get here 270 271 271 print '%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar)272 print('%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar)) 272 273 273 274 # if current_fns[k].has_key( 'array' ): … … 278 279 279 280 280 print '%s\t\tDIRTY(cb->dirty, nbitID);' % indent281 print '%s\t}' % indent282 if current_fns[k].has_key( 'array' ):283 print '%s\t%s->ptr[i] = v;' % (indent, name)281 print('%s\t\tDIRTY(cb->dirty, nbitID);' % indent) 282 print('%s\t}' % indent) 283 if 'array' in current_fns[k]: 284 print('%s\t%s->ptr[i] = v;' % (indent, name )) 284 285 else: 285 print '%s\t%s->ptr = v;' % (indent, name)286 if current_fns[k].has_key( 'array' ):287 print '\t}'288 print '}'289 290 print 286 print('%s\t%s->ptr = v;' % (indent, name )) 287 if 'array' in current_fns[k]: 288 print('\t}') 289 print('}') 290 291 print(''' 291 292 292 293 void crStateCurrentRecoverNew(CRContext *g, CRCurrentStatePointers *current) … … 365 366 366 367 367 ''' 368 369 for k in current_fns_new.keys():370 print '\t/* %s */' % k371 print '\tif (current->changed%s)' % k372 print '\t{'373 print '\t\tv=NULL;'368 ''') 369 370 for k in sorted(current_fns_new.keys()): 371 print('\t/* %s */' % k) 372 print('\tif (current->changed%s)' % k) 373 print('\t{') 374 print('\t\tv=NULL;') 374 375 name = '%s%s' % (k[:1].lower(),k[1:]) 375 376 376 377 indent = "" 377 if current_fns_new[k].has_key( 'array' ):378 print '\t\tfor (i = 0 ; i < %s ; i++)' % current_fns_new[k]['array']379 print '\t\t{'378 if 'array' in current_fns_new[k]: 379 print('\t\tfor (i = 0 ; i < %s ; i++)' % current_fns_new[k]['array']) 380 print('\t\t{') 380 381 indent += "\t\t" 381 print '\t\tif (!(current->changed%s & (1 << i))) continue;' % k382 print('\t\tif (!(current->changed%s & (1 << i))) continue;' % k) 382 383 for type in current_fns_new[k]['types']: 383 384 if type[0:1] == "N": … … 389 390 for size in current_fns_new[k]['sizes']: 390 391 ptr = '%s->%s%d' % (name, type, size ) 391 if current_fns_new[k].has_key( 'array' ):392 if 'array' in current_fns_new[k]: 392 393 ptr += "[i]" 393 print '#ifdef DEBUG_misha'394 print '%s\tif (%s)' % (indent, ptr)395 print '%s\t{' % (indent)396 print '%s\t\tuint32_t *pTst = (uint32_t*)(%s);' % (indent, ptr)397 print '%s\t\t--pTst;' % (indent)398 print '%s\t\tAssert((*pTst) == i);' % (indent)399 print '%s\t}' % (indent)400 print '#endif'401 print '%s\tif (v < %s)' % (indent, ptr)402 print '%s\t{' % indent403 print '%s\t\tv = %s;' % (indent, ptr)394 print('#ifdef DEBUG_misha') 395 print('%s\tif (%s)' % (indent, ptr)) 396 print('%s\t{' % (indent)) 397 print('%s\t\tuint32_t *pTst = (uint32_t*)(%s);' % (indent, ptr)) 398 print('%s\t\t--pTst;' % (indent)) 399 print('%s\t\tAssert((*pTst) == i);' % (indent)) 400 print('%s\t}' % (indent)) 401 print('#endif') 402 print('%s\tif (v < %s)' % (indent, ptr)) 403 print('%s\t{' % indent) 404 print('%s\t\tv = %s;' % (indent, ptr)) 404 405 if (k == 'Color' or k == 'Normal' or k == 'SecondaryColor' or normalized) and type != 'f' and type != 'd' and type != 'l': 405 print '%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size)406 print('%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size)) 406 407 else: 407 print '%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size)408 print '%s\t}' % indent409 print ''410 print '%s\tif (v != NULL) {' % indent411 if current_fns_new[k].has_key( 'array' ):408 print('%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size)) 409 print('%s\t}' % indent) 410 print('') 411 print('%s\tif (v != NULL) {' % indent) 412 if 'array' in current_fns_new[k]: 412 413 if k == 'TexCoord': 413 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name)414 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name)) 414 415 else: 415 print '%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name)416 print('%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name)) 416 417 else: 417 418 if k == 'Normal': 418 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name)419 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name)) 419 420 elif k == 'FogCoord': 420 print '%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] = %s_default;' % (indent,name)421 print('%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] = %s_default;' % (indent,name)) 421 422 elif k == 'Color': 422 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name)423 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name)) 423 424 elif k == 'SecondaryColor': 424 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1], %s_default);' % (indent,name)425 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1], %s_default);' % (indent,name)) 425 426 elif k == 'TexCoord': 426 print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name)427 print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name)) 427 428 elif k == 'Index': 428 print '%s\t\tc->colorIndex = %s_default;' % (indent,name)429 print('%s\t\tc->colorIndex = %s_default;' % (indent,name)) 429 430 elif k == 'EdgeFlag': 430 print '%s\t\tc->edgeFlag = %s_default;' % (indent,name)431 print('%s\t\tc->edgeFlag = %s_default;' % (indent,name)) 431 432 else: 432 print '%s\t\tc->%s = %s_default;' % (indent,name,name)433 print('%s\t\tc->%s = %s_default;' % (indent,name,name)) 433 434 if k == 'EdgeFlag': 434 print '%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent)435 print('%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent)) 435 436 dirtyVar = 'cb->edgeFlag' 436 437 elif k == 'Normal': 437 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent)438 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent)) 438 439 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_NORMAL]' 439 440 elif k == 'TexCoord': 440 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent)441 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent)) 441 442 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_TEX0 + i]' 442 443 elif k == 'Color': 443 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent)444 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent)) 444 445 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR0]' 445 446 elif k == 'Index': 446 print '%s\t\tconvert(&(c->colorIndex), v);' % (indent)447 print('%s\t\tconvert(&(c->colorIndex), v);' % (indent)) 447 448 dirtyVar = 'cb->colorIndex' 448 449 elif k == 'SecondaryColor': 449 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent)450 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent)) 450 451 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR1]' 451 452 elif k == 'FogCoord': 452 print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent)453 print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent)) 453 454 dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_FOG]' 454 455 elif k == 'VertexAttrib': 455 print '%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent)456 print('%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent)) 456 457 dirtyVar = 'cb->vertexAttrib[i]' 457 458 else: 458 459 assert 0 # should never get here 459 460 460 print '%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar)461 print('%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar)) 461 462 462 463 # if current_fns_new[k].has_key( 'array' ): … … 467 468 468 469 469 print '%s\t\tDIRTY(cb->dirty, nbitID);' % indent470 print '%s\t}' % indent471 if current_fns_new[k].has_key( 'array' ):472 print '%s\t%s->ptr[i] = v;' % (indent, name)470 print('%s\t\tDIRTY(cb->dirty, nbitID);' % indent) 471 print('%s\t}' % indent) 472 if 'array' in current_fns_new[k]: 473 print('%s\t%s->ptr[i] = v;' % (indent, name )) 473 474 else: 474 print '%s\t%s->ptr = v;' % (indent, name)475 if current_fns_new[k].has_key( 'array' ):476 print '\t\t}'477 print '\t\tcurrent->changed%s = 0;' % k478 print '\t}'479 print '\tcrStateResetCurrentPointers(current);'480 print '}'475 print('%s\t%s->ptr = v;' % (indent, name )) 476 if 'array' in current_fns_new[k]: 477 print('\t\t}') 478 print('\t\tcurrent->changed%s = 0;' % k) 479 print('\t}') 480 print('\tcrStateResetCurrentPointers(current);') 481 print('}') -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_funcs.py
r15532 r63939 5 5 6 6 7 from __future__ import print_function 7 8 import sys 8 9 … … 13 14 apiutil.CopyrightC() 14 15 15 print 16 print(""" 16 17 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY state_funcs.py SCRIPT */ 17 18 #ifndef CR_STATE_FUNCS_H … … 33 34 #endif 34 35 35 #define STATE_UNUSED(x) ((void)x)""" 36 #define STATE_UNUSED(x) ((void)x)""") 36 37 37 38 … … 40 41 return_type = apiutil.ReturnType(func_name) 41 42 params = apiutil.Parameters(func_name) 42 print 'DECLEXPORT(%s) STATE_APIENTRY crState%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))43 print('DECLEXPORT(%s) STATE_APIENTRY crState%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 43 44 44 45 for func_name in apiutil.AllSpecials( "state_feedback" ): 45 46 return_type = apiutil.ReturnType(func_name) 46 47 params = apiutil.Parameters(func_name) 47 print 'DECLEXPORT(%s) STATE_APIENTRY crStateFeedback%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))48 print('DECLEXPORT(%s) STATE_APIENTRY crStateFeedback%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 48 49 49 50 for func_name in apiutil.AllSpecials( "state_select" ): 50 51 return_type = apiutil.ReturnType(func_name) 51 52 params = apiutil.Parameters(func_name) 52 print 'DECLEXPORT(%s) STATE_APIENTRY crStateSelect%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))53 print('DECLEXPORT(%s) STATE_APIENTRY crStateSelect%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 53 54 54 55 55 print 56 print(""" 56 57 #ifdef __cplusplus 57 58 } … … 59 60 60 61 #endif /* CR_STATE_FUNCS_H */ 61 """ 62 """) -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_get.py
r50041 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys, re, string 7 8 import apiutil … … 21 22 type = match.group(1) 22 23 pname = match.group(2) 23 fields = string.split( match.group(3))24 fields = match.group(3).split() 24 25 params[pname] = ( type, fields ) 25 26 … … 33 34 pname = match.group(2) 34 35 ifdef = match.group(3) 35 fields = string.split( match.group(4))36 fields = match.group(4).split() 36 37 extended_params[pname] = ( type, ifdef, fields ) 37 38 … … 104 105 apiutil.CopyrightC() 105 106 106 print 107 print(""" 107 108 /* DO NOT EDIT - THIS FILE GENERATED BY state_get.txt AND THE state_get.py SCRIPT */ 108 109 #include <stdio.h> … … 141 142 return g->framebufferobject.readFB ? g->framebufferobject.readFB->readbuffer : g->buffer.readBuffer; 142 143 } 143 """ 144 """) 144 145 145 146 header = """ … … 173 174 174 175 for rettype in types: 175 print '' 176 print 'void STATE_APIENTRY crStateGet%sv( GLenum pname, %s *params )' % ( rettype, ctypes[rettype] ) 177 print header 178 179 keys = params.keys() 180 keys.sort() 181 for pname in keys: 182 print '\t\tcase %s:' % pname 176 print('') 177 print('void STATE_APIENTRY crStateGet%sv( GLenum pname, %s *params )' % ( rettype, ctypes[rettype] )) 178 print(header) 179 180 for pname in sorted(params.keys()): 181 print('\t\tcase %s:' % pname) 183 182 (srctype,fields) = params[pname] 184 183 try: … … 187 186 for field in fields: 188 187 expr = cvt % field 189 print '\t\t\tparams[%d] = %s;' % (i,expr)188 print('\t\t\tparams[%d] = %s;' % (i,expr)) 190 189 i += 1 191 190 except: 192 print '\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");' 193 print "\t\t\tbreak;" 194 195 196 keys = extended_params.keys(); 197 keys.sort() 198 for pname in keys: 191 print('\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");') 192 print("\t\t\tbreak;") 193 194 195 for pname in sorted(extended_params.keys()): 199 196 (srctype,ifdef,fields) = extended_params[pname] 200 197 ext = ifdef[3:] # the extension name with the "GL_" prefix removed 201 198 #print '#ifdef %s' % ifdef 202 print '#ifdef CR_%s' % ext203 print '\t\tcase %s:' % pname199 print('#ifdef CR_%s' % ext) 200 print('\t\tcase %s:' % pname) 204 201 if ext != 'OPENGL_VERSION_1_2': 205 print '\t\t\tif (g->extensions.%s) {' % ext202 print('\t\t\tif (g->extensions.%s) {' % ext) 206 203 try: 207 204 cvt = convert[srctype][rettype] … … 211 208 if field[0] == '%': 212 209 command = string.split(field, '%') 213 print '\t\t\t\t%s;' % command[1]210 print('\t\t\t\t%s;' % command[1]) 214 211 continue 215 212 elif ext != 'OPENGL_VERSION_1_2': 216 print '\t\t\t\tparams[%d] = %s;' % (i,expr)213 print('\t\t\t\tparams[%d] = %s;' % (i,expr)) 217 214 else: 218 print '\t\t\tparams[%d] = %s;' % (i,expr)215 print('\t\t\tparams[%d] = %s;' % (i,expr)) 219 216 i += 1 220 217 except: 221 print '\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");'218 print('\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");') 222 219 if ext != 'OPENGL_VERSION_1_2': 223 print "\t\t\t}"224 print "\t\t\telse {"225 print '\t\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_ENUM, "glGet%sv");' % rettype226 print "\t\t\t}"227 print "\t\t\tbreak;"220 print("\t\t\t}") 221 print("\t\t\telse {") 222 print('\t\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_ENUM, "glGet%sv");' % rettype) 223 print("\t\t\t}") 224 print("\t\t\tbreak;") 228 225 #print '#endif /* %s */' % ifdef 229 print '#endif /* CR_%s */' % ext230 231 print '\t\tdefault:'232 print '\t\t\tcrStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glGet: Unknown enum: 0x%x", pname);'233 print '\t\t\treturn;'234 print '\t}'235 print '}'226 print('#endif /* CR_%s */' % ext) 227 228 print('\t\tdefault:') 229 print('\t\t\tcrStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glGet: Unknown enum: 0x%x", pname);') 230 print('\t\t\treturn;') 231 print('\t}') 232 print('}') 236 233 237 234 from get_components import * -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_isenabled.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys, re, string 7 8 import apiutil … … 20 21 type = match.group(1) 21 22 pname = match.group(2) 22 fields = string.split( match.group(3))23 fields = match.group(3).split() 23 24 params[pname] = ( type, fields ) 24 25 … … 30 31 pname = match.group(2) 31 32 ifdef = match.group(3) 32 fields = string.split( match.group(4))33 fields = match.group(4).split() 33 34 extended_params[pname] = ( type, ifdef, fields ) 34 35 35 36 apiutil.CopyrightC() 36 37 37 print 38 print(""" 38 39 /* DO NOT EDIT - THIS FILE GENERATED BY THE state_isenabled.py SCRIPT */ 39 40 #include <stdio.h> … … 54 55 55 56 switch ( pname ) { 56 """ 57 """) 57 58 58 keys = params.keys() 59 keys.sort(); 59 for pname in sorted(params.keys()): 60 print("\tcase %s:" % pname) 61 print("\t\treturn %s;" % params[pname][1][0]) 60 62 61 for pname in keys: 62 print "\tcase %s:" % pname 63 print "\t\treturn %s;" % params[pname][1][0] 64 65 keys = extended_params.keys(); 66 keys.sort() 67 68 for pname in keys: 63 for pname in sorted(extended_params.keys()): 69 64 (srctype,ifdef,fields) = extended_params[pname] 70 65 ext = ifdef[3:] # the extension name with the "GL_" prefix removed 71 66 ext = ifdef 72 print '#ifdef CR_%s' % ext73 print "\tcase %s:" % pname74 print "\t\treturn %s;" % extended_params[pname][2][0]75 print '#endif /* CR_%s */' % ext76 print "\tdefault:"77 print "\t\tcrStateError(__LINE__, __FILE__, GL_INVALID_ENUM, \"glIsEnabled: Unknown enum: %d\", pname);"78 print "\t\treturn 0;"79 print "\t}"80 print "}"67 print('#ifdef CR_%s' % ext) 68 print("\tcase %s:" % pname) 69 print("\t\treturn %s;" % extended_params[pname][2][0]) 70 print('#endif /* CR_%s */' % ext) 71 print("\tdefault:") 72 print("\t\tcrStateError(__LINE__, __FILE__, GL_INVALID_ENUM, \"glIsEnabled: Unknown enum: %d\", pname);") 73 print("\t\treturn 0;") 74 print("\t}") 75 print("}") -
trunk/src/VBox/GuestHost/OpenGL/util/debug_opcodes.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys; 7 import cPickle;8 8 import string; 9 9 import re; … … 13 13 apiutil.CopyrightC() 14 14 15 print 15 print(""" 16 16 #include "cr_debugopcodes.h" 17 17 #include <stdio.h> 18 """ 18 """) 19 19 20 print 20 print("""void crDebugOpcodes( FILE *fp, unsigned char *ptr, unsigned int num_opcodes ) 21 21 { 22 22 \tunsigned int i; … … 25 25 \t\tswitch(*(ptr--)) 26 26 \t\t{ 27 """ 27 """) 28 28 29 29 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 32 32 for func_name in keys: 33 33 if "pack" in apiutil.ChromiumProps(func_name): 34 print '\t\tcase %s:' % apiutil.OpcodeName( func_name)35 print '\t\t\tfprintf( fp, "%s\\n" ); ' % apiutil.OpcodeName( func_name)36 print '\t\t\tbreak;'34 print('\t\tcase %s:' % apiutil.OpcodeName( func_name )) 35 print('\t\t\tfprintf( fp, "%s\\n" ); ' % apiutil.OpcodeName( func_name )) 36 print( '\t\t\tbreak;') 37 37 38 print 38 print(""" 39 39 \t\t} 40 40 \t} 41 41 } 42 """ 42 """) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.py
r57909 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 7 8 num_get_values = { … … 412 413 } 413 414 414 get_keys = num_get_values.keys() + extensions_num_get_values.keys()415 get_keys = list(num_get_values.keys()) + list(extensions_num_get_values.keys()) 415 416 get_keys.sort() 416 417 max_keyvalues = 0 417 418 418 print 419 print(""" 419 420 static struct nv_struct { GLenum pname; unsigned int num_values; 420 421 #ifdef VBOX_WITH_CRDUMPER … … 422 423 #endif 423 424 } num_values_array[] = { 424 """ 425 """) 425 426 for key in get_keys: 426 427 try: … … 428 429 if max_keyvalues < keyvalues: 429 430 max_keyvalues = keyvalues 430 print 431 print(""" 431 432 \t{ %s, %d 432 433 #ifdef VBOX_WITH_CRDUMPER … … 434 435 #endif 435 436 }, 436 """ % (key, keyvalues, key) 437 """ % (key, keyvalues, key)) 437 438 except KeyError: 438 439 (nv, ifdef) = extensions_num_get_values[key] 439 440 if max_keyvalues < nv: 440 441 max_keyvalues = nv 441 print '#ifdef %s' % ifdef442 print 442 print('#ifdef %s' % ifdef) 443 print(""" 443 444 \t{ %s, %d 444 445 #ifdef VBOX_WITH_CRDUMPER … … 446 447 #endif 447 448 }, 448 """ % (key, nv, key) 449 print '#endif /* %s */' % ifdef450 print "\t{ 0, 0 }"451 print "};"452 print "#define CR_MAX_GET_VALUES %d" % max_keyvalues453 454 print 449 """ % (key, nv, key)) 450 print('#endif /* %s */' % ifdef) 451 print("\t{ 0, 0 }") 452 print("};") 453 print("#define CR_MAX_GET_VALUES %d" % max_keyvalues) 454 455 print(""" 455 456 static unsigned int __numValues( GLenum pname ) 456 457 { … … 465 466 return 0; 466 467 } 467 """ 468 """) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py
r50443 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys, string, re 7 8 … … 12 13 apiutil.CopyrightC() 13 14 14 print 15 print(""" 15 16 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_dispatch.py SCRIPT */ 16 17 #include "cr_spu.h" … … 22 23 23 24 CRCurrentStatePointers crServerCurrent; 24 """ 25 """) 25 26 26 27 … … 33 34 wrap = apiutil.GetCategoryWrapper(func_name) 34 35 if wrap: 35 print '#if defined(CR_%s)' % wrap36 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString( params ))37 print '{'38 print '\tcrState%s( %s );' % (func_name, apiutil.MakeCallString( params ))39 print '\tcr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString( params ))40 print '}'36 print('#if defined(CR_%s)' % wrap) 37 print('void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString( params ) )) 38 print('{') 39 print('\tcrState%s( %s );' % (func_name, apiutil.MakeCallString( params ) )) 40 print('\tcr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString( params ) )) 41 print('}') 41 42 if wrap: 42 print '#endif'43 print('#endif') 43 44 44 45 … … 51 52 if m : 52 53 current = 1 53 name = string.lower( m.group(1)[:1]) + m.group(1)[1:]54 name = m.group(1)[:1].lower() + m.group(1)[1:] 54 55 type = m.group(3) + m.group(2) 55 56 m = re.search( r"^(SecondaryColor)(3)(ub|b|us|s|ui|i|f|d)(EXT)$", func_name ) 56 57 if m : 57 58 current = 1 58 name = string.lower(m.group(1)[:1]) + m.group(1)[1:]59 name = m.group(1)[:1].lower() + m.group(1)[1:] 59 60 type = m.group(3) + m.group(2) 60 61 m = re.search( r"^(TexCoord)([1234])(ub|b|us|s|ui|i|f|d)$", func_name ) 61 62 if m : 62 63 current = 1 63 name = string.lower( m.group(1)[:1]) + m.group(1)[1:]64 name = m.group(1)[:1].lower() + m.group(1)[1:] 64 65 type = m.group(3) + m.group(2) 65 66 array = "[0]" … … 74 75 if m : 75 76 current = 1 76 name = string.lower( m.group(1)[:1]) + m.group(1)[1:]77 name = m.group(1)[:1].lower() + m.group(1)[1:] 77 78 type = m.group(2) + "1" 78 79 m = re.match( r"^(EdgeFlag)$", func_name ) 79 80 if m : 80 81 current = 1 81 name = string.lower( m.group(1)[:1]) + m.group(1)[1:]82 name = m.group(1)[:1].lower() + m.group(1)[1:] 82 83 type = "l1" 83 84 m = re.match( r"^(FogCoord)(f|d)(EXT)$", func_name) 84 85 if m : 85 86 current = 1 86 name = string.lower( m.group(1)[:1]) + m.group(1)[1:]87 name = m.group(1)[:1].lower() + m.group(1)[1:] 87 88 type = m.group(2) + "1" 88 89 … … 91 92 if m : 92 93 current = 1 93 name = string.lower( m.group(1)[:1]) + m.group(1)[1:]94 name = m.group(1)[:1].lower() + m.group(1)[1:] 94 95 type = m.group(3) + m.group(2) 95 96 array = "[index]" … … 104 105 if current: 105 106 params = apiutil.Parameters(func_name) 106 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))107 print '{'108 print '\t%s' % (condition)109 print '\t{'110 print '\t\tcr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString(params))111 print "\t\tcr_server.current.c.%s.%s%s = cr_unpackData;" % (name,type,array)112 print '\t}'113 print '}\n'107 print('void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params) )) 108 print('{') 109 print('\t%s' % (condition)) 110 print('\t{') 111 print('\t\tcr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString(params) )) 112 print("\t\tcr_server.current.c.%s.%s%s = cr_unpackData;" % (name,type,array)) 113 print('\t}') 114 print('}\n') 114 115 115 print 116 print(""" 116 117 void crServerInitDispatch(void) 117 118 { 118 119 crSPUInitDispatchTable( &(cr_server.dispatch) ); 119 120 crSPUCopyDispatchTable( &(cr_server.dispatch), &(cr_server.head_spu->dispatch_table ) ); 120 """ 121 """) 121 122 122 123 for func_name in keys: … … 127 128 wrap = apiutil.GetCategoryWrapper(func_name) 128 129 if wrap: 129 print '#if defined(CR_%s)' % wrap130 print('#if defined(CR_%s)' % wrap) 130 131 131 print '\tcr_server.dispatch.%s = crServerDispatch%s;' % (func_name, func_name)132 print('\tcr_server.dispatch.%s = crServerDispatch%s;' % (func_name, func_name)) 132 133 if wrap: 133 print '#endif'134 print('#endif') 134 135 135 print '}'136 print('}') 136 137 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch_header.py
r43888 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_dispatch_header.py SCRIPT */ 14 15 #ifndef SERVER_DISPATCH_HEADER … … 28 29 #endif 29 30 30 """ 31 """) 31 32 32 33 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 40 41 return_type = apiutil.ReturnType(func_name) 41 42 42 print '%s SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString( params))43 print('%s SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString( params ))) 43 44 44 print 45 print(""" 45 46 #if defined(__cplusplus) 46 47 } … … 48 49 49 50 #endif /* SERVER_DISPATCH_HEADER */ 50 """ 51 """) -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_get.py
r50041 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(""" 14 15 #include "cr_spu.h" 15 16 #include "chromium.h" … … 19 20 #include "server_dispatch.h" 20 21 #include "server.h" 21 """ 22 """) 22 23 23 24 max_components = { … … 118 119 params = apiutil.Parameters(func_name) 119 120 120 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % (func_name, apiutil.MakeDeclarationString( params ))121 print '{'121 print('void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % (func_name, apiutil.MakeDeclarationString( params ) )) 122 print('{') 122 123 123 124 lastParam = params[-1] … … 126 127 local_argname = 'local_%s' % lastParam[0] 127 128 128 print '\t%s %s[%d];' % ( local_argtype, local_argname, max_components[func_name])129 print '\t(void) %s;' % lastParam[0]129 print('\t%s %s[%d];' % ( local_argtype, local_argname, max_components[func_name] )) 130 print('\t(void) %s;' % lastParam[0]) 130 131 131 132 params[-1] = (local_argname, local_argtype, 0) 132 133 133 print '\tcr_server.head_spu->dispatch_table.%s( %s );' % ( func_name, apiutil.MakeCallString(params))134 print('\tcr_server.head_spu->dispatch_table.%s( %s );' % ( func_name, apiutil.MakeCallString(params) )) 134 135 135 136 if func_name in convert_bufferid: 136 print '\tif (pname==GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB){'137 print '\t\tlocal_params[0]=(%s)crStateBufferHWIDtoID((GLint)local_params[0]);' % (local_argtype);138 print '\t}'137 print('\tif (pname==GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB){') 138 print('\t\tlocal_params[0]=(%s)crStateBufferHWIDtoID((GLint)local_params[0]);' % (local_argtype)) 139 print('\t}') 139 140 140 141 if func_name in no_pnames: 141 print '\tcrServerReturnValue( &(%s[0]), %d*sizeof(%s) );' % (local_argname, max_components[func_name], local_argtype );142 print('\tcrServerReturnValue( &(%s[0]), %d*sizeof(%s) );' % (local_argname, max_components[func_name], local_argtype )) 142 143 else: 143 print '\tcrServerReturnValue( &(%s[0]), crStateHlpComponentsCount(pname)*sizeof(%s) );' % (local_argname, local_argtype );144 print '}\n'144 print('\tcrServerReturnValue( &(%s[0]), crStateHlpComponentsCount(pname)*sizeof(%s) );' % (local_argname, local_argtype )) 145 print ('}\n') -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_retval.py
r52260 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print(""" 14 15 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_retval.py SCRIPT */ 15 16 #include "chromium.h" … … 56 57 CRDBGPTR_SETZ(&cr_server.return_ptr); 57 58 } 58 """ 59 """) 59 60 60 61 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 68 69 continue 69 70 if return_type != 'void': 70 print '%s SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( return_type, func_name, apiutil.MakeDeclarationString(params))71 print '{'72 print '\t%s retval;' % return_type73 print '\tretval = cr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString(params) );74 print '\tcrServerReturnValue( &retval, sizeof(retval) );'75 print '\treturn retval; /* WILL PROBABLY BE IGNORED */'76 print '}'71 print('%s SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( return_type, func_name, apiutil.MakeDeclarationString(params))) 72 print('{') 73 print('\t%s retval;' % return_type) 74 print('\tretval = cr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString(params) )) 75 print('\tcrServerReturnValue( &retval, sizeof(retval) );') 76 print('\treturn retval; /* WILL PROBABLY BE IGNORED */') 77 print('}') -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py
r50441 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print("""#include "cr_spu.h" 14 15 #include "chromium.h" 15 16 #include "cr_error.h" … … 18 19 #include "server_dispatch.h" 19 20 #include "server.h" 20 """ 21 """) 21 22 22 23 from get_sizes import *; … … 29 30 func_name = funcs[index] 30 31 params = apiutil.Parameters(func_name) 31 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))32 print '{'33 print '\t%s *get_values;' % types[index]34 print '\tint tablesize;'35 print 32 print('void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))) 33 print('{') 34 print('\t%s *get_values;' % types[index]) 35 print('\tint tablesize;') 36 print(""" 36 37 #ifdef CR_ARB_texture_compression 37 38 if (GL_COMPRESSED_TEXTURE_FORMATS_ARB == pname) … … 46 47 tablesize = __numValues( pname ) * sizeof(%s); 47 48 } 48 """ % (types[index], types[index]) 49 print '\t(void) params;'50 print '\tget_values = (%s *) crAlloc( tablesize );' % types[index]51 print '\tif (tablesize>0)'52 print '\tcr_server.head_spu->dispatch_table.%s( pname, get_values );' % func_name53 print 49 """ % (types[index], types[index])) 50 print('\t(void) params;') 51 print('\tget_values = (%s *) crAlloc( tablesize );' % types[index]) 52 print('\tif (tablesize>0)') 53 print('\tcr_server.head_spu->dispatch_table.%s( pname, get_values );' % func_name) 54 print(""" 54 55 if (GL_TEXTURE_BINDING_1D==pname 55 56 || GL_TEXTURE_BINDING_2D==pname … … 146 147 } 147 148 } 148 """ % (types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index]) 149 print '\tcrServerReturnValue( get_values, tablesize );'150 print '\tcrFree(get_values);'151 print '}\n'149 """ % (types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index])) 150 print('\tcrServerReturnValue( get_values, tablesize );') 151 print('\tcrFree(get_values);') 152 print('}\n') -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py
r52570 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 11 12 apiutil.CopyrightC() 12 13 13 print 14 print("""/* DO NOT EDIT! THIS CODE IS AUTOGENERATED BY unpack.py */ 14 15 15 16 #include "unpacker.h" … … 40 41 static GLenum g_VBoxDbgCrPrevExtendOpcode = 0; 41 42 #endif 42 """ 43 """) 43 44 44 45 nodebug_opcodes = [ … … 81 82 arg_len = apiutil.PacketLength( params ) 82 83 if (return_type != 'void'): 83 print '\tSET_RETURN_PTR( %d );' % (arg_len + 8) # extended opcode plus packet length84 print('\tSET_RETURN_PTR( %d );' % (arg_len + 8)) # extended opcode plus packet length 84 85 else: 85 86 paramList = [ ('foo', 'void *', 0) ] 86 print '\tSET_RETURN_PTR( %d );' % (arg_len + 8 - apiutil.PacketLength(paramList))87 print('\tSET_RETURN_PTR( %d );' % (arg_len + 8 - apiutil.PacketLength(paramList))) 87 88 88 89 … … 94 95 arg_len += apiutil.PacketLength( paramList ) 95 96 96 print '\tSET_WRITEBACK_PTR( %d );' % (arg_len + 8) # extended opcode plus packet length97 print('\tSET_WRITEBACK_PTR( %d );' % (arg_len + 8)) # extended opcode plus packet length 97 98 98 99 … … 107 108 copy_of_params[i] = (copy_of_params[i][0], 'void', 0) 108 109 if not "get" in apiutil.Properties(func_name): 109 print '\tcrError( "%s needs to be special cased!" );' % func_name110 print('\tcrError( "%s needs to be special cased!" );' % func_name) 110 111 else: 111 print "\t%s %s = %s;" % ( copy_of_params[i][1], name, ReadData( counter, copy_of_params[i][1] ))112 print("\t%s %s = %s;" % ( copy_of_params[i][1], name, ReadData( counter, copy_of_params[i][1] ) )) 112 113 counter += apiutil.sizeof(copy_of_params[i][1]) 113 114 … … 117 118 118 119 if return_type != "void": 119 print "\t(void)",120 else: 121 print "\t",122 print "cr_unpackDispatch.%s( %s );" % (func_name, apiutil.MakeCallString(params))120 print("\t(void)", end=" ") 121 else: 122 print("\t", end="") 123 print("cr_unpackDispatch.%s( %s );" % (func_name, apiutil.MakeCallString(params))) 123 124 124 125 … … 131 132 132 133 if arg_type == "GLdouble" or arg_type == "GLclampd": 133 print "#ifdef CR_UNALIGNED_ACCESS_OKAY"134 print "\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType)135 print "#else"134 print("#ifdef CR_UNALIGNED_ACCESS_OKAY") 135 print("\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType)) 136 print("#else") 136 137 for index in range(0, vecSize): 137 print "\tGLdouble v" + `index` + " = READ_DOUBLE(", `index * 8`, ");"138 print("\tGLdouble v" + repr(index) + " = READ_DOUBLE(", repr(index * 8), ");") 138 139 if return_type != "void": 139 print "\t(void) cr_unpackDispatch.%s(" % func_name,140 print("\t(void) cr_unpackDispatch.%s(" % func_name, end=" ") 140 141 else: 141 print "\tcr_unpackDispatch.%s(" % func_name,142 print("\tcr_unpackDispatch.%s(" % func_name, end=" ") 142 143 for index in range(0, vecSize): 143 print "v" + `index`,144 print("v" + repr(index), end=" ") 144 145 if index != vecSize - 1: 145 print ",",146 print ");"147 print "#endif"148 else: 149 print "\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType)146 print(",", end=" ") 147 print(");") 148 print("#endif") 149 else: 150 print("\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType)) 150 151 151 152 … … 165 166 return_type = apiutil.ReturnType(func_name) 166 167 167 print "static void crUnpack%s(void)" % func_name168 print "{"168 print("static void crUnpack%s(void)" % func_name) 169 print("{") 169 170 170 171 vector_func = apiutil.VectorFunction(func_name) … … 175 176 packet_length = apiutil.PacketLength( params ) 176 177 if packet_length == 0: 177 print "\tINCR_DATA_PTR_NO_ARGS( );"178 else: 179 print "\tINCR_DATA_PTR( %d );" % packet_length180 print "}\n"178 print("\tINCR_DATA_PTR_NO_ARGS( );") 179 else: 180 print("\tINCR_DATA_PTR( %d );" % packet_length) 181 print("}\n") 181 182 182 183 … … 184 185 # Emit some code 185 186 # 186 print 187 print(""" 187 188 typedef struct __dispatchNode { 188 189 const unsigned char *unpackData; … … 268 269 #endif 269 270 switch( *unpack_opcodes ) 270 {""" 271 {""") 271 272 272 273 # … … 275 276 for func_name in keys: 276 277 if "pack" in apiutil.ChromiumProps(func_name): 277 print '\t\t\tcase %s:' % apiutil.OpcodeName( func_name)278 print('\t\t\tcase %s:' % apiutil.OpcodeName( func_name )) 278 279 if not apiutil.OpcodeName(func_name) in nodebug_opcodes: 279 print 280 print(""" 280 281 #ifdef CR_UNPACK_DEBUG_LAST_OPCODES 281 282 if (i==(num_opcodes-1)) … … 283 284 #if defined(CR_UNPACK_DEBUG_OPCODES) || defined(CR_UNPACK_DEBUG_LAST_OPCODES) 284 285 crDebug("Unpack: %s"); 285 #endif """ % apiutil.OpcodeName(func_name) 286 print '\t\t\t\tcrUnpack%s(); \n\t\t\t\tbreak;' % func_name287 288 print 286 #endif """ % apiutil.OpcodeName(func_name)) 287 print('\t\t\t\tcrUnpack%s(); \n\t\t\t\tbreak;' % func_name) 288 289 print(""" 289 290 case CR_EXTEND_OPCODE: 290 291 #ifdef CR_UNPACK_DEBUG_OPCODES … … 314 315 unpack_opcodes--; 315 316 } 316 }""" 317 }""") 317 318 318 319 … … 325 326 return_type = apiutil.ReturnType(func_name) 326 327 params = apiutil.Parameters(func_name) 327 print 'static void crUnpackExtend%s(void)' % func_name328 print '{'328 print('static void crUnpackExtend%s(void)' % func_name) 329 print('{') 329 330 MakeNormalCall( return_type, func_name, params, 8 ) 330 print '}\n'331 332 print 'static void crUnpackExtend(void)'333 print '{'334 print '\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' );335 print ''336 print '#ifdef CR_UNPACK_DEBUG_PREV_OPCODES'337 print '\tg_VBoxDbgCrPrevExtendOpcode = extend_opcode;'338 print '#endif'339 print ''340 print '\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/'341 print '\tswitch( extend_opcode )'342 print '\t{'331 print('}\n') 332 333 print('static void crUnpackExtend(void)') 334 print('{') 335 print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' )) 336 print('') 337 print('#ifdef CR_UNPACK_DEBUG_PREV_OPCODES') 338 print('\tg_VBoxDbgCrPrevExtendOpcode = extend_opcode;') 339 print('#endif') 340 print('') 341 print('\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/') 342 print('\tswitch( extend_opcode )') 343 print('\t{') 343 344 344 345 … … 348 349 for func_name in keys: 349 350 if "extpack" in apiutil.ChromiumProps(func_name): 350 print '\t\tcase %s:' % apiutil.ExtendedOpcodeName( func_name)351 # print '\t\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name)352 print '\t\t\tcrUnpackExtend%s( );' % func_name353 print '\t\t\tbreak;'354 355 print 351 print('\t\tcase %s:' % apiutil.ExtendedOpcodeName( func_name )) 352 # print('\t\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name ))) 353 print('\t\t\tcrUnpackExtend%s( );' % func_name) 354 print('\t\t\tbreak;') 355 356 print(""" default: 356 357 crError( "Unknown extended opcode: %d", (int) extend_opcode ); 357 358 break; 358 359 } 359 360 INCR_VAR_PTR(); 360 }""" 361 362 print 'static void crUnpackExtendDbg(void)'363 print '{'364 print '\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' );365 print ''366 print '#ifdef CR_UNPACK_DEBUG_PREV_OPCODES'367 print '\tg_VBoxDbgCrPrevExtendOpcode = extend_opcode;'368 print '#endif'369 print ''370 print '\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/'371 print '\tswitch( extend_opcode )'372 print '\t{'361 }""") 362 363 print('static void crUnpackExtendDbg(void)') 364 print('{') 365 print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' )) 366 print('') 367 print('#ifdef CR_UNPACK_DEBUG_PREV_OPCODES') 368 print('\tg_VBoxDbgCrPrevExtendOpcode = extend_opcode;') 369 print('#endif') 370 print('') 371 print('\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/') 372 print('\tswitch( extend_opcode )') 373 print('\t{') 373 374 374 375 … … 378 379 for func_name in keys: 379 380 if "extpack" in apiutil.ChromiumProps(func_name): 380 print '\t\tcase %s:' % apiutil.ExtendedOpcodeName( func_name)381 print('\t\tcase %s:' % apiutil.ExtendedOpcodeName( func_name )) 381 382 if not apiutil.ExtendedOpcodeName(func_name) in nodebug_extopcodes: 382 print '\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name)383 print '\t\t\tcrUnpackExtend%s( );' % func_name384 print '\t\t\tbreak;'385 386 print 383 print('\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name )) 384 print('\t\t\tcrUnpackExtend%s( );' % func_name) 385 print('\t\t\tbreak;') 386 387 print(""" default: 387 388 crError( "Unknown extended opcode: %d", (int) extend_opcode ); 388 389 break; 389 390 } 390 391 INCR_VAR_PTR(); 391 }""" 392 }""") -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_extend.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 … … 12 13 apiutil.CopyrightC() 13 14 14 print 15 print("""/* DO NOT EDIT! THIS CODE IS AUTOGENERATED BY unpack_extend.py */ 15 16 16 17 #ifndef UNPACK_EXTEND_H 17 18 #define UNPACK_EXTEND_H 1 18 19 19 """ 20 """) 20 21 21 22 … … 25 26 for func_name in apiutil.AllSpecials( "unpacker" ): 26 27 if "extpack" in apiutil.ChromiumProps(func_name): 27 print 'extern void crUnpackExtend%s(void);' % func_name28 print('extern void crUnpackExtend%s(void);' % func_name) 28 29 else: 29 print 'extern void crUnpack%s(void);' % func_name30 print('extern void crUnpack%s(void);' % func_name) 30 31 31 print 32 print(""" 32 33 #endif 33 """ 34 """) 34 35 35 36 -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_header.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys; 7 import cPickle;8 import pickle; 8 9 import types; 9 10 import string; … … 15 16 16 17 parsed_file = open( "../glapi_parser/gl_header.parsed", "rb" ) 17 gl_mapping = cPickle.load( parsed_file )18 gl_mapping = pickle.load( parsed_file ) 18 19 19 20 stub_common.CopyrightC() 20 21 21 print 22 print("""#ifndef CR_UNPACKFUNCTIONS_H 22 23 #define CR_UNPACKFUNCTIONS_H 23 """ 24 """) 24 25 25 keys = gl_mapping.keys() 26 keys.sort() 27 28 for func_name in keys: 26 for func_name in sorted(gl_mapping.keys()): 29 27 ( return_type, arg_names, arg_types ) = gl_mapping[func_name] 30 print 'void crUnpack%s();' %( func_name)31 print 'void crUnpackExtend();'32 print '\n#endif /* CR_UNPACKFUNCTIONS_H */'28 print('void crUnpack%s();' %( func_name )) 29 print('void crUnpackExtend();') 30 print('\n#endif /* CR_UNPACKFUNCTIONS_H */')
Note:
See TracChangeset
for help on using the changeset viewer.