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 | apiutil.CopyrightC()
|
---|
13 |
|
---|
14 |
|
---|
15 | print("""#include <stdio.h>
|
---|
16 | #include "cr_error.h"
|
---|
17 | #include "cr_spu.h"
|
---|
18 | #include "state/cr_statetypes.h"
|
---|
19 |
|
---|
20 | #if defined(WINDOWS)
|
---|
21 | #define ERROR_APIENTRY __stdcall
|
---|
22 | #else
|
---|
23 | #define ERROR_APIENTRY
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | #define ERROR_UNUSED(x) ((void)x)""")
|
---|
27 |
|
---|
28 |
|
---|
29 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
30 |
|
---|
31 | for func_name in keys:
|
---|
32 | return_type = apiutil.ReturnType(func_name)
|
---|
33 | params = apiutil.Parameters(func_name)
|
---|
34 | print('\nstatic %s ERROR_APIENTRY error%s(%s)' % (return_type, func_name, apiutil.MakeDeclarationString(params )))
|
---|
35 | print('{')
|
---|
36 | # Handle the void parameter list
|
---|
37 | for (name, type, vecSize) in params:
|
---|
38 | print('\tERROR_UNUSED(%s);' % name)
|
---|
39 | print('\tcrError("ERROR SPU: Unsupported function gl%s called!");' % func_name)
|
---|
40 | if return_type != "void":
|
---|
41 | print('\treturn (%s)0;' % return_type)
|
---|
42 | print('}')
|
---|
43 |
|
---|
44 | print('SPUNamedFunctionTable _cr_error_table[] = {')
|
---|
45 | for index in range(len(keys)):
|
---|
46 | func_name = keys[index]
|
---|
47 | print('\t{ "%s", (SPUGenericFunction) error%s },' % (func_name, func_name ))
|
---|
48 | print('\t{ NULL, NULL }')
|
---|
49 | print('};')
|
---|