Index: trunk/src/VBox/GuestHost/OpenGL/state_tracker/convert.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/state_tracker/convert.py	(revision 63459)
+++ trunk/src/VBox/GuestHost/OpenGL/state_tracker/convert.py	(revision 63939)
@@ -4,4 +4,5 @@
 # See the file LICENSE.txt for information on redistributing this software.
 
+from __future__ import print_function
 import sys
 
@@ -17,5 +18,5 @@
 apiutil.CopyrightC()
 
-print '''
+print('''
 #include "state/cr_statetypes.h"
 
@@ -28,18 +29,18 @@
     return d;
 }
-'''
+''')
 
-for k in gltypes.keys():
+for k in sorted(gltypes.keys()):
 	for i in range(1,5):
-		print 'static void __convert_%s%d (GLfloat *dst, const %s *src) {' % (k,i,gltypes[k]['type'])
+		print('static void __convert_%s%d (GLfloat *dst, const %s *src) {' % (k,i,gltypes[k]['type']))
 		if k == 'd':
 		  for j in range(i-1):
-		    print '\t*dst++ = (GLfloat) __read_double(src++);'
-		  print '\t*dst = (GLfloat) __read_double(src);'
+		    print('\t*dst++ = (GLfloat) __read_double(src++);')
+		  print('\t*dst = (GLfloat) __read_double(src);')
 		else:
 		  for j in range(i-1):
-		    print '\t*dst++ = (GLfloat) *src++;';
-		  print '\t*dst = (GLfloat) *src;';
-		print '}\n';
+		    print('\t*dst++ = (GLfloat) *src++;')
+		  print('\t*dst = (GLfloat) *src;')
+		print('}\n')
 
 scale = {
@@ -54,5 +55,5 @@
 }
 
-for k in gltypes.keys():
+for k in sorted(gltypes.keys()):
 	if k != 'f' and k != 'd' and k != 'l':
 		if k[0:1] == "N":
@@ -61,14 +62,14 @@
 			k2 = k
 		for i in range(1,5):
-			print 'static void __convert_rescale_%s%d (GLfloat *dst, const %s *src) {' % (k,i,gltypes[k2]['type'])
+			print('static void __convert_rescale_%s%d (GLfloat *dst, const %s *src) {' % (k,i,gltypes[k2]['type']))
 			for j in range(i-1):
-				print '\t*dst++ = ((GLfloat) *src++) / %s;' % scale[k2]
-			print '\t*dst = ((GLfloat) *src) / %s;' % scale[k2]
-			print '}\n'
+				print('\t*dst++ = ((GLfloat) *src++) / %s;' % scale[k2])
+			print('\t*dst = ((GLfloat) *src) / %s;' % scale[k2])
+			print('}\n')
 
-print '''
+print('''
 
 static void __convert_boolean (GLboolean *dst, const GLboolean *src) {
 	*dst = *src;
 }
-'''
+''')
Index: trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py	(revision 63459)
+++ trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py	(revision 63939)
@@ -1,2 +1,3 @@
+from __future__ import print_function
 import sys
 
@@ -34,5 +35,5 @@
 apiutil.CopyrightC()
 
-print """#include "cr_blitter.h"
+print("""#include "cr_blitter.h"
 #include "cr_spu.h"
 #include "chromium.h"
@@ -52,5 +53,5 @@
 
 #ifdef VBOX_WITH_CRDUMPER
-"""
+""")
 
 from get_sizes import *;
@@ -69,5 +70,5 @@
 #            print "//%s" % prop
 #
-print """
+print("""
 static void crRecDumpPrintVal(CR_DUMPER *pDumper, struct nv_struct *pDesc, float *pfData)
 {
@@ -94,23 +95,17 @@
 {
     GLboolean fEnabled;
-"""
-keys = params.keys()
-keys.sort();
-
-for pname in keys:
-    print "\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname
-    print "\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname
-
-keys = extended_params.keys();
-keys.sort()
-
-for pname in keys:
+""")
+for pname in sorted(params.keys()):
+    print("\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname)
+    print("\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname)
+
+for pname in sorted(extended_params.keys()):
     (srctype,ifdef,fields) = extended_params[pname]
     ext = ifdef[3:]  # the extension name with the "GL_" prefix removed
     ext = ifdef
-    print '#ifdef CR_%s' % ext
-    print "\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname
-    print "\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname
-    print '#endif /* CR_%s */' % ext
+    print('#ifdef CR_%s' % ext)
+    print("\tfEnabled = pRec->pDispatch->IsEnabled(%s);" % pname)
+    print("\tcrDmpStrF(pRec->pDumper, \"%s = %%d;\", fEnabled);" % pname)
+    print('#endif /* CR_%s */' % ext)
 
 #print "//missing enable props:"
@@ -124,8 +119,8 @@
 #            print "//%s" % prop
 #
-print """
+print("""
 }
 #endif
-"""
+""")
 
 texenv_mappings = {
@@ -184,5 +179,5 @@
 ]
 
-print """
+print("""
 void crRecDumpTexParam(CR_RECORDER *pRec, CRContext *ctx, GLenum enmTarget)
 {
@@ -191,18 +186,18 @@
     unsigned int cComponents;
     crDmpStrF(pRec->pDumper, "==TEX_PARAM for target(0x%x)==", enmTarget);
-"""
+""")
 for pname in texparam_names:
-    print "\tcComponents = crStateHlpComponentsCount(%s);" % pname
-    print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));"
-    print "\tmemset(afBuf, 0, sizeof (afBuf));"
-    print "\tpRec->pDispatch->GetTexParameterfv(enmTarget, %s, afBuf);" % pname
-    print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);"
-    print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname
-print """
+    print("\tcComponents = crStateHlpComponentsCount(%s);" % pname)
+    print("\tAssert(cComponents <= RT_ELEMENTS(afBuf));")
+    print("\tmemset(afBuf, 0, sizeof (afBuf));")
+    print("\tpRec->pDispatch->GetTexParameterfv(enmTarget, %s, afBuf);" % pname)
+    print("\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);")
+    print("\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname)
+print("""
     crDmpStrF(pRec->pDumper, "==Done TEX_PARAM for target(0x%x)==", enmTarget);
 }
