1 | # Copyright (c) 2001, Stanford University
|
---|
2 | # All rights reserved.
|
---|
3 | #
|
---|
4 | # See the file LICENSE.txt for information on redistributing this software.
|
---|
5 |
|
---|
6 | from __future__ import print_function
|
---|
7 | import sys
|
---|
8 |
|
---|
9 | import apiutil
|
---|
10 |
|
---|
11 |
|
---|
12 | apiutil.CopyrightC()
|
---|
13 |
|
---|
14 | print("""
|
---|
15 | /* DO NOT EDIT - THIS FILE GENERATED BY THE tsfuncs.py SCRIPT */
|
---|
16 |
|
---|
17 | #include "stub.h"
|
---|
18 | """)
|
---|
19 |
|
---|
20 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
21 |
|
---|
22 | for func_name in keys:
|
---|
23 | return_type = apiutil.ReturnType(func_name)
|
---|
24 | params = apiutil.Parameters(func_name)
|
---|
25 |
|
---|
26 | print("static %s SPULOAD_APIENTRY ts_%s(%s)" % (return_type, func_name, apiutil.MakeDeclarationString(params) ))
|
---|
27 | print("{")
|
---|
28 | print("\tSPUDispatchTable *tab = (SPUDispatchTable *) crGetTSD(&stub.dispatchTSD);")
|
---|
29 |
|
---|
30 | if return_type != "void":
|
---|
31 | print("\treturn ", end=" ")
|
---|
32 |
|
---|
33 | print("\ttab->%s(%s);" % (func_name, apiutil.MakeCallString(params)))
|
---|
34 | print("}")
|
---|
35 | print("")
|
---|
36 |
|
---|
37 |
|
---|
38 | print("SPUDispatchTable stubThreadsafeDispatch = {")
|
---|
39 |
|
---|
40 | for func_name in keys:
|
---|
41 | print("\tts_%s," % func_name)
|
---|
42 |
|
---|
43 | print("\tNULL, /* copyList */")
|
---|
44 | print("\tNULL, /* copy_of */")
|
---|
45 | print("\t0, /* mark */")
|
---|
46 | print("\tNULL /* server */")
|
---|
47 | print("};")
|
---|