Changeset 63939 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Sep 22, 2016 7:58:05 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 110825
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
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.