-"""
-
-print """
+""")
+
+print("""
 void crRecDumpTexEnv(CR_RECORDER *pRec, CRContext *ctx)
 {
@@ -211,27 +206,24 @@
     unsigned int cComponents;
     crDmpStrF(pRec->pDumper, "==TEX_ENV==");
-"""
-
-keys = texenv_mappings.keys()
-keys.sort();
-
-for target in keys:
-    print "\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % target
+""")
+
+for target in sorted(texenv_mappings.keys()):
+    print("\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % target)
     values = texenv_mappings[target]
     for pname in values:
-        print "\tcComponents = crStateHlpComponentsCount(%s);" % pname
-        print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));"
-        print "\tmemset(afBuf, 0, sizeof (afBuf));"
-        print "\tpRec->pDispatch->GetTexEnvfv(%s, %s, afBuf);" % (target, pname)
-        print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);"
-        print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname
-    print "\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % target
-print """
+        print("\tcComponents = crStateHlpComponentsCount(%s);" % pname)
+        print("\tAssert(cComponents <= RT_ELEMENTS(afBuf));")
+        print("\tmemset(afBuf, 0, sizeof (afBuf));")
+        print("\tpRec->pDispatch->GetTexEnvfv(%s, %s, afBuf);" % (target, pname))
+        print("\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);")
+        print("\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname)
+    print("\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % target)
+print("""
     crDmpStrF(pRec->pDumper, "==Done TEX_ENV==");
 }
-"""
-
-
-print """
+""")
+
+
+print("""
 void crRecDumpTexGen(CR_RECORDER *pRec, CRContext *ctx)
 {
@@ -240,18 +232,18 @@
     unsigned int cComponents;
     crDmpStrF(pRec->pDumper, "==TEX_GEN==");
-"""
+""")
 
 for coord in texgen_coords:
-    print "\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % coord
+    print("\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % coord)
     for pname in texgen_names:
-        print "\tcComponents = crStateHlpComponentsCount(%s);" % pname
-        print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));"
-        print "\tmemset(afBuf, 0, sizeof (afBuf));"
-        print "\tpRec->pDispatch->GetTexGendv(%s, %s, afBuf);" % (coord, pname)
-        print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);"
-        print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname
-    print "\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % coord
-print """
+        print("\tcComponents = crStateHlpComponentsCount(%s);" % pname)
+        print("\tAssert(cComponents <= RT_ELEMENTS(afBuf));")
+        print("\tmemset(afBuf, 0, sizeof (afBuf));")
+        print("\tpRec->pDispatch->GetTexGendv(%s, %s, afBuf);" % (coord, pname))
+        print("\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);")
+        print("\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname)
+    print("\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % coord)
+print("""
     crDmpStrF(pRec->pDumper, "==Done TEX_GEN==");
 }
-"""
+""")
Index: trunk/src/VBox/GuestHost/OpenGL/state_tracker/gendiffcode.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/state_tracker/gendiffcode.py	(revision 63459)
+++ trunk/src/VBox/GuestHost/OpenGL/state_tracker/gendiffcode.py	(revision 63939)
@@ -4,4 +4,5 @@
 # See the file LICENSE.txt for information on redistributing this software
 
+from __future__ import print_function
 import sys
 
@@ -10,17 +11,17 @@
 	Name = sys.argv[2]
 
-	print """/* This code is AUTOGENERATED!!! */
+	print("""/* This code is AUTOGENERATED!!! */
 
 #include "state.h"
-#include "state_internals.h\""""
-
-	print """
+#include "state_internals.h\"""")
+
+	print("""
 void crState%(Name)sDiff(CR%(Name)sBits *b, CRbitvalue *bitID,
 		CRContext *fromCtx, CRContext *toCtx)
 {
 	CR%(Name)sState *from = &(fromCtx->%(name)s);
-	CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars()
+	CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars())
 	gendiffcode("state_%s.txt"%(name.lower()), name, docopy=1, doinvalid=0)
-	print """}
+	print("""}
 
 void crState%(Name)sSwitch(CR%(Name)sBits *b, CRbitvalue *bitID,
@@ -28,7 +29,7 @@
 {
 	CR%(Name)sState *from = &(fromCtx->%(name)s);
-	CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars()
+	CR%(Name)sState *to = &(toCtx->%(name)s);"""%vars())
 	gendiffcode("state_%s.txt"%(Name.lower()), Name, docopy=0, doinvalid=1)
-	print "}\n"
+	print("}\n")
 
 def gendiffcode(fname, state_name, docopy, doinvalid):
@@ -55,12 +56,12 @@
 	FILE = open(sys.argv[3]+"/"+fname, "r")
 
-	print """	unsigned int j, i;
+	print("""	unsigned int j, i;
 	CRbitvalue nbitID[CR_MAX_BITARRAY];
 	for (j=0;j<CR_MAX_BITARRAY;j++)
 		nbitID[j] = ~bitID[j];
-	i = 0; /* silence compiler */"""
+	i = 0; /* silence compiler */""")
 
 	import re
