VirtualBox

Ignore:
Timestamp:
Sep 22, 2016 7:58:05 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
110825
Message:

Build/scripts (bugref:6627): Python build scripts updated to generate the same code when used with Python 2 and 3.

Location:
trunk/src/VBox/HostServices/SharedOpenGL
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.py

    r57909 r63939  
    44# See the file LICENSE.txt for information on redistributing this software.
    55
     6from __future__ import print_function
    67
    78num_get_values = {
     
    412413}
    413414
    414 get_keys = num_get_values.keys() + extensions_num_get_values.keys()
     415get_keys = list(num_get_values.keys()) + list(extensions_num_get_values.keys())
    415416get_keys.sort()
    416417max_keyvalues = 0
    417418
    418 print """
     419print("""
    419420static struct nv_struct { GLenum pname; unsigned int num_values;
    420421#ifdef VBOX_WITH_CRDUMPER
     
    422423#endif
    423424} num_values_array[] = {
    424 """
     425""")
    425426for key in get_keys:
    426427    try:
     
    428429        if max_keyvalues < keyvalues:
    429430            max_keyvalues = keyvalues
    430         print """
     431        print("""
    431432        \t{ %s, %d
    432433#ifdef VBOX_WITH_CRDUMPER
     
    434435#endif
    435436        },
    436         """ % (key, keyvalues, key)
     437        """ % (key, keyvalues, key))
    437438    except KeyError:
    438439        (nv, ifdef) = extensions_num_get_values[key]
    439440        if max_keyvalues < nv:
    440441            max_keyvalues = nv
    441         print '#ifdef %s' % ifdef
    442         print """
     442        print('#ifdef %s' % ifdef)
     443        print("""
    443444        \t{ %s, %d
    444445        #ifdef VBOX_WITH_CRDUMPER
     
    446447        #endif
    447448        },
    448         """ % (key, nv, key)
    449         print '#endif /* %s */' % ifdef
    450 print "\t{ 0, 0 }"
    451 print "};"
    452 print "#define CR_MAX_GET_VALUES %d" % max_keyvalues
    453 
    454 print """
     449        """ % (key, nv, key))
     450        print('#endif /* %s */' % ifdef)
     451print("\t{ 0, 0 }")
     452print("};")
     453print("#define CR_MAX_GET_VALUES %d" % max_keyvalues)
     454
     455print("""
    455456static unsigned int __numValues( GLenum pname )
    456457{
     
    465466    return 0;
    466467}
    467 """
     468""")
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py

    r50443 r63939  
    44# See the file LICENSE.txt for information on redistributing this software.
    55
     6from __future__ import print_function
    67import sys, string, re
    78
     
    1213apiutil.CopyrightC()
    1314
    14 print """
     15print("""
    1516/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_dispatch.py SCRIPT */
    1617#include "cr_spu.h"
     
    2223
    2324CRCurrentStatePointers crServerCurrent;
    24 """
     25""")
    2526
    2627
     
    3334    wrap = apiutil.GetCategoryWrapper(func_name)
    3435    if wrap:
    35         print '#if defined(CR_%s)' % wrap
    36     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('}')
    4142    if wrap:
    42         print '#endif'
     43        print('#endif')
    4344
    4445
     
    5152    if m :
    5253        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:]
    5455        type = m.group(3) + m.group(2)
    5556    m = re.search( r"^(SecondaryColor)(3)(ub|b|us|s|ui|i|f|d)(EXT)$", func_name )
    5657    if m :
    5758        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:]
    5960        type = m.group(3) + m.group(2)
    6061    m = re.search( r"^(TexCoord)([1234])(ub|b|us|s|ui|i|f|d)$", func_name )
    6162    if m :
    6263        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:]
    6465        type = m.group(3) + m.group(2)
    6566        array = "[0]"
     
    7475    if m :
    7576        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:]
    7778        type = m.group(2) + "1"
    7879    m = re.match( r"^(EdgeFlag)$", func_name )
    7980    if m :
    8081        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:]
    8283        type = "l1"
    8384    m = re.match( r"^(FogCoord)(f|d)(EXT)$", func_name)
    8485    if m :
    8586        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:]
    8788        type = m.group(2) + "1"
    8889       
     
    9192    if m :
    9293        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:]
    9495        type = m.group(3) + m.group(2)
    9596        array = "[index]"
     
    104105    if current:
    105106        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')
    114115
    115 print """
     116print("""
    116117void crServerInitDispatch(void)
    117118{
    118119    crSPUInitDispatchTable( &(cr_server.dispatch) );
    119120    crSPUCopyDispatchTable( &(cr_server.dispatch), &(cr_server.head_spu->dispatch_table ) );
    120 """
     121""")
    121122
    122123for func_name in keys:
     
    127128        wrap = apiutil.GetCategoryWrapper(func_name)
    128129        if wrap:
    129             print '#if defined(CR_%s)' % wrap
     130            print('#if defined(CR_%s)' % wrap)
    130131           
    131         print '\tcr_server.dispatch.%s = crServerDispatch%s;' % (func_name, func_name)
     132        print('\tcr_server.dispatch.%s = crServerDispatch%s;' % (func_name, func_name))
    132133        if wrap:
    133             print '#endif'
     134            print('#endif')
    134135
    135 print '}'
     136print('}')
    136137
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch_header.py

    r43888 r63939  
    44# See the file LICENSE.txt for information on redistributing this software.
    55
     6from __future__ import print_function
    67import sys
    78
     
    1011apiutil.CopyrightC()
    1112
    12 print """
     13print("""
    1314/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_dispatch_header.py SCRIPT */
    1415#ifndef SERVER_DISPATCH_HEADER
     
    2829#endif
    2930
    30 """
     31""")
    3132
    3233keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
     
    4041        return_type = apiutil.ReturnType(func_name)
    4142       
    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 )))
    4344
    44 print """
     45print("""
    4546#if defined(__cplusplus)
    4647}
     
    4849
    4950#endif /* SERVER_DISPATCH_HEADER */
    50 """
     51""")
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_get.py

    r50041 r63939  
    44# See the file LICENSE.txt for information on redistributing this software.
    55
     6from __future__ import print_function
    67import sys
    78
     
    1112apiutil.CopyrightC()
    1213
    13 print """
     14print("""
    1415#include "cr_spu.h"
    1516#include "chromium.h"
     
    1920#include "server_dispatch.h"
    2021#include "server.h"
    21 """
     22""")
    2223
    2324max_components = {
     
    118119        params = apiutil.Parameters(func_name)
    119120
    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('{')
    122123
    123124        lastParam = params[-1]
     
    126127        local_argname = 'local_%s' % lastParam[0]
    127128
    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])
    130131
    131132        params[-1] = (local_argname, local_argtype, 0)
    132133
    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) ))
    134135
    135136        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}')
    139140
    140141        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 ))
    142143        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  
    44# See the file LICENSE.txt for information on redistributing this software.
    55
     6from __future__ import print_function
    67import sys
    78
     
    1112apiutil.CopyrightC()
    1213
    13 print """
     14print("""
    1415/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_retval.py SCRIPT */
    1516#include "chromium.h"
     
    5657    CRDBGPTR_SETZ(&cr_server.return_ptr);
    5758}
    58 """
     59""")
    5960
    6061keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
     
    6869        continue
    6970    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_type
    73         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  
    44# See the file LICENSE.txt for information on redistributing this software.
    55
     6from __future__ import print_function
    67import sys
    78
     
    1112apiutil.CopyrightC()
    1213
    13 print """#include "cr_spu.h"
     14print("""#include "cr_spu.h"
    1415#include "chromium.h"
    1516#include "cr_error.h"
     
    1819#include "server_dispatch.h"
    1920#include "server.h"
    20 """
     21""")
    2122
    2223from get_sizes import *;
     
    2930    func_name = funcs[index]
    3031    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("""
    3637    #ifdef CR_ARB_texture_compression
    3738    if (GL_COMPRESSED_TEXTURE_FORMATS_ARB == pname)
     
    4647        tablesize = __numValues( pname ) * sizeof(%s);
    4748    }
    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_name
    53     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("""
    5455    if (GL_TEXTURE_BINDING_1D==pname
    5556        || GL_TEXTURE_BINDING_2D==pname
     
    146147        }
    147148    }
    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  
    44# See the file LICENSE.txt for information on redistributing this software.
    55
     6from __future__ import print_function
    67import sys
    78
     
    1112apiutil.CopyrightC()
    1213
    13 print """/* DO NOT EDIT!  THIS CODE IS AUTOGENERATED BY unpack.py */
     14print("""/* DO NOT EDIT!  THIS CODE IS AUTOGENERATED BY unpack.py */
    1415
    1516#include "unpacker.h"
     
    4041static GLenum g_VBoxDbgCrPrevExtendOpcode = 0;
    4142#endif
    42 """
     43""")
    4344
    4445nodebug_opcodes = [
     
    8182    arg_len = apiutil.PacketLength( params )
    8283    if (return_type != 'void'):
    83         print '\tSET_RETURN_PTR( %d );' % (arg_len + 8) # extended opcode plus packet length
     84        print('\tSET_RETURN_PTR( %d );' % (arg_len + 8)) # extended opcode plus packet length
    8485    else:
    8586        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)))
    8788
    8889
     
    9495        arg_len += apiutil.PacketLength( paramList )
    9596
    96     print '\tSET_WRITEBACK_PTR( %d );' % (arg_len + 8) # extended opcode plus packet length
     97    print('\tSET_WRITEBACK_PTR( %d );' % (arg_len + 8)) # extended opcode plus packet length
    9798
    9899
     
    107108            copy_of_params[i] = (copy_of_params[i][0], 'void', 0)
    108109            if not "get" in apiutil.Properties(func_name):
    109                 print '\tcrError( "%s needs to be special cased!" );' % func_name
     110                print('\tcrError( "%s needs to be special cased!" );' % func_name)
    110111        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] ) ))
    112113        counter += apiutil.sizeof(copy_of_params[i][1])
    113114
     
    117118
    118119    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)))
    123124
    124125
     
    131132
    132133    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")
    136137        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), ");")
    138139        if return_type != "void":
    139             print "\t(void) cr_unpackDispatch.%s(" % func_name,
     140            print("\t(void) cr_unpackDispatch.%s(" % func_name, end=" ")
    140141        else:
    141             print "\tcr_unpackDispatch.%s(" % func_name,
     142            print("\tcr_unpackDispatch.%s(" % func_name, end=" ")
    142143        for index in range(0, vecSize):
    143             print "v" + `index`,
     144            print("v" + repr(index), end=" ")
    144145            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))
    150151
    151152
     
    165166    return_type = apiutil.ReturnType(func_name)
    166167   
    167     print "static void crUnpack%s(void)" % func_name
    168     print "{"
     168    print("static void crUnpack%s(void)" % func_name)
     169    print("{")
    169170
    170171    vector_func = apiutil.VectorFunction(func_name)
     
    175176    packet_length = apiutil.PacketLength( params )
    176177    if packet_length == 0:
    177         print "\tINCR_DATA_PTR_NO_ARGS( );"
    178     else:
    179         print "\tINCR_DATA_PTR( %d );" % packet_length
    180     print "}\n"
     178        print("\tINCR_DATA_PTR_NO_ARGS( );")
     179    else:
     180        print("\tINCR_DATA_PTR( %d );" % packet_length)
     181    print("}\n")
    181182
    182183
     
    184185# Emit some code
    185186#
    186 print """
     187print("""
    187188typedef struct __dispatchNode {
    188189    const unsigned char *unpackData;
     
    268269#endif
    269270        switch( *unpack_opcodes )
    270         {"""
     271        {""")
    271272
    272273#
     
    275276for func_name in keys:
    276277    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 ))
    278279        if not apiutil.OpcodeName(func_name) in nodebug_opcodes:
    279             print """
     280            print("""
    280281#ifdef CR_UNPACK_DEBUG_LAST_OPCODES
    281282                if (i==(num_opcodes-1))
     
    283284#if defined(CR_UNPACK_DEBUG_OPCODES) || defined(CR_UNPACK_DEBUG_LAST_OPCODES)
    284285                crDebug("Unpack: %s");
    285 #endif """ % apiutil.OpcodeName(func_name)
    286         print '\t\t\t\tcrUnpack%s(); \n\t\t\t\tbreak;' % func_name
    287 
    288 print """       
     286#endif """ % apiutil.OpcodeName(func_name))
     287        print('\t\t\t\tcrUnpack%s(); \n\t\t\t\tbreak;' % func_name)
     288
     289print("""       
    289290            case CR_EXTEND_OPCODE:
    290291                #ifdef CR_UNPACK_DEBUG_OPCODES
     
    314315        unpack_opcodes--;
    315316    }
    316 }"""
     317}""")
    317318
    318319
     
    325326            return_type = apiutil.ReturnType(func_name)
    326327            params = apiutil.Parameters(func_name)
    327             print 'static void crUnpackExtend%s(void)' % func_name
    328             print '{'
     328            print('static void crUnpackExtend%s(void)' % func_name)
     329            print('{')
    329330            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
     333print('static void crUnpackExtend(void)')
     334print('{')
     335print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' ))
     336print('')
     337print('#ifdef CR_UNPACK_DEBUG_PREV_OPCODES')
     338print('\tg_VBoxDbgCrPrevExtendOpcode = extend_opcode;')
     339print('#endif')
     340print('')
     341print('\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/')
     342print('\tswitch( extend_opcode )')
     343print('\t{')
    343344
    344345
     
    348349for func_name in keys:
    349350    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_name
    353         print '\t\t\tbreak;'
    354 
    355 print """       default:
     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
     356print("""       default:
    356357            crError( "Unknown extended opcode: %d", (int) extend_opcode );
    357358            break;
    358359    }
    359360    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
     363print('static void crUnpackExtendDbg(void)')
     364print('{')
     365print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' ))
     366print('')
     367print('#ifdef CR_UNPACK_DEBUG_PREV_OPCODES')
     368print('\tg_VBoxDbgCrPrevExtendOpcode = extend_opcode;')
     369print('#endif')
     370print('')
     371print('\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/')
     372print('\tswitch( extend_opcode )')
     373print('\t{')
    373374
    374375
     
    378379for func_name in keys:
    379380    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 ))
    381382        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_name
    384         print '\t\t\tbreak;'
    385 
    386 print """       default:
     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
     387print("""       default:
    387388            crError( "Unknown extended opcode: %d", (int) extend_opcode );
    388389            break;
    389390    }
    390391    INCR_VAR_PTR();
    391 }"""
     392}""")
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_extend.py

    r15532 r63939  
    44# See the file LICENSE.txt for information on redistributing this software.
    55
     6from __future__ import print_function
    67import sys
    78
     
    1213apiutil.CopyrightC()
    1314
    14 print """/* DO NOT EDIT!  THIS CODE IS AUTOGENERATED BY unpack_extend.py */
     15print("""/* DO NOT EDIT!  THIS CODE IS AUTOGENERATED BY unpack_extend.py */
    1516
    1617#ifndef UNPACK_EXTEND_H
    1718#define UNPACK_EXTEND_H 1
    1819
    19 """
     20""")
    2021
    2122
     
    2526for func_name in apiutil.AllSpecials( "unpacker" ):
    2627        if "extpack" in apiutil.ChromiumProps(func_name):
    27                 print 'extern void crUnpackExtend%s(void);' % func_name
     28                print('extern void crUnpackExtend%s(void);' % func_name)
    2829        else:
    29                 print 'extern void crUnpack%s(void);' % func_name
     30                print('extern void crUnpack%s(void);' % func_name)
    3031
    31 print """
     32print("""
    3233#endif
    33 """
     34""")
    3435
    3536
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_header.py

    r15532 r63939  
    44# See the file LICENSE.txt for information on redistributing this software.
    55
     6from __future__ import print_function
    67import sys;
    7 import cPickle;
     8import pickle;
    89import types;
    910import string;
     
    1516
    1617parsed_file = open( "../glapi_parser/gl_header.parsed", "rb" )
    17 gl_mapping = cPickle.load( parsed_file )
     18gl_mapping = pickle.load( parsed_file )
    1819
    1920stub_common.CopyrightC()
    2021
    21 print """#ifndef CR_UNPACKFUNCTIONS_H
     22print("""#ifndef CR_UNPACKFUNCTIONS_H
    2223#define CR_UNPACKFUNCTIONS_H
    23 """
     24""")
    2425
    25 keys = gl_mapping.keys()
    26 keys.sort()
    27 
    28 for func_name in keys:
     26for func_name in sorted(gl_mapping.keys()):
    2927        ( 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 ))
     29print('void crUnpackExtend();')
     30print('\n#endif /* CR_UNPACKFUNCTIONS_H */')
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette