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