-	for line in FILE.xreadlines():
+	for line in FILE:
 		line = line.rstrip()
 
@@ -87,5 +88,5 @@
 			if re.search("}", line):
 				tab = tab[:-1]
-			print tab+text
+			print(tab+text)
 			if re.search("{", line):
 				tab = tab+"\t"
@@ -109,10 +110,10 @@
 		if re.search("%flush", line):
 			if current_guard != "":
-				print tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars()
-				tab = tab[:-1]
-				print tab+"}"
+				print(tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars())
+				tab = tab[:-1]
+				print(tab+"}")
 			if docopy and current_dependency != "":
 				tab = tab[:-1]
-				print tab+"}"
+				print(tab+"}")
 			current_guard = ""
 			current_dependency = ""
@@ -127,14 +128,14 @@
 ## Close the guardbit and dependency
 		if current_guard != "" and current_guard != guardbit:
-			print tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars()
+			print(tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars())
 			tab = tab[:-1]
-			print tab+"}"
+			print(tab+"}")
 		if docopy and current_dependency != "" and current_dependency != dependency:
 			tab = tab[:-1]
-			print tab+"}"
+			print(tab+"}")
 
 ## Open the dependency if
 		if docopy and current_dependency != dependency and dependency != "":
-			print tab+"if (%(target)s->%(dependency)s)\n%(tab)s{"%vars()
+			print(tab+"if (%(target)s->%(dependency)s)\n%(tab)s{"%vars())
 			tab = tab+"\t"
 			current_dependency = dependency
@@ -142,14 +143,14 @@
 ## Open the guard if
 		if docopy and current_dependency != dependency and dependency != "":
-			print tab+"if ($(target)s->%(dependency)s)\n%(tab)s{"%vars()
+			print(tab+"if ($(target)s->%(dependency)s)\n%(tab)s{"%vars())
 			tab = tab+"\t"
 		
 		if current_guard != guardbit and guardbit != "":
-			print tab+"if (CHECKDIRTY(%(bit)s->%(guardbit)s, bitID))\n%(tab)s{"%vars()
+			print(tab+"if (CHECKDIRTY(%(bit)s->%(guardbit)s, bitID))\n%(tab)s{"%vars())
 			tab = tab+"\t"
 			if members[0] != "*" and guardbit[0:6] == "enable":
-				print tab+"glAble able[2];"
-				print tab+"able[0] = diff_api.Disable;"
-				print tab+"able[1] = diff_api.Enable;"
+				print(tab+"glAble able[2];")
+				print(tab+"able[0] = diff_api.Disable;")
+				print(tab+"able[1] = diff_api.Enable;")
 
 		current_dependency = dependency
@@ -158,5 +159,5 @@
 ## Handle text dump
 		if members[0] == "*":
-			print tab+members[1:]
+			print(tab+members[1:])
 		else:
 			## Parse the members variable
@@ -181,8 +182,8 @@
 				for elem in elems:
 					if first != 1:
-						print " ||\n"+tab+"    ",
+						print(" ||\n"+tab+"    ", end="")
 					first = 0
 					sys.stdout.write("%(current)s->%(elem)s != %(target)s->%(elem)s"%vars())
-				print ")\n"+tab+"{"
+				print(")\n"+tab+"{")
 				tab = tab+"\t"
 
@@ -190,17 +191,17 @@
 			if func[0] == "*":
 				func = func[1:]
-				print tab+func
+				print(tab+func)
 			else:
 				if func != "":
 ## Call the glhw function
 					if guardbit[0:6] == "enable":
-						print tab+"able["+target+"->"+elems[0]+"]("+func+");"
+						print(tab+"able["+target+"->"+elems[0]+"]("+func+");")
 					elif guardbit == "extensions":
-						print tab+"crState$state_name",
+						print(tab+"crState$state_name",end="")
 						if docopy == 1:
-							print "Diff",
+							print("Diff",end="")
 						else:
-							print "Switch",
-						print "Extensions( from, to );"
+							print("Switch",end="")
+						print("Extensions( from, to );")
 					else:
 						funcargs = re.split(",", func)
@@ -211,16 +212,16 @@
 							v_type = func[-2:-1]
 							num_elems = len(elems)
-							print tab+v_types[v_type]+" varg["+str(num_elems)+"];"
+							print(tab+v_types[v_type]+" varg["+str(num_elems)+"];")
 							i = 0
 							for elem in elems:
-								print tab+"varg["+str(i)+"] = "+target+"->"+elem+";"
+								print(tab+"varg["+str(i)+"] = "+target+"->"+elem+";")
 								i += 1
 						elif func[-3:] == "vNV":
 							v_type = func[-4:-3]
 							num_elems = len(elems)
-							print tab+v_types[v_type]+" varg["+str(num_elems)+"];"
+							print(tab+v_types[v_type]+" varg["+str(num_elems)+"];")
 							i = 0
 							for elem in elems:
-								print tab+"varg["+str(i)+"] = "+target+"->"+elem+";"
+								print(tab+"varg["+str(i)+"] = "+target+"->"+elem+";")
 								i += 1
 
@@ -239,34 +240,34 @@
 								first = 0
 								sys.stdout.write(target+"->"+elem)
-						print ");"
+						print(");")
 
 ## Do the sync if necessary
 			if docopy and guardbit != "extensions":
 				for elem in  mainelem:
-					print tab+current+"->"+elem+" = "+target+"->"+elem+";"
+					print(tab+current+"->"+elem+" = "+target+"->"+elem+";")
 
 			## Do the clear if necessary
 			if doinvalid:
 				if guardbit != "":
