summaryrefslogtreecommitdiff
path: root/src/VBox/Additions/common/crOpenGL/tsfuncs.py
blob: 0b4f78ff7feec09e6f487db96f8620e3af57e658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.

import sys

import apiutil


apiutil.CopyrightC()

print """
/* DO NOT EDIT - THIS FILE GENERATED BY THE tsfuncs.py SCRIPT */

#include "stub.h"
"""

keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")

for func_name in keys:
	return_type = apiutil.ReturnType(func_name)
	params = apiutil.Parameters(func_name)

	print "static %s SPULOAD_APIENTRY ts_%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params) )
	print "{"
	print "\tSPUDispatchTable *tab = (SPUDispatchTable *) crGetTSD(&stub.dispatchTSD);"

	if return_type != "void":
		print "\treturn ",

	print "\ttab->%s( %s );" % (func_name, apiutil.MakeCallString(params))
	print "}"
	print ""


print "SPUDispatchTable stubThreadsafeDispatch = {"

for func_name in keys:
	print "\tts_%s," % func_name

print "\tNULL,  /* copyList */"
print "\tNULL,  /* copy_of */"
print "\t0,     /* mark */"
print "\tNULL   /* server */"
print "};"