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 |
|
---|
7 | from __future__ import print_function
|
---|
8 | import sys
|
---|
9 |
|
---|
10 | import apiutil
|
---|
11 |
|
---|
12 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
13 |
|
---|
14 | apiutil.CopyrightC()
|
---|
15 |
|
---|
16 | print("""
|
---|
17 | /* DO NOT EDIT - THIS FILE GENERATED BY THE NULLfuncs.py SCRIPT */
|
---|
18 |
|
---|
19 | #include "cr_error.h"
|
---|
20 | #include "stub.h"
|
---|
21 | """)
|
---|
22 |
|
---|
23 | for func_name in keys:
|
---|
24 | return_type = apiutil.ReturnType(func_name)
|
---|
25 | params = apiutil.Parameters(func_name)
|
---|
26 |
|
---|
27 | print("static %s SPULOAD_APIENTRY NULL_%s(%s)" % (return_type, func_name, apiutil.MakeDeclarationString(params)))
|
---|
28 | print("{")
|
---|
29 | print("\t/* do nothing */")
|
---|
30 | print("\tcrWarning(\"YOU ARE CALLING A NULLED FUNCTION (%s)\");" % func_name)
|
---|
31 | for (name, type, vecSize) in params:
|
---|
32 | print("\t(void) %s;" % name)
|
---|
33 | if return_type != "void":
|
---|
34 | print("\treturn 0;")
|
---|
35 | print("}")
|
---|
36 | print("")
|
---|
37 |
|
---|
38 |
|
---|
39 | print("DECLEXPORT(SPUDispatchTable) stubNULLDispatch = {")
|
---|
40 | for func_name in keys:
|
---|
41 | print("\tNULL_%s," % (func_name))
|
---|
42 | print("\tNULL, /* copyList */")
|
---|
43 | print("\tNULL, /* copy_of */")
|
---|
44 | print("\t0, /* mark */")
|
---|
45 | print("\tNULL /* server */")
|
---|
46 | print("};")
|
---|
47 |
|
---|
48 | print("")
|
---|
49 | print("/* Declare and initialize the glim dispatch table here so that we */")
|
---|
50 | print("/* can initialize all entries to no-op routines. */")
|
---|
51 | print("SPUDispatchTable glim = {")
|
---|
52 | for func_name in keys:
|
---|
53 | print("\tNULL_%s," % (func_name))
|
---|
54 | print("\tNULL, /* copyList */")
|
---|
55 | print("\tNULL, /* copy_of */")
|
---|
56 | print("\t0, /* mark */")
|
---|
57 | print("\tNULL /* server */")
|
---|
58 | print("};")
|
---|