-					print tab+"FILLDIRTY(%(bit)s->%(guardbit)s);"%vars()
-				print tab+"FILLDIRTY(%(bit)s->dirty);"%vars()
+					print(tab+"FILLDIRTY(%(bit)s->%(guardbit)s);"%vars())
+				print(tab+"FILLDIRTY(%(bit)s->dirty);"%vars())
 				if extrabit != "":
-					print tab+"FILLDIRTY(%(extrabit)s->dirty);"%vars()
+					print(tab+"FILLDIRTY(%(extrabit)s->dirty);"%vars())
 
 			## Close the compare
 			if guardbit != "extensions":
 				tab = tab[:-1]
-				print tab+"}"
+				print(tab+"}")
 
 ## Do final closures
 	if current_guard != "":
-		print tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars()
+		print(tab+"CLEARDIRTY(%(bit)s->%(current_guard)s, nbitID);"%vars())
 		tab = tab[:-1]
-		print tab+"}"
+		print(tab+"}")
 	if docopy and current_dependency != "":
 		tab = tab[:-1]
-		print tab+"} /*%(current_dependency)s*/"%vars()
-
-	print tab+"CLEARDIRTY(%(bit)s->dirty, nbitID);"%vars()
+		print(tab+"} /*%(current_dependency)s*/"%vars())
+
+	print(tab+"CLEARDIRTY(%(bit)s->dirty, nbitID);"%vars())
 
 main()
Index: trunk/src/VBox/GuestHost/OpenGL/state_tracker/get_components.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/state_tracker/get_components.py	(revision 63459)
+++ trunk/src/VBox/GuestHost/OpenGL/state_tracker/get_components.py	(revision 63939)
@@ -3,4 +3,6 @@
 #
 # See the file LICENSE.txt for information on redistributing this software.
+
+from __future__ import print_function
 
 num_components = {
@@ -114,23 +116,19 @@
 }
 
-print """unsigned int crStateHlpComponentsCount( GLenum pname )
+print("""unsigned int crStateHlpComponentsCount( GLenum pname )
 {
 	switch( pname )
 	{
-"""
-comps = num_components.keys();
-comps.sort();
-for comp in comps:
-	print '\t\t\tcase %s: return %d;' % (comp,num_components[comp])
+""")
+for comp in sorted(num_components.keys()):
+	print('\t\t\tcase %s: return %d;' % (comp,num_components[comp]))
 
-comps = num_extended_components.keys();
-comps.sort();
-for comp in comps:
+for comp in sorted(num_extended_components.keys()):
 	(nc, ifdef) = num_extended_components[comp]
-	print '#ifdef %s' % ifdef
-	print '\t\t\tcase %s: return %d;' % (comp,nc)
-	print '#endif /* %s */' % ifdef
+	print('#ifdef %s' % ifdef)
+	print('\t\t\tcase %s: return %d;' % (comp,nc))
+	print('#endif /* %s */' % ifdef)
 
-print """
+print("""
 		default:
 			crError( "Unknown parameter name in crStateHlpComponentsCount: %d", (int) pname );
@@ -140,5 +138,5 @@
 	return 0;
 }
-"""
+""")
 
 
Index: trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.py	(revision 63459)
+++ trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_current.py	(revision 63939)
@@ -4,4 +4,5 @@
 # See the file LICENSE.txt for information on redistributing this software.
 
+from __future__ import print_function
 import sys
 
@@ -11,5 +12,5 @@
 apiutil.CopyrightC()
 
-print '''
+print('''
 #include "state/cr_currentpointers.h"
 #include "state.h"
@@ -22,9 +23,9 @@
 
 typedef void (*convert_func) (GLfloat *, const unsigned char *);
-'''
+''')
 
 import convert
 
-for k in current_fns.keys():
+for k in sorted(current_fns.keys()):
 	name = k
 	name = '%s%s' % (k[:1].lower(),k[1:])
@@ -32,18 +33,18 @@
 	num_members = len(current_fns[k]['default']) + 1
 
-	print '#define VPINCH_CONVERT_%s(op,data,dst) \\' % ucname
-	print '{\\'
-	print '\tGLfloat vdata[%d] = {' % num_members,
+	print('#define VPINCH_CONVERT_%s(op,data,dst) \\' % ucname)
+	print('{\\')
+	print('\tGLfloat vdata[%d] = {' % num_members, end=' ')
 
 ## Copy dst data into vdata
 	i = 0;
 	for defaultvar in current_fns[k]['default']:
-		print '%d' % defaultvar,
+		print('%d' % defaultvar, end=' ')
 		if i != num_members:
-			print ',',
+			print(',', end=' ')
 		i += 1
-	print '};\\'
-
-	print '\tswitch (op) { \\'
+	print('};\\')
+
+	print('\tswitch (op) { \\')
 	for type in current_fns[k]['types']:
 		if type[0:1] == "N":
@@ -55,26 +56,26 @@
 			uctype = type.upper()
 			if ucname == 'EDGEFLAG':
-				print '\tcase CR_%s_OPCODE: \\' % ucname
+				print('\tcase CR_%s_OPCODE: \\' % ucname)
 			else:
-				print '\tcase CR_%s%d%s_OPCODE: \\' % (ucname,size,uctype)
+				print('\tcase CR_%s%d%s_OPCODE: \\' % (ucname,size,uctype))
 			
 			if (ucname == 'COLOR' or ucname == 'NORMAL' or ucname == 'SECONDARYCOLOR' or normalize) and type != 'f' and type != 'd':
-				print '\t\t__convert_rescale_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type'])
+				print('\t\t__convert_rescale_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type']))
 			else:
