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