-				print '\t\t__convert_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type'])
-			print '\t\tbreak; \\'
-
-	print '\tdefault: \\'
-	print '\t\tcrSimpleError ( "Unknown opcode in VPINCH_CONVERT_%s" ); \\' % ucname
-	print '\t}\\'
+				print('\t\t__convert_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type']))
+			print('\t\tbreak; \\')
+
+	print('\tdefault: \\')
+	print('\t\tcrSimpleError ( "Unknown opcode in VPINCH_CONVERT_%s" ); \\' % ucname)
+	print('\t}\\')
 
 	i = 0
 	for member in current_fns[k]['members']:
-		print '\t(dst).%s = vdata[%d];\\' % (member,i)
+		print('\t(dst).%s = vdata[%d];\\' % (member,i))
 		i += 1
 
-	print '}\n'
-
-print '''
+	print('}\n')
+
+print('''
 
 void crStateCurrentRecover( void )
@@ -187,15 +188,15 @@
 	c->colorIndexPre = c->colorIndex;
 
-'''
-
-for k in current_fns.keys():
-	print '\t/* %s */' % k
-	print '\tv=NULL;'
+''')
+
+for k in sorted(current_fns.keys()):
+	print('\t/* %s */' % k)
+	print('\tv=NULL;')
 	name = '%s%s' % (k[:1].lower(),k[1:])
 
 	indent = ""
-	if current_fns[k].has_key( 'array' ):
-		print '\tfor (i = 0 ; i < %s ; i++)' % current_fns[k]['array']
-		print '\t{'
+	if 'array' in current_fns[k]:
+		print('\tfor (i = 0 ; i < %s ; i++)' % current_fns[k]['array'])
+		print('\t{')
 		indent += "\t"
 	for type in current_fns[k]['types']:
@@ -208,66 +209,66 @@
 		for size in current_fns[k]['sizes']:
 			ptr = '%s->%s%d' % (name, type, size )
-			if current_fns[k].has_key( 'array' ):
+			if 'array' in current_fns[k]:
 				ptr += "[i]"
-			print '%s\tif (v < %s)' % (indent, ptr)
-			print '%s\t{' % indent
-			print '%s\t\tv = %s;' % (indent, ptr)
+			print('%s\tif (v < %s)' % (indent, ptr))
+			print('%s\t{' % indent)
+			print('%s\t\tv = %s;' % (indent, ptr))
 			if (k == 'Color' or k == 'Normal' or k == 'SecondaryColor' or normalized) and type != 'f' and type != 'd' and type != 'l':
-				print '%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size)
+				print('%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size))
 			else:
-				print '%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size)
-			print '%s\t}' % indent
-	print ''
-	print '%s\tif (v != NULL) {' % indent
-	if current_fns[k].has_key( 'array' ):
+				print('%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size))
+			print('%s\t}' % indent)
+	print('')
+	print('%s\tif (v != NULL) {' % indent)
+	if 'array' in current_fns[k]:
 		if k == 'TexCoord':
-			print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name)
+			print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name))
 		else:
-			print '%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name)
+			print('%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name))
 	else:
 		if k == 'Normal':
-			print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name)
+			print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name))
 		elif k == 'FogCoord':
-			print '%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] =  %s_default;' % (indent,name)
+			print('%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] =  %s_default;' % (indent,name))
 		elif k == 'Color':
-			print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name)
+			print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name))
 		elif k == 'SecondaryColor':
-			print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1],  %s_default);' % (indent,name)
+			print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1],  %s_default);' % (indent,name))
 		elif k == 'TexCoord':
-			print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name)
+			print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name))
 		elif k == 'Index':
-			print '%s\t\tc->colorIndex =  %s_default;' % (indent,name)
+			print('%s\t\tc->colorIndex =  %s_default;' % (indent,name))
 		elif k == 'EdgeFlag':
-			print '%s\t\tc->edgeFlag =  %s_default;' % (indent,name)
+			print('%s\t\tc->edgeFlag =  %s_default;' % (indent,name))
 		else:
-			print '%s\t\tc->%s = %s_default;' % (indent,name,name)
+			print('%s\t\tc->%s = %s_default;' % (indent,name,name))
 	if k == 'EdgeFlag':
-		print '%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent)
+		print('%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent))
 		dirtyVar = 'cb->edgeFlag'
 	elif k == 'Normal':
-		print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent)
+		print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent))
 		dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_NORMAL]'
 	elif k == 'TexCoord':
-		print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent)
+		print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent))
 		dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_TEX0 + i]'
 	elif k == 'Color':
-		print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent)
+		print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent))
 		dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR0]'
 	elif k == 'Index':
-		print '%s\t\tconvert(&(c->colorIndex), v);' % (indent)
+		print('%s\t\tconvert(&(c->colorIndex), v);' % (indent))
 		dirtyVar = 'cb->colorIndex'
 	elif k == 'SecondaryColor':
-		print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent)
+		print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent))
 		dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR1]'
 	elif k == 'FogCoord':
-		print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent)
+		print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent))
 		dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_FOG]'
 	elif k == 'VertexAttrib':
-		print '%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent)
+		print('%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent))
 		dirtyVar = 'cb->vertexAttrib[i]'
 	else:
 		assert 0  # should never get here
 
-	print '%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar)
+	print('%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar))
 
 #	if current_fns[k].has_key( 'array' ):
@@ -278,15 +279,15 @@
 
 
-	print '%s\t\tDIRTY(cb->dirty, nbitID);' % indent
-	print '%s\t}' % indent
-	if current_fns[k].has_key( 'array' ):
-		print '%s\t%s->ptr[i] = v;' % (indent, name )
+	print('%s\t\tDIRTY(cb->dirty, nbitID);' % indent)
+	print('%s\t}' % indent)
+	if 'array' in current_fns[k]:
+		print('%s\t%s->ptr[i] = v;' % (indent, name ))
 	else:
-		print '%s\t%s->ptr = v;' % (indent, name )
-	if current_fns[k].has_key( 'array' ):
-		print '\t}'
-print '}'
-
-print '''
+		print('%s\t%s->ptr = v;' % (indent, name ))
+	if 'array' in current_fns[k]:
+		print('\t}')
+print('}')
+
+print('''
 
 void crStateCurrentRecoverNew(CRContext *g, CRCurrentStatePointers  *current)
@@ -365,19 +366,19 @@
 
 
-'''
-
-for k in current_fns_new.keys():
-    print '\t/* %s */' % k
-    print '\tif (current->changed%s)' % k
-    print '\t{'
-    print '\t\tv=NULL;'
+''')
+
+for k in sorted(current_fns_new.keys()):
+    print('\t/* %s */' % k)
+    print('\tif (current->changed%s)' % k)
+    print('\t{')
+    print('\t\tv=NULL;')
     name = '%s%s' % (k[:1].lower(),k[1:])
 
     indent = ""
-    if current_fns_new[k].has_key( 'array' ):
-        print '\t\tfor (i = 0 ; i < %s ; i++)' % current_fns_new[k]['array']
-        print '\t\t{'
+    if 'array' in current_fns_new[k]:
+        print('\t\tfor (i = 0 ; i < %s ; i++)' % current_fns_new[k]['array'])
+        print('\t\t{')
         indent += "\t\t"
-        print '\t\tif (!(current->changed%s & (1 << i))) continue;' % k
+        print('\t\tif (!(current->changed%s & (1 << i))) continue;' % k)
     for type in current_fns_new[k]['types']:
         if type[0:1] == "N":
@@ -389,74 +390,74 @@
         for size in current_fns_new[k]['sizes']:
             ptr = '%s->%s%d' % (name, type, size )
-            if current_fns_new[k].has_key( 'array' ):
+            if 'array' in current_fns_new[k]:
                 ptr += "[i]"
-            print '#ifdef DEBUG_misha'
-            print '%s\tif (%s)' % (indent, ptr)
-            print '%s\t{' % (indent)
-            print '%s\t\tuint32_t *pTst = (uint32_t*)(%s);' % (indent, ptr)
-            print '%s\t\t--pTst;' % (indent)
-            print '%s\t\tAssert((*pTst) == i);' % (indent)
-            print '%s\t}' % (indent)
-            print '#endif'
-            print '%s\tif (v < %s)' % (indent, ptr)
-            print '%s\t{' % indent
-            print '%s\t\tv = %s;' % (indent, ptr)
+            print('#ifdef DEBUG_misha')
+            print('%s\tif (%s)' % (indent, ptr))
+            print('%s\t{' % (indent))
+            print('%s\t\tuint32_t *pTst = (uint32_t*)(%s);' % (indent, ptr))
+            print('%s\t\t--pTst;' % (indent))
+            print('%s\t\tAssert((*pTst) == i);' % (indent))
+            print('%s\t}' % (indent))
+            print('#endif')
+            print('%s\tif (v < %s)' % (indent, ptr))
+            print('%s\t{' % indent)
+            print('%s\t\tv = %s;' % (indent, ptr))
             if (k == 'Color' or k == 'Normal' or k == 'SecondaryColor' or normalized) and type != 'f' and type != 'd' and type != 'l':
-                print '%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size)
+                print('%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size))
             else:
-                print '%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size)
-            print '%s\t}' % indent
-    print ''
-    print '%s\tif (v != NULL) {' % indent
-    if current_fns_new[k].has_key( 'array' ):
+                print('%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size))
+            print('%s\t}' % indent)
+    print('')
+    print('%s\tif (v != NULL) {' % indent)
+    if 'array' in current_fns_new[k]:
         if k == 'TexCoord':
-            print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name)
+            print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name))
         else:
-            print '%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name)
+            print('%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name))
     else:
         if k == 'Normal':
-            print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name)
+            print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name))
         elif k == 'FogCoord':
-            print '%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] =  %s_default;' % (indent,name)
+            print('%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] =  %s_default;' % (indent,name))
         elif k == 'Color':
-            print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name)
+            print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name))
         elif k == 'SecondaryColor':
-            print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1],  %s_default);' % (indent,name)
+            print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1],  %s_default);' % (indent,name))
         elif k == 'TexCoord':
-            print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name)
+            print('%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name))
         elif k == 'Index':
-            print '%s\t\tc->colorIndex =  %s_default;' % (indent,name)
+            print('%s\t\tc->colorIndex =  %s_default;' % (indent,name))
         elif k == 'EdgeFlag':
-            print '%s\t\tc->edgeFlag =  %s_default;' % (indent,name)
+            print('%s\t\tc->edgeFlag =  %s_default;' % (indent,name))
         else:
-            print '%s\t\tc->%s = %s_default;' % (indent,name,name)
+            print('%s\t\tc->%s = %s_default;' % (indent,name,name))
     if k == 'EdgeFlag':
-        print '%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent)
+        print('%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent))
         dirtyVar = 'cb->edgeFlag'
     elif k == 'Normal':
-        print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent)
+        print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent))
         dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_NORMAL]'
     elif k == 'TexCoord':
-        print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent)
+        print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent))
         dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_TEX0 + i]'
     elif k == 'Color':
-        print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent)
+        print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent))
         dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR0]'
     elif k == 'Index':
-        print '%s\t\tconvert(&(c->colorIndex), v);' % (indent)
+        print('%s\t\tconvert(&(c->colorIndex), v);' % (indent))
         dirtyVar = 'cb->colorIndex'
     elif k == 'SecondaryColor':
-        print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent)
+        print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent))
         dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR1]'
     elif k == 'FogCoord':
-        print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent)
+        print('%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent))
         dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_FOG]'
     elif k == 'VertexAttrib':
-        print '%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent)
+        print('%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent))
         dirtyVar = 'cb->vertexAttrib[i]'
     else:
         assert 0  # should never get here
 
-    print '%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar)
+    print('%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar))
 
 #   if current_fns_new[k].has_key( 'array' ):
@@ -467,14 +468,14 @@
 
 
-    print '%s\t\tDIRTY(cb->dirty, nbitID);' % indent
-    print '%s\t}' % indent
-    if current_fns_new[k].has_key( 'array' ):
-        print '%s\t%s->ptr[i] = v;' % (indent, name )
+    print('%s\t\tDIRTY(cb->dirty, nbitID);' % indent)
+    print('%s\t}' % indent)
+    if 'array' in current_fns_new[k]:
+        print('%s\t%s->ptr[i] = v;' % (indent, name ))
     else:
-        print '%s\t%s->ptr = v;' % (indent, name )
-    if current_fns_new[k].has_key( 'array' ):
-        print '\t\t}'
-        print '\t\tcurrent->changed%s = 0;' % k
-        print '\t}'
-print '\tcrStateResetCurrentPointers(current);'
-print '}'
+        print('%s\t%s->ptr = v;' % (indent, name ))
+    if 'array' in current_fns_new[k]:
+        print('\t\t}')
+        print('\t\tcurrent->changed%s = 0;' % k)
+        print('\t}')
+print('\tcrStateResetCurrentPointers(current);')
+print('}')
Index: trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_funcs.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_funcs.py	(revision 63459)
+++ trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_funcs.py	(revision 63939)
@@ -5,4 +5,5 @@
 
 
+from __future__ import print_function
 import sys
 
@@ -13,5 +14,5 @@
 apiutil.CopyrightC()
 
-print """
+print("""
 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY state_funcs.py SCRIPT */
 #ifndef CR_STATE_FUNCS_H
@@ -33,5 +34,5 @@
 #endif
 
-#define STATE_UNUSED(x) ((void)x)"""
+#define STATE_UNUSED(x) ((void)x)""")
 
 
@@ -40,18 +41,18 @@
 	return_type = apiutil.ReturnType(func_name)
 	params = apiutil.Parameters(func_name)
-	print 'DECLEXPORT(%s) STATE_APIENTRY crState%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))
+	print('DECLEXPORT(%s) STATE_APIENTRY crState%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params)))
 
 for func_name in apiutil.AllSpecials( "state_feedback" ):
 	return_type = apiutil.ReturnType(func_name)
 	params = apiutil.Parameters(func_name)
-	print 'DECLEXPORT(%s) STATE_APIENTRY crStateFeedback%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))
+	print('DECLEXPORT(%s) STATE_APIENTRY crStateFeedback%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params)))
 
 for func_name in apiutil.AllSpecials( "state_select" ):
 	return_type = apiutil.ReturnType(func_name)
 	params = apiutil.Parameters(func_name)
-	print 'DECLEXPORT(%s) STATE_APIENTRY crStateSelect%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params))
+	print('DECLEXPORT(%s) STATE_APIENTRY crStateSelect%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString(params)))
 
 
-print """
+print("""
 #ifdef __cplusplus
 }
@@ -59,3 +60,3 @@
 
 #endif /* CR_STATE_FUNCS_H */
-"""
+""")
Index: trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_get.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_get.py	(revision 63459)
+++ trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_get.py	(revision 63939)
@@ -4,4 +4,5 @@
 # See the file LICENSE.txt for information on redistributing this software.
 
+from __future__ import print_function
 import sys, re, string
 import apiutil
@@ -21,5 +22,5 @@
 		type = match.group(1)
 		pname = match.group(2)
-		fields = string.split( match.group(3) )
+		fields = match.group(3).split()
 		params[pname] = ( type, fields )
 
@@ -33,5 +34,5 @@
 		pname = match.group(2)
 		ifdef = match.group(3)
-		fields = string.split( match.group(4) )
+		fields = match.group(4).split()
 		extended_params[pname] = ( type, ifdef, fields )
 
@@ -104,5 +105,5 @@
 apiutil.CopyrightC()
 
-print """
+print("""
 /* DO NOT EDIT - THIS FILE GENERATED BY state_get.txt AND THE state_get.py SCRIPT */
 #include <stdio.h>
@@ -141,5 +142,5 @@
     return g->framebufferobject.readFB ? g->framebufferobject.readFB->readbuffer : g->buffer.readBuffer;
 }
-"""
+""")
 
 header = """
@@ -173,12 +174,10 @@
 
 for rettype in types:
-	print ''
-	print 'void STATE_APIENTRY crStateGet%sv( GLenum pname, %s *params )' % ( rettype, ctypes[rettype] )
-	print header
-
-	keys = params.keys()
-	keys.sort()
-	for pname in keys:
-		print '\t\tcase %s:' % pname
+	print('')
+	print('void STATE_APIENTRY crStateGet%sv( GLenum pname, %s *params )' % ( rettype, ctypes[rettype] ))
+	print(header)
+
+	for pname in sorted(params.keys()):
+		print('\t\tcase %s:' % pname)
 		(srctype,fields) = params[pname]
 		try:
@@ -187,21 +186,19 @@
 			for field in fields:
 				expr = cvt % field
-				print '\t\t\tparams[%d] = %s;' % (i,expr)
+				print('\t\t\tparams[%d] = %s;' % (i,expr))
 				i += 1
 		except:
-			print '\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");'
-		print "\t\t\tbreak;"
-
-
-	keys = extended_params.keys();
-	keys.sort()
-	for pname in keys:
+			print('\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");')
+		print("\t\t\tbreak;")
+
+
+	for pname in sorted(extended_params.keys()):
 		(srctype,ifdef,fields) = extended_params[pname]
 		ext = ifdef[3:]  # the extension name with the "GL_" prefix removed
 		#print '#ifdef %s' % ifdef
-		print '#ifdef CR_%s' % ext
-		print '\t\tcase %s:' % pname
+		print('#ifdef CR_%s' % ext)
+		print('\t\tcase %s:' % pname)
 		if ext != 'OPENGL_VERSION_1_2':
-			print '\t\t\tif (g->extensions.%s) {' % ext
+			print('\t\t\tif (g->extensions.%s) {' % ext)
 		try:
 			cvt = convert[srctype][rettype]
@@ -211,27 +208,27 @@
 				if field[0] == '%':
 					command = string.split(field, '%')
-					print '\t\t\t\t%s;' % command[1]
+					print('\t\t\t\t%s;' % command[1])
 					continue
 				elif ext != 'OPENGL_VERSION_1_2':
-					print '\t\t\t\tparams[%d] = %s;' % (i,expr)
+					print('\t\t\t\tparams[%d] = %s;' % (i,expr))
 				else:
-					print '\t\t\tparams[%d] = %s;' % (i,expr)
+					print('\t\t\tparams[%d] = %s;' % (i,expr))
 				i += 1
 		except:
-			print '\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");'
+			print('\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_OPERATION, "Unimplemented glGet!");')
 		if ext != 'OPENGL_VERSION_1_2':
-			print "\t\t\t}"
-			print "\t\t\telse {"
-			print '\t\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_ENUM, "glGet%sv");' % rettype
-			print "\t\t\t}"
-		print "\t\t\tbreak;"
+			print("\t\t\t}")
+			print("\t\t\telse {")
+			print('\t\t\t\tcrStateError(__LINE__,__FILE__,GL_INVALID_ENUM, "glGet%sv");' % rettype)
+			print("\t\t\t}")
+		print("\t\t\tbreak;")
 		#print '#endif /* %s */' % ifdef
-		print '#endif /* CR_%s */' % ext
-
-	print '\t\tdefault:'
-	print '\t\t\tcrStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glGet: Unknown enum: 0x%x", pname);'
-	print '\t\t\treturn;'
-	print '\t}'
-	print '}'
+		print('#endif /* CR_%s */' % ext)
+
+	print('\t\tdefault:')
+	print('\t\t\tcrStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glGet: Unknown enum: 0x%x", pname);')
+	print('\t\t\treturn;')
+	print('\t}')
+	print('}')
 
 from get_components import *
Index: trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_isenabled.py
===================================================================
--- trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_isenabled.py	(revision 63459)
+++ trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_isenabled.py	(revision 63939)
@@ -4,4 +4,5 @@
 # See the file LICENSE.txt for information on redistributing this software.
 
+from __future__ import print_function
 import sys, re, string
 import apiutil
@@ -20,5 +21,5 @@
 		type = match.group(1)
 		pname = match.group(2)
-		fields = string.split( match.group(3) )
+		fields = match.group(3).split()
 		params[pname] = ( type, fields )
 
@@ -30,10 +31,10 @@
 		pname = match.group(2)
 		ifdef = match.group(3)
-		fields = string.split( match.group(4) )
+		fields = match.group(4).split()
 		extended_params[pname] = ( type, ifdef, fields )
 
 apiutil.CopyrightC()
 
-print """
+print("""
 /* DO NOT EDIT - THIS FILE GENERATED BY THE state_isenabled.py SCRIPT */
 #include <stdio.h>
@@ -54,27 +55,21 @@
 
     switch ( pname ) {
-"""
+""")
 
-keys = params.keys()
-keys.sort();
+for pname in sorted(params.keys()):
+	print("\tcase %s:" % pname)
+	print("\t\treturn %s;" % params[pname][1][0])
 
-for pname in keys:
-	print "\tcase %s:" % pname
-	print "\t\treturn %s;" % params[pname][1][0]
-
-keys = extended_params.keys();
-keys.sort()
-
-for pname in keys:
+for pname in sorted(extended_params.keys()):
 	(srctype,ifdef,fields) = extended_params[pname]
 	ext = ifdef[3:]  # the extension name with the "GL_" prefix removed
 	ext = ifdef
-	print '#ifdef CR_%s' % ext
-	print "\tcase %s:" % pname
-	print "\t\treturn %s;" % extended_params[pname][2][0]
-	print '#endif /* CR_%s */' % ext
-print "\tdefault:"
-print "\t\tcrStateError(__LINE__, __FILE__, GL_INVALID_ENUM, \"glIsEnabled: Unknown enum: %d\", pname);"
-print "\t\treturn 0;"
-print "\t}"
-print "}"
+	print('#ifdef CR_%s' % ext)
+	print("\tcase %s:" % pname)
+	print("\t\treturn %s;" % extended_params[pname][2][0])
+	print('#endif /* CR_%s */' % ext)
+print("\tdefault:")
+print("\t\tcrStateError(__LINE__, __FILE__, GL_INVALID_ENUM, \"glIsEnabled: Unknown enum: %d\", pname);")
+print("\t\treturn 0;")
+print("\t}")
+print